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


Raised This Month: $ Target: $400
 0% 

Choosing a random player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 03:57.


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