27.10.2011, 17:13
HI all need your help once again i have a problem with my /goto cmd. Soon as you try to tp to someone whos id is over id 3 it just tps you to id 3 so if i did /goto 4 im tped to id3 any ideas.
Many Thanks.
Many Thanks.
Code:
CMD:goto(playerid, params[])
{
new string[256];
if ( sscanf( params, "u", params[ 0 ]) )return SendClientMessage(playerid, COLOR_ORANGE, "You can use /pgoto <on/off> to disable enable people to come to you"),SendUsage( playerid, "/goto <id>" );
if (P_DATA[ params[ 0 ] ][ P_Goto ] == 0 && P_DATA[ playerid ][ P_Level ] < 1 )return format(string,sizeof( string ), "ERROR: %s has the goto turned off.", PlayerName2( params[ 0 ])),SendClientMessage(playerid, COLOR_RED, string );
if( params[ 0 ] == playerid )return SendError( playerid, "You cannot teleport to yourself!");
new Float:ParamX, Float:ParamY, Float:ParamZ;
GetPlayerPos( params[ 0 ], Float:ParamX, Float:ParamY, Float:ParamZ);
SetCameraBehindPlayer( playerid );
SetPlayerInterior( playerid, GetPlayerInterior( params[ 0 ] ));
SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( params[ 0 ] ) );
if(GetPlayerState(playerid) == 2){
SetVehiclePos( GetPlayerVehicleID( playerid ), ParamX+2, ParamY, ParamZ );
LinkVehicleToInterior( GetPlayerVehicleID( playerid ), GetPlayerInterior( params[ 0 ] ));
SetVehicleVirtualWorld( GetPlayerVehicleID( playerid ) , GetPlayerVirtualWorld( params[ 0 ] ));
} else {
SetPlayerPos( playerid, ParamX+2, ParamY, ParamZ );
}
FormMessageForAllEx(playerid && params[ 0 ],COLOR_GREEN, "%s teleported to %s!",PlayerName2( playerid ), PlayerName2( params[ 0 ] ));
FormMessage( params[ 0 ], COLOR_GREEN, "%s teleported to you!",PlayerName2( playerid ) );
FormMessage( playerid, COLOR_GREEN, "You teleported to %s!",PlayerName2( params[ 0 ] ) );
return 1;
}


