04.08.2014, 10:29
pawn Код:
new bool:Goto_Disabled[MAX_PLAYERS];
public OnPlayerDisconnect(playerid, reason)
{
Goto_Disabled[playerid] = false;
return 1;
}
CMD:goto(playerid, params[])
{
if (sscanf(params, "u", id))
return SendClientMessage(playerid, -1, "Usage: /goto [id/name]");
if (!IsPlayerConnected(id))
return SendClientMessage(playerid, -1, "Error: Player is not connected.");
if (Goto_Disabled[playerid] == true)
return SendClientMessage(playerid, -1, "Error: Player does not want anyone to teleport to him.");
new Float:x, Float:y, Float:z;
GetPlayerPos(id, x, y, z);
SetPlayerInterior(playerid, GetPlayerInterior(id));
SetPlayerPos(playerid, x, y, z);
return 1;
}
CMD:nogoto(playerid, params[])
{
if (Goto_Disabled[playerid] == false)
{
SendClientMessage(playerid, -1, "Players are now unable to teleport to you.");
Goto_Disabled[playerid] = true;
}
else if (Goto_Disabled[playerid] == true)
{
SendClientMessage(playerid, -1, "Players are now able to teleport to you.");
Goto_Disabled[playerid] = false;
}
return 1;
}