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);
}
Code:
public ChooseHero(){// Choose a random player every round and give them the stuff undernew 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)}
public ChooseHero(){// Choose a random player every round and give them the stuff undernew 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 )
Based on what its said, it doesn't matter:
----------------------------------
native random(max);
Description
Returns a random number between 0 and a specified upper bound.
----------------------------------
so if there are 3 players, let's say, you can throw a larger random number like 4 you mean
Quote:
Originally Posted by tedaimlocks
...run time error 4 : index out of bounds
test
Code:
public ChooseHero(){// Choose a random player every round and give them the stuff undernew players[32], num; get_players(players, num, "a")if(!num ){return}//...}