24.10.2011, 14:38
pawn Код:
if ( strcmp( cmd, "/goto", true ) == 0 ) {
new tmp[32];
tmp = strtok( cmdtext, idx );
if ( !strlen( tmp ) ) { return SendClientMessage(playerid, 0xFF0000AA, "/Goto [playerid]"); }
new pID = strval(tmp);
else if( pID == INVALID_PLAYER_ID || !IsPlayerConnected( pID ) ) return SendClientMessage( playerid, COLOR_RED, "Player is not connected!" );
else if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cannot goto yourself");
else if(AllowGoto[pID] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player has prevent teleporting to them");
else {
new Float:X, Float:Y, Float:Z, Pname[24];
GetPlayerPos( strval(tmp), X, Y, Z );
ResetPlayerWeapons(playerid);
if (GetPlayerState(playerid)==PLAYER_STATE_DRIVER)SetVehiclePos( GetPlayerVehicleID(playerid), X+2, Y+2, Z );
else SetPlayerPos( playerid, X+2, Y+2, Z );
new String[56];
GetPlayerName(strval(tmp), Pname, sizeof(Pname));
format(String, sizeof(String), "{FF9600}You teleported to %s.", Pname, strval(tmp));
SendClientMessage(playerid, COLOR_ORANGE, String);
GetPlayerName(playerid, Pname, sizeof(Pname));
format(String, sizeof(String), "{FF9600}%s has teleported to your location, type /tgoto to disable this in the future!", Pname, playerid);
SendClientMessage(strval(tmp), COLOR_ORANGE, String);
}
return 1;
}