SA-MP Forums Archive
[Tutorial] How to make an AFK system [TEXT] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to make an AFK system [TEXT] (/showthread.php?tid=195705)



How to make an AFK system [TEXT] - BigAl - 03.12.2010

This is my tutorial on how to make a AFK system.

First of all we have to make the DEFINES... the color.
Code:
#define COLOR_BLUE 0x33CCFFAA
The command.
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/afk", true) == 0)
{
new pName[MAX_PLAYER_NAME]; // Saying pName is the Players Name!
new string[128]; // Creating the string.
GetPlayerName(playerid,pName,MAX_PLAYER_NAME); // tells the pName to get the players name!
format(string, sizeof(string), "--> %s is now AFK",pName); // This is what will send to everyone!
SendClientMessageToAll(COLOR_BLUE, string); // This is what makes the "string" send in the "COLOR_BLUE"!
TogglePlayerControllable(playerid, 0); // Makes it so the player cannot move.
SetPlayerHealth(playerid, 999999.999); // Sets the players health so he is invincible! So noone can kill him.
return 1;
}
return 0;
}
The /back command. (Similar)
Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/back", true) == 0)
{
new pName[MAX_PLAYER_NAME]; // Saying pName is the Players Name!
new string[128]; // Creating the string.
GetPlayerName(playerid,pName,MAX_PLAYER_NAME); // tells the pName to get the players name!
format(string, sizeof(string), "--> %s is now BACK",pName); // This is what will send to everyone!
SendClientMessageToAll(COLOR_BLUE, string); // This is what makes the "string" send in the "COLOR_BLUE"!
TogglePlayerControllable(playerid, 1); // Makes it so the player can move.
SetPlayerHealth(playerid, 100); // Sets the players health back to normal. He is now killable.
return 1;
}
There you go... as i promised a viewer.

Thanks for it! Hope this helped.


Please subscribe to my ******* channel. www.*******.com/g2xtuts

Thread with COMMENTATED video: https://sampforum.blast.hk/showthread.php?tid=195701

Thankyou!!!


Re: How to make an AFK system [TEXT] - black_dota - 03.12.2010

thanks for tut


Re: How to make an AFK system [TEXT] - Jacob_Venturas - 03.12.2010

This isn't a tutorial, this is just copying and pasting. A tutorial teaches people, step by step.


Re: How to make an AFK system [TEXT] - scripter1 - 03.12.2010

Quote:
Originally Posted by Jacob_Venturas
View Post
This isn't a tutorial, this is just copying and pasting. A tutorial teaches people, step by step.
He did mention what each line did... so technically he did teach you step by step.


Re: How to make an AFK system [TEXT] - BigAl - 04.12.2010

Yeh i did mention what every line in the tutorial did.

@Black_Dota Thanks pal.


Re: How to make an AFK system [TEXT] - Ehab1911 - 04.12.2010

... That's my AFK System .. OMG. Put my Credits at least. https://sampforum.blast.hk/showthread.php?tid=191984


Re: How to make an AFK system [TEXT] - Jantjuh - 04.12.2010

thankx!!!!



Re: How to make an AFK system [TEXT] - BigAl - 05.12.2010

its alright


Re: How to make an AFK system [TEXT] - NoahF - 09.08.2013

Nice job taking my script and using it as a tut. Could have atleast given me credit.


Re: How to make an AFK system [TEXT] - Smokeyy - 10.08.2013

This can be abused. If you have the /freeze and /unfreeze command when the player is /afk he can take /unfreeze from an admin and he is invincible