This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Kill event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tedaimlocks
Member
Join Date: Jan 2024
Old 04-21-2024 , 13:03   Kill event
Reply With Quote #1

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;
}
Attached Files
File Type: sma Get Plugin or Get Source (zp_quests.sma - 27 views - 2.8 KB)

Last edited by tedaimlocks; 04-21-2024 at 13:34.
tedaimlocks is offline
mlibre
Veteran Member
Join Date: Nov 2015
Location: return PLUGIN_CONTINUE
Old 04-21-2024 , 13:29   Re: Kill event
Reply With Quote #2

follow up how? some accountant something like that
__________________
mlibre is offline
tedaimlocks
Member
Join Date: Jan 2024
Old 04-21-2024 , 13:34   Re: Kill event
Reply With Quote #3

Quote:
Originally Posted by mlibre View Post
follow up how? some accountant something like that
what do u mean
tedaimlocks is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 04-21-2024 , 13:44   Re: Kill event
Reply With Quote #4

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
__________________

Last edited by Napoleon_be; 04-21-2024 at 13:44.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
tedaimlocks
Member
Join Date: Jan 2024
Old 04-21-2024 , 15:06   Re: Kill event
Reply With Quote #5

Quote:
Originally Posted by Napoleon_be View Post
thanks
tedaimlocks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:38.


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