04.12.2009, 22:28
I made this afk system thing and I have a problem
When you do /afk, your name is set like this: [AFK]J_money
But when you do /back, ur name is still set like this
I have the code, can anyone fix the problem for me?
When you do /afk, your name is set like this: [AFK]J_money
But when you do /back, ur name is still set like this
I have the code, can anyone fix the problem for me?
Код:
if(strcmp(cmdtext, "/afk", true) == 0) { new tmp[256]; new name[256]; new string[256]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); TogglePlayerControllable(playerid, false); format(string, sizeof(string), "%s is afk'd", name); SendClientMessageToAll(COLOR_BLUEGREEN, string); playerid = strval(tmp); if (IsPlayerConnected(playerid)) { GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "[AFK]%s" ,playerid,sendername, cmdtext[2]); SetPlayerName(playerid, "%s"); } SendClientMessage(playerid, COLOR_BLUEGREEN, "If you want to return type /back"); return 1; } if (strcmp(cmdtext, "/back", true) == 0) { new tmp[256]; new name[256]; new string[256]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); TogglePlayerControllable(playerid, true); format(string, sizeof(string), "%s has returned", name); SendClientMessageToAll(COLOR_BLUEGREEN, string); playerid = strval(tmp); if (IsPlayerConnected(playerid)) { GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s", name); SetPlayerName(playerid, name); } SendClientMessage(playerid, COLOR_BLUEGREEN, "Welcome Back"); return 1; }