[Tutorial] AFK/BACK Simple System. [YSI]
#1

Introduction

I made a simple AFK/BACK system for those who are noob in scripting and i used [YSI] as my saving system so hope you learn something from it and its my first time making a post on forums so hope you enjoy it Thanks.

Tutorial


Step 1:

First of all we need includes which will make the command work.

PHP Code:
/* Includes */
#include <a_samp>
#include <YSI\y_ini>
#include <zcmd> 
Step 2:

Second of all we need variables which we will use in command.

PHP Code:
/* Variables */
new AFKMode[MAX_PLAYERS]; 
Step 3:

Now we need command from which player will go afk and can come back from afk.

PHP Code:
/* Commands */
CMD:afk(playeridparams[])
{
    if (
AFKMode[playerid]) return SendClientMessage(playeridCOLOR_RED"You are already AFK."); //If player is already afk it will send a message to him saying you are already afk.
    
AFKMode[playerid] = 1//This will change the variable to 1.
    
new string[256], pname[MAX_PLAYER_NAME]; //New variables.
    
GetPlayerName(playeridpnamesizeof(string)); //This will get the player name.
    
TogglePlayerControllable(playerid0); //The player will not be able to move.
    
format(stringsizeof(string), "%s is now AFK."pname);
    
SendClientMessageToAll(COLOR_YELLOWstring); //This will send the message to all that the player is afk now.
    
return 1;
}
CMD:back(playeridparams[])
{
    if (!
AFKMode[playerid]) return SendClientMessage(playeridCOLOR_RED"You are not afk."); //If player is not afk it will send a message to him saying you are not afk.
    
AFKMode[playerid] = 0//This will change the variable to 0.
    
new string[256], pname[MAX_PLAYER_NAME]; //New variables.
    
GetPlayerName(playeridpnamesizeof(string)); //This will get the player name.
    
TogglePlayerControllable(playerid1); //The player will be able to move.
    
format(stringsizeof(string), "%s is now back from afk."pname);
    
SendClientMessageToAll(COLOR_YELLOWstring); //This will send the message to all that the player is afk now.
    
return 1;



So this was the tutorial which i made and i know i didn't explain that much good so sorry for that i will make good tutorial's soon so wait for them thanks for checking it out.
Reply


Messages In This Thread
AFK/BACK Simple System. [YSI] - by TheRealMavericK - 02.09.2018, 12:13
Re: AFK/BACK Simple System. [YSI] - by Eoussama - 02.09.2018, 12:54
Re: AFK/BACK Simple System. [YSI] - by CaptainBoi - 03.09.2018, 07:35
Re: AFK/BACK Simple System. [YSI] - by Sanady - 05.09.2018, 16:10
Re: AFK/BACK Simple System. [YSI] - by solstice_ - 05.09.2018, 21:16
Re: AFK/BACK Simple System. [YSI] - by TheRealMavericK - 07.09.2018, 18:03

Forum Jump:


Users browsing this thread: 1 Guest(s)