[pawn]
new nogoto[MAX_PLAYERS]
public OnPlayerCommandText(playerid, cmdtext[])
{
new tmp[256];
if (strcmp("nogoto", cmd, true, 10) == 0)
{
tmp = strtok(cmdtext, idx);
if(nogoto[playerid] == 0)
{
nogoto[playerid] = 1;
SendClientMessage(playerid, red, "You are no longer accepting goto warps.");
}
else
{
nogoto[playerid] = 0;
SendClientMessage(playerid, lgr, "You are now accepting goto warps.");
}
return 1;
}
if (strcmp("goto", cmd, true, 10) == 0)
{
tmp = strtok( cmdtext, idx );
if (!strlen(tmp))
{
SendClientMessage(playerid, lgr, " /c goto [ID]");
return true;
}
new ID = strval(tmp);
if(nogoto[playerid] == 1) return SendClientMessage(playerid, red, "Sorry that player has goto disabled");
if (!IsPlayerConnected(ID))
{
SendClientMessage(playerid, 0xFFFFFFAA, " Invalid Player");
format( tmp, 128, "%s > Error < that > Player < isn't in the data base", Name[playerid]), SendClientMessage(playerid, red, tmp);
return true;
}
new Float:X, Float:Y, Float:Z;
if ( GetPlayerVehicleID( playerid ) )
{
GetPlayerPos( strval(tmp), X, Y, Z );
SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z ,0);
GetPlayerName(ID, tmp, 128);
format(tmp, 128, "Teleported to (Player - %s, id - %d)", tmp, ID);
SendClientMessage(playerid, 0xFFFFFFAA, tmp);
format( tmp, 128, "Teleport to > %s < ID > %d <", tmp, ID), SendClientMessage(playerid, red, tmp);
}else{
GetPlayerPos( strval(tmp), X, Y, Z );
SetPlayerPos( playerid, X+2, Y+2, Z ,0 ,0);
GetPlayerName(ID, tmp, 128);
format( tmp, 128, "Teleport to > %s < ID > %d <", tmp, ID), SendClientMessage(playerid, red, tmp);
}
return 1;
}
}
[/pawn]