[Tutorial] how to make a afk system
#1

Hi all, today i posted this to show to the newbie people how to make a afk system on zcmd

See all steps to make a afk system

PHP Code:
COMMAND:afk(playeridparams[])
{
  
//do something there

Ok we have already started the code,now let's gonna make the the afk system teleport to another virtual world.
This command will put the player on ls air after /back...i don't know very well how to take the cords on afk before teleport for put the player on the same position after /back

PHP Code:
COMMAND:afk(playeridparams[])
{
    if (
APlayerData[playerid][LoggedIn] == true)
    {
        
SendClientMessage(playerid0x00FF00"You are afk, when you come back, do /back");
        
TogglePlayerControllable(playerid,0);
        
SetPlayerVirtualWorld(playerid10);
        
SetPlayerPos(playeridxyx);
        new 
string3[70];
        new 
name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
 
        
format(string3sizeof(string3), "%s is now Away from the keyboard!"name);
        
SendClientMessageToAll(0x00FF00string3);
    }
    return 
1;

Now let's gonna make the /back command

PHP Code:
COMMAND:back(playeridparams[])
{
    if (
APlayerData[playerid][LoggedIn] == true)
    {
        
SendClientMessage(playerid0x00FF00"Welcome Back!!");
        
TogglePlayerControllable(playerid,1);
        
SetPlayerVirtualWorld(playerid0);
        
SetPlayerPos(playerid,1683.7488, -2245.979013.0928);
        
SetPlayerFacingAngle(playerid180);
        new 
string3[70];
        new 
name[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnamesizeof(name));
 
        
format(string3sizeof(string3), "%s is back!"name);
        
SendClientMessageToAll(0x00FF00string3);
    }
    return 
1;

On the end,the code need to look like this:

PHP Code:
COMMAND:afk(playeridparams[]) 

    if (
APlayerData[playerid][LoggedIn] == true
    { 
        
SendClientMessage(playerid0x00FF00"You are afk, when you come back, do /back"); 
        
TogglePlayerControllable(playerid,0); 
        
SetPlayerVirtualWorld(playerid10); 
        
SetPlayerPos(playeridxyx); 
        new 
string3[70]; 
        new 
name[MAX_PLAYER_NAME]; 
        
GetPlayerName(playeridnamesizeof(name)); 
  
        
format(string3sizeof(string3), "%s is now Away from the keyboard!"name); 
        
SendClientMessageToAll(0x00FF00string3); 
    } 
    return 
1
}
 
COMMAND:back(playeridparams[]) 

    if (
APlayerData[playerid][LoggedIn] == true
    { 
        
SendClientMessage(playerid0x00FF00"Welcome Back!!"); 
        
TogglePlayerControllable(playerid,1); 
        
SetPlayerVirtualWorld(playerid0); 
        
SetPlayerPos(playerid,1683.7488, -2245.979013.0928); 
        
SetPlayerFacingAngle(playerid180); 
        new 
string3[70]; 
        new 
name[MAX_PLAYER_NAME]; 
        
GetPlayerName(playeridnamesizeof(name)); 
  
        
format(string3sizeof(string3), "%s is back!"name); 
        
SendClientMessageToAll(0x00FF00string3); 
    } 
    return 
1

Reply
#2

mod please /delete post....
Reply
#3

/back makes the Virtual World 10? Shouldn't it set the Virtual World to 0?
Reply
#4

fail..thx
Itґs called BAD COPY PAST -.-
Reply
#5

how do i put it like on my server?
under ongamemodinit?
Reply
#6

nothing explained .... 1/10
Reply
#7

pawn Code:
SetPlayerPos(playerid,1683.7488, -2245.9790, 13.0928);
Why would it set the person to those co-ordinates? Why not just leave them at the position that they were at?

pawn Code:
SetPlayerPos(playerid, x, y, x);
What is the x, y and z? You have not defined them anywhere.

pawn Code:
SetPlayerFacingAngle(playerid, 180);
Why?

pawn Code:
if (APlayerData[playerid][LoggedIn] == true)
Where is this defined in your tutorial?

Please EXPLAIN the tutorial in more depth and do NOT copy sections of scripts from other scripts and say it's a tutorial.
Reply
#8

Quote:
Originally Posted by kikito
View Post
mod please /delete post....
Quote:
Originally Posted by Mr_Scripter
View Post
nothing explained .... 1/10
Quote:
Originally Posted by [HiC]TheKiller
View Post
pawn Code:
SetPlayerPos(playerid,1683.7488, -2245.9790, 13.0928);
Why would it set the person to those co-ordinates? Why not just leave them at the position that they were at?

pawn Code:
SetPlayerPos(playerid, x, y, x);
What is the x, y and z? You have not defined them anywhere.

pawn Code:
SetPlayerFacingAngle(playerid, 180);
Why?

pawn Code:
if (APlayerData[playerid][LoggedIn] == true)
Where is this defined in your tutorial?

Please EXPLAIN the tutorial in more depth and do NOT copy sections of scripts from other scripts and say it's a tutorial.
He wants the thread gone, so stop complaining on what he did wrong. He possibly learned not to copy and paste anymore.
Reply
#9

Quote:

SetPlayerPos(playerid,1683.7488, -2245.9790, 13.092;

Why TP the player ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)