Posts: 3,004
Threads: 12
Joined: May 2011
Quote:
Originally Posted by rangerxxll
If I wanted to make a system where a player types /afk and gets teleported to a location, and cant move until he types /back (Also I want him to have unlimited health untill he types /back) Where would I start exactly? I currently have this.
pawn Код:
COMMAND:afk(playerid, cmdtext) { if(afk[playerid] == 1) return SendClientMessage(playerid, blue, "You are already AFK!"); { SetPlayerPos(playerid, 620.1089,892.7344,-37.1285); SendClientMessage(playerid, blue, "You are now AFK type /back to come back"); } return 1; }
What else do I need to do?
|
pawn Код:
// Somewhere in your script
new oldHealth;
new oldArmour;
new Float:X,Float:Y,Float:Z,Float:Angle;
new Timer;
forward UH&A(playerid);
COMMAND:afk(playerid, cmdtext)
{
if(afk[playerid] == 1) return SendClientMessage(playerid, blue, "You are already AFK!");
{
Timer = SetTimer("UH&A", 500, 1);
GetPlayerHealth(playerid, oldHealth); // Get player old Armour
GetPlayerArmour(playerid, oldArmour); // Get player old Health
GetPlayerPos(playerid, X, Y, Z); // Get player old pos
GetPlayerFacingAngle(playerid, Angle); // Get player old angle
SetPlayerHealth(playerid, 999999999); // UNLIMITED ARMOUR!
SetPlayerHealth(playerid, 999999999); // UNLIMITED HEALTH!
SetPlayerPos(playerid, 620.1089,892.7344,-37.1285);
SendClientMessage(playerid, blue, "You are now AFK type /back to come back");
TogglePlayerControllable(playerid, 0); // freezeing the player | thats all :)
}
return 1;
}
COMMAND:back(playerid, cmdtext)
{
if(afk[playerid] == 0) return SendClientMessage(playerid, blue, "You are not AFK!");
{
KillTimer(Timer);
SetPlayerHealth(playerid, oldHealth); // set player old armour
SetPlayerArmour(playerid, oldArmour); // set player old health
SetPlayerPos(playerid, X, Y, Z); // Set player old pos
SetPlayerFacingAngle(playerid, Angle); // Set player old facing angle
SendClientMessage(playerid, blue, "You are now AFK type /back to come back");
TogglePlayerControllable(playerid, 1); // unfreezeing player
}
return 1;
}
public UH&A(playerid)
{
SetPlayerHealth(playerid, 999999999); // UNLIMITED ARMOUR!
SetPlayerHealth(playerid, 999999999); // UNLIMITED HEALTH!
}
Posts: 3,004
Threads: 12
Joined: May 2011
Quote:
Originally Posted by rangerxxll
Now how would I make it so no one can kill the player that has been teleported?
|
check again
Posts: 164
Threads: 26
Joined: Aug 2010
Reputation:
0
@xkirill Better use mine, You forgot the [MAX_PLAYERS].
Example:
When player 1 types /afk.
His pos + health + armor get saved.
When player 2 types /afk.
His pos + health + armor get saved.
When player 1 types /back.
He got the armor, pos, health of player 2.
@kikito You are repos his location? wtf ;p
Posts: 3,004
Threads: 12
Joined: May 2011
Quote:
Originally Posted by wouter0100
@xkirill Better use mine, You forgot the [MAX_PLAYERS].
Example:
When player 1 types /afk.
His pos + health + armor get saved.
When player 2 types /afk.
His pos + health + armor get saved.
When player 1 types /back.
He got the armor, pos, health of player 2.
@kikito You are repos his location? wtf ;p
|
oh...
thanks for the info
btw i have 666 posts >.<