help with afk
#1

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?

Код:
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;
		}
Reply


Messages In This Thread
help with afk - by tommy5933 - 04.12.2009, 22:28
Re: help with afk - by Zamaroht - 04.12.2009, 22:33
Re: help with afk - by tommy5933 - 04.12.2009, 22:41
Re: help with afk - by Zamaroht - 04.12.2009, 22:43
Re: help with afk - by p00p - 04.12.2009, 22:45
Re: help with afk - by tommy5933 - 04.12.2009, 22:48

Forum Jump:


Users browsing this thread: 1 Guest(s)