I can't ban a player in-game?

Posted by DonovanNavarro
I need help with ban. In obj_control, I added "Key Press B" event, in this, there are a code for ban a player:

//the code

var name, player_id, reason, days;

name = get_string("Name of player","")
reason = get_string("Reason","")
days = get_integer("Days",10)

player_id = gms_other_find_by_name(name)

gms_admin_ban(player_id,reason,days)
gms_admin_kick(player_id,reason)


But when I execute the game, and I ban a player, in the chat shows me: "SERVER: Player to ban was not found!"

Replies (1)

Last message on 22 Jun 2016

Size43 (Administrator) on 22 Jun 2016, 14:12:21
Please check what gms_other_find_by_name returns (it might return -1 or 0 on error). Also note this only works if the other player is online when you ban him. I believe the only way to ban players that are offline is through this site, currently.