View Single Post
Author Message
tedaimlocks
Senior Member
Join Date: Jan 2024
Old 04-15-2024 , 16:01   Choosing a random player
Reply With Quote #1

Can someone help with the code below?I dont know how to get a random player and give them the stuff

HTML Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <colorchat>

#define PLUGIN "Random Hero"
#define VERSION "1.0"
#define AUTHOR "tedaimlocks"

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

public logevent_RoundStart()
	set_task(1.0, "ChooseHero");


public ChooseHero()
{
        // Choose a random player every round and give them the stuff under

        set_user_armor(id, get_user_armor(id) + 150);
        set_user_health(id, get_user_health(id) + 150);
	give_item(id, "weapon_hegrenade");
	give_item(id, "weapon_flashbang");

	new szName[32];
	get_user_name(id, szName, charsmax(szName));
        ColorChat(0, GREEN, "^x01[^x04SPK ZM^x01]^x04 %s ^x03was chosen to be the ^x04Hero ^x03of the round! They have got ^x04+150HP+150AP+MULTIJUMPS", szName);
}

Last edited by tedaimlocks; 04-17-2024 at 03:40.
tedaimlocks is offline