Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new AFK[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- AFK[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText(playerid,cmdtext[])
- }
- if(strcmp(cmdtext,"/back",true) == 0)
- {
- if(AFK[playerid] == 0) return SendClientMessage(playerid,-1,"You are not AFK"); //verify if the player is afk if is not will send a message
- else
- {
- AFK[playerid] = 0;// set AFK as off. for player..
- new name[MAX_PLAYER_NAME], string[256]; // create variable for player called name and string for message and more..
- GetPlayerName(playerid,name,sizeof(name)); // now setting NAme as the name of the player
- format(string,sizeof(string), "%s",name);
- SetPlayerName(playerid,string); // set the name to his/hi normal name
- SetPlayerColor(playerid,-1); // set the color of the player to white
- SetPlayerWeather(playerid,-2); // setting the weather to 2 for nice weather
- TogglePlayerControllable(playerid,1); //unfreeze the player
- }
- return 1;
- }
- if(strcmp(cmdtext, "/afk", true) == 0)
- {
- if(AFK[playerid] == 1) return SendClientMessage(playerid,-1,"You are already AFK"); //verify if the player is afk if is will send a message
- AFK[playerid] = 1;// set AFK as on. for player..
- new name[MAX_PLAYER_NAME], string[256]; // create variable for player called name and string for message and more..
- GetPlayerName(playerid,name,sizeof(name)); // now setting NAme as the name of the player
- format(string,sizeof(string), "[AFK]%s",name);
- SetPlayerName(playerid,string); // set the name with AFK when he type /afk
- SetPlayerColor(playerid,-1); // set the color of the player to white
- SetPlayerWeather(playerid,-1); // setting the weather to -1 to create a real AFK effect
- TogglePlayerControllable(playerid,0); //frezeze the player
- }
- if(strcmp(cmdtext,"/afklist",true) == 0)
- {
- for(new i = 0; i != MAX_PLAYERS; i++)
- {
- new name[MAX_PLAYER_NAME], string[256];
- GetPlayerName(i,name,sizeof(name));
- format(string,sizeof(string),"AFK Set Player : %s (id : %i)",name,playerid);
- }
- SendClientMessage(playerid,-1,string);
- return 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment