11.05.2013, 07:48
INDRODUCTION
In this tutorial we will learn about how to make a AFK system
STEP 1
Include a_samp which is important for every FS
STEP 2
Make a command for afk
STEP 3
Make a command in which player back from AFK
In this tutorial we will learn about how to make a AFK system
STEP 1
Include a_samp which is important for every FS
PHP Code:
#include a_samp
Make a command for afk
PHP Code:
public OnPlayerCommandText(playerid,cmdtext[])
{
if (strcmp("//The command you like in which player go AFK", cmdtext, true, 10) == 0)
{
new Float:health; //make a new variable which will use in health
GetPlayerHealth(playerid,health);//health of player which is important or players cheat in health
if( health > 100 )//player health is more than 100
{
TogglePlayerControllable(playerid, 0);//Setting player controllable to 0 to disable controlles of player
SetPlayerHealth(playerid, 99999);//If you set players health less the player can die
//There you can do anything like send message to all or him
return 1;
}
if( health < 100 )//player health is less than 100
{
SendClientMessage(playerid, //The color you like comment end\\,"You haven't enough health");
return 1;
}
return 1;
}
return 1;
Make a command in which player back from AFK
PHP Code:
if (strcmp("//The command you like", cmdtext, true, 10) == 0)
{
TogglePlayerControllable(playerid, 1);//1 means Player's controll enable
//You can add anything like message to all or him
return 1;
}
return 0;
}