28.08.2011, 17:19
(
Last edited by array13; 28/08/2011 at 06:46 PM.
)
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
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
Now let's gonna make the /back command
On the end,the code need to look like this:
See all steps to make a afk system
PHP Code:
COMMAND:afk(playerid, params[])
{
//do something there
}
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(playerid, params[])
{
if (APlayerData[playerid][LoggedIn] == true)
{
SendClientMessage(playerid, 0x00FF00, "You are afk, when you come back, do /back");
TogglePlayerControllable(playerid,0);
SetPlayerVirtualWorld(playerid, 10);
SetPlayerPos(playerid, x, y, x);
new string3[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string3, sizeof(string3), "%s is now Away from the keyboard!", name);
SendClientMessageToAll(0x00FF00, string3);
}
return 1;
}
PHP Code:
COMMAND:back(playerid, params[])
{
if (APlayerData[playerid][LoggedIn] == true)
{
SendClientMessage(playerid, 0x00FF00, "Welcome Back!!");
TogglePlayerControllable(playerid,1);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerPos(playerid,1683.7488, -2245.9790, 13.0928);
SetPlayerFacingAngle(playerid, 180);
new string3[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string3, sizeof(string3), "%s is back!", name);
SendClientMessageToAll(0x00FF00, string3);
}
return 1;
}
PHP Code:
COMMAND:afk(playerid, params[])
{
if (APlayerData[playerid][LoggedIn] == true)
{
SendClientMessage(playerid, 0x00FF00, "You are afk, when you come back, do /back");
TogglePlayerControllable(playerid,0);
SetPlayerVirtualWorld(playerid, 10);
SetPlayerPos(playerid, x, y, x);
new string3[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string3, sizeof(string3), "%s is now Away from the keyboard!", name);
SendClientMessageToAll(0x00FF00, string3);
}
return 1;
}
COMMAND:back(playerid, params[])
{
if (APlayerData[playerid][LoggedIn] == true)
{
SendClientMessage(playerid, 0x00FF00, "Welcome Back!!");
TogglePlayerControllable(playerid,1);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerPos(playerid,1683.7488, -2245.9790, 13.0928);
SetPlayerFacingAngle(playerid, 180);
new string3[70];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string3, sizeof(string3), "%s is back!", name);
SendClientMessageToAll(0x00FF00, string3);
}
return 1;
}