20.11.2011, 16:12
PHP код:
#include <a_samp>
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define c_r 0xAA3333AA
new Float:lol[3];
new Float:vlol[3];
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/goafk", true))
{
GetPlayerPos(playerid,Float:lol[0],Float:lol[1],Float:lol[2]);
SetTimerEx("AFK",5000,0,5000);
SendClientMessage(playerid,COLOR_YELLOW,"( ! ) Don't move ! Please wait 5 seconds...");
return 1;
}
if(!strcmp(cmdtext, "/back", true))
{
new pName[MAX_PLAYER_NAME];
new string[48];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "( ! ) You are back from AFK mode");
SetPlayerVirtualWorld(playerid,0);
SendClientMessage(playerid, COLOR_GREY, string);
GameTextForPlayer(playerid,"~w~Welcome back",2000,3);
format(string, sizeof(string), "( ! ) %s is back from AFK mode", pName);
SendPlayerMessageToAll(COLOR_GREY, string);
TogglePlayerControllable(playerid,1);
return 1;
}
return 0;
}
forward AFK();
public AFK()
{ for(new i = 0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i,Float:vlol[0],Float:vlol[1],Float:vlol[2]);
if(Float:lol[0] == Float:vlol[0])if(Float:lol[1] == Float:vlol[1])if(Float:lol[2] == Float:vlol[2])
{
new pName[MAX_PLAYER_NAME];
new string[48];
GetPlayerName(i, pName, sizeof(pName));
format(string, sizeof(string), "( ! ) You are now in AFK mode");
SetPlayerVirtualWorld(i,1);
SendClientMessage(i, COLOR_GREY, string);
GameTextForPlayer(i,"~w~AFK Mode",2000,3);
format(string, sizeof(string), "( ! ) %s is now in AFK mode", pName);
SendPlayerMessageToAll(COLOR_GREY, string);
TogglePlayerControllable(i,0);
SendClientMessage(i, COLOR_WHITE,"( ! ) Type /back to go into game");
return 1;
}
else
{
SendClientMessage(i,c_r,"( ! ) Going in afk mode was cancel reason: You moved !");
}
}
return 0;
}
what I forgot write? help plz !!!