[Tutorial] How to make AFK system
#1

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
PHP Code:
#include a_samp 
STEP 2
Make a command for afk
PHP Code:
public OnPlayerCommandText(playerid,cmdtext[])
{
    if (
strcmp("//The command you like in which player go AFK"cmdtexttrue10) == 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(playerid0);//Setting player controllable to 0 to disable controlles of player
            
SetPlayerHealth(playerid99999);//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
STEP 3
Make a command in which player back from AFK
PHP Code:
    if (strcmp("//The command you like"cmdtexttrue10) == 0)
    {
        
TogglePlayerControllable(playerid1);//1 means Player's controll enable
        //You can add anything like message to all or him
        
return 1;
    }
    return 
0;

Reply


Messages In This Thread
How to make AFK system - by BlackHorse - 11.05.2013, 07:48
Re: How to make AFK system - by Giroud12 - 11.05.2013, 08:28
Re : Re: How to make AFK system - by Rayan_black - 11.05.2013, 09:43
Re: How to make AFK system - by Rimmon - 14.05.2013, 16:05
AW: How to make AFK system - by Blackazur - 14.05.2013, 16:08
Re: How to make AFK system - by Scenario - 14.05.2013, 16:38
Re : Re: How to make AFK system - by Rayan_black - 14.05.2013, 16:54
Re: AW: How to make AFK system - by Rimmon - 15.05.2013, 11:23

Forum Jump:


Users browsing this thread: 2 Guest(s)