View Single Post
tedaimlocks
Senior Member
Join Date: Jan 2024
Old 04-16-2024 , 02:34   Re: Choosing a random player
Reply With Quote #7

Quote:
Originally Posted by mlibre View Post
Code:
public ChooseHero() {     // Choose a random player every round and give them the stuff under         new players[32], num; get_players(players, num, "a")         new id = players[random(num)]         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) }
It gives errors if no player is connected ( i think )

run time error 4 : index out of bounds

Last edited by tedaimlocks; 04-16-2024 at 03:42.
tedaimlocks is offline