AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Kill event (https://forums.alliedmods.net/showthread.php?t=347377)

tedaimlocks 04-21-2024 13:03

Kill event
 
1 Attachment(s)
How can i make something to keep trace of kills for each player?

HTML Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <zp_buymenu>
#include <colorchat>
#include <zombieplague>

#define PLUGIN "Quests"
#define VERSION "1.0"
#define AUTHOR "tedaimlocks"

new FiveKillsMission[32];
new FiveInfectionsMission[32];

new FiveKillsMissionReward = 15000;
new FiveInfectionsMissionReward = 15000;

new bool:FinishedMission[32] = false;
new bool:HasChosenMission[32] = false;

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        register_logevent("logevent_RoundStart", 2, "1=Round_Start");
        register_logevent("logevent_RoundEnd", 2, "1=Round_End");
}

public QuestsMenu(id) {
        new menu = menu_create("\ySPK - Zombie Plague \r[CSO] \d | Quests", "QuestsMenuHandler")
        menu_additem(menu, "\wKill \r5 \wZombies \d[\wReward: \y$\r15K\d]", "1")
        menu_additem(menu, "\wInfect \r5 \wHumans \d[\wReward: \y$\r15K\d]", "2")
        menu_setprop(menu, MPROP_EXITNAME, "Exit");
        menu_display(id, menu)
}

public QuestsMenuHandler(id, menu, item) {
    switch(item) {
        case 0: {
            if(is_user_alive(id))
                QuestMenu5Kills(id);
            else
                return PLUGIN_HANDLED;
        }
        case 1: {
            if(is_user_alive(id))
                QuestMenu5Infections(id);
            else
                return PLUGIN_HANDLED;
        }
    }
    return PLUGIN_CONTINUE;
}

public QuestMenu5Kills(id) {
    set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 2.0)
    show_hudmessage(id, "Mission: Kill 5 Zombies^nReward: 15000$")
    HasChosenMission[id] = true
}

public QuestMenu5Infections(id) {
    set_hudmessage(255, 255, 0, -1.0, -1.0, 0, 6.0, 2.0)
    show_hudmessage(id, "Mission: Infect 5 Humans^nReward: 15000$")
    HasChosenMission[id] = true
}

public logevent_RoundStart() {
    for(new i = 1; i <= get_maxplayers(); i++) {
        if(is_user_connected(i) && is_user_alive(i) && !is_user_bot(i)) {
            QuestsMenu(i);
        }
    }
}

public logevent_RoundEnd(id) {
    if(FinishedMission[id] && FiveKillsMission[id] && HasChosenMission[id]) {
        set_hudmessage(50, 255, 0, -1.0, -1.0, 0, 6.0, 2.0)
        show_hudmessage(id, "Mission Completed")
        zp_cs_set_user_money(id, zp_cs_get_user_money(id) + FiveKillsMissionReward);
    }
    else if(FinishedMission[id] && FiveInfectionsMission[id] && HasChosenMission[id]) {
        set_hudmessage(50, 255, 0, -1.0, -1.0, 0, 6.0, 2.0)
        show_hudmessage(id, "Mission Completed")
        zp_cs_set_user_money(id, zp_cs_get_user_money(id) + FiveInfectionsMissionReward);
    }
    else if(HasChosenMission[id]) {
        set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 2.0)
        show_hudmessage(id, "Mission Failed")
    }
    else {
        return PLUGIN_HANDLED;
    }
    return PLUGIN_HANDLED;
}


mlibre 04-21-2024 13:29

Re: Kill event
 
follow up how? some accountant something like that

tedaimlocks 04-21-2024 13:34

Re: Kill event
 
Quote:

Originally Posted by mlibre (Post 2821357)
follow up how? some accountant something like that

what do u mean

Napoleon_be 04-21-2024 13:44

Re: Kill event
 
Use Ham_Killed or DeathMsg and increase the variable value everytime the player gets a valid kill.

https://forums.alliedmods.net/showthread.php?t=324110
https://forums.alliedmods.net/showthread.php?t=209344
https://forums.alliedmods.net/showpo...2&postcount=10

tedaimlocks 04-21-2024 15:06

Re: Kill event
 
Quote:

Originally Posted by Napoleon_be (Post 2821363)

thanks


All times are GMT -4. The time now is 02:54.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.