SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 11/05/2013, 08:48 AM   #1
BlackHorse
Big Clucker
 
BlackHorse's Avatar
 
Join Date: Feb 2013
Location: tunnle of zombies
Posts: 60
Reputation: 4
Default How to make AFK system

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;

BlackHorse is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make Admins Levels and how to make gates system and more Loranzo_De_Andreas Scripting Help 2 22/03/2013 12:56 PM
Make GPS System [HELP] MichaelProPlayer Scripting Help 6 02/06/2012 05:11 AM
How to make a car system like this? Snowman12 Scripting Help 17 08/01/2012 06:51 PM
[Tutorial] How to make an AFK system Cjgogo Tutorials 6 21/10/2011 04:40 PM


All times are GMT. The time now is 06:23 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.