26.05.2013, 02:11
pawn Code:
//Variables
new AFK[MAX_PLAYERS];
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/afk", cmdtext, true, 10) == 0)
{
new string[128];
//
format(string,sizeof(string),"%s(%d) Is now AFK 'Away From Keyboard'", PlayerName(playerid), playerid);
SendClientMessageToAll(COLOR_GREEN, string);
//
SendClientMessage(playerid,COLOR_YELLOW,"Use /back when your back");
//
AFK[playerid] =1;
//
TogglePlayerControllable(playerid, 0);
return 1;
}
if (strcmp("/back", cmdtext, true, 10) == 0)
{
new string[128];
//
format(string,sizeof(string),"%s(%d) Is now back on his computer", PlayerName(playerid), playerid);
SendClientMessageToAll(COLOR_GREEN, string);
//
SendClientMessage(playerid,COLOR_YELLOW,"Use /afk if you want to use AFK again");
//
AFK[playerid] =0;
//
TogglePlayerControllable(playerid, 1);
return 1;
}
return 0;
}
pawn Code:
stock PlayerName(playerid)
{
new name[255];
GetPlayerName(playerid, name, 255);
return name;
}
Anyway I can see that you're new to scripting and newbies do tend to make mistakes, the code may work perfectly fine yes, but the methods used are bad. Again I am not trying to hate or anything, good work for the effort.