26.06.2012, 08:35
(
Last edited by XStormiest; 26/06/2012 at 10:19 AM.
)
Hello World I'm new on scripting so i don't know very good how to script
But I had learned how to make a AFK system so ...i will learn you how to make this
First: we create a variable: and add it in top of scripts!
This will help us to see if player is afk or if isn't.
now go to public OnPlayerConnect , if you don't know where PRESS ctrl + f and write OnPlayerConnect in the box
after you find it, type next functions between
Now we gonna make 3 commands, /afk, /back, /afklist if you use zcmd, or foreach wil be more easily to do it
now go to OnPlayerCommandText(playerid,cmdtext[])
and write next between {
}
we create first the /afk command
/brb cmd
now create the /afklist cmd
Now i hope this had helped you
I'm not a crazy rep + man so if you want to rep or not is
If i did some mistake just comment
Above is the link for script
http://pastebin.com/BSUqzhG0
But I had learned how to make a AFK system so ...i will learn you how to make this
First: we create a variable: and add it in top of scripts!
Code:
new AFK[MAX_PLAYERS];
now go to public OnPlayerConnect , if you don't know where PRESS ctrl + f and write OnPlayerConnect in the box
after you find it, type next functions between
Code:
{
AFK[playerid] = 0;
return 1;
}
now go to OnPlayerCommandText(playerid,cmdtext[])
and write next between {
}
we create first the /afk command
Code:
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
}
Code:
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;
}
Code:
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;
}
I'm not a crazy rep + man so if you want to rep or not is
If i did some mistake just comment
Above is the link for script
http://pastebin.com/BSUqzhG0



, and for the tutorial, it's not organized, not explained ( specialy the loop), or with other words this is copy / paste tutorial you don't learn nothing