SA-MP Forums Archive
a tp command help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: a tp command help (/showthread.php?tid=386330)



a tp command help - Virus. - 20.10.2012

Hello guys. I am making a script where an admin can tp other players to his position.

http://pastebin.com/b0YxjUQC - this is my script.

It doesnt work. I dont get any errors but the player spawns to blueberry and the looping thig doesnt work either.

Thanks.


Re: a tp command help - MrCoder - 20.10.2012

For a start, I suggest switching to a different command processor, such as ZCMD Or Y_CMD.


Re: a tp command help - Virus. - 20.10.2012

is something wrong with this code??


Re: a tp command help - Virus. - 20.10.2012

can anyone help ??


Re: a tp command help - Gamer_007 - 20.10.2012

Try this one.This is make nwith ZCMD
PHP код:
CMD:get(playerid,params[])
{
    if(
PInfo[playerid][Level] >= 3)
    {
        new 
ID;
          new 
string[256];
          if(
sscanf(params,"u",ID)) return SendClientMessage(playerid,red"USAGE: /get <playerid>");
        if(!
IsPlayerConnected(ID) ) return SendClientMessage(playerid,red,"[ERROR]: Player Is Not Connected");
        if(
ID == playerid)return SendClientMessage(playerid,red,"[ERROR]:You Cannot Teleport YourSelf To Yourself");
        new 
Float:xFloat:yFloat:z;    GetPlayerPos(playerid,x,y,z);
        
SetPlayerInterior(ID,GetPlayerInterior(playerid));
        
SetPlayerVirtualWorld(ID,GetPlayerVirtualWorld(playerid));
        if(
GetPlayerState(ID) == 2)
        {
        
SetVehiclePos(GetPlayerVehicleID(ID),x+3,y,z);
        
LinkVehicleToInterior(GetPlayerVehicleID(ID),GetPlayerInterior(playerid));
        
SetVehicleVirtualWorld(GetPlayerVehicleID(ID),GetPlayerVirtualWorld(playerid));
        }
        else 
SetPlayerPos(ID,x+2,y,z);
        
format(string,sizeof(string),"[TELEPORT]:You have Teleported \"%s\" To Your Position."pName(ID));
        return 
SendClientMessage(playerid,BlueMsg,string);
    }
    else return 
SendClientMessage(playerid,red,"[ERROR]: You Are Not Level  or more admin to use this command");




Re: a tp command help - Virus. - 20.10.2012

PHP код:

        
if(GetPlayerState(ID) == 2)
        {
        
SetVehiclePos(GetPlayerVehicleID(ID),x+3,y,z);
        
LinkVehicleToInterior(GetPlayerVehicleID(ID),GetPlayerInterior(playerid));
        
SetVehicleVirtualWorld(GetPlayerVehicleID(ID),GetPlayerVirtualWorld(playerid));
        }
        

Can u plzz explain this


Re: a tp command help - [HK]Ryder[AN] - 20.10.2012

Quote:
Originally Posted by Virus.
Посмотреть сообщение
PHP код:

        
if(GetPlayerState(ID) == 2)
        {
        
SetVehiclePos(GetPlayerVehicleID(ID),x+3,y,z);
        
LinkVehicleToInterior(GetPlayerVehicleID(ID),GetPlayerInterior(playerid));
        
SetVehicleVirtualWorld(GetPlayerVehicleID(ID),GetPlayerVirtualWorld(playerid));
        }
        

Can u plzz explain this
It is nice to know someone wants to understand the code instead of copying-pasting it.
the GetPlayerState code determines the state of the player. you can know the different player states over here - https://sampwiki.blast.hk/wiki/Playerstates

So according to the code, if the player is a driver, we set the vehicles position(SetVehiclePos) to the x,y,z position.
the getplayervehicleid is used to tell which vehicleid to teleport..just like in setplayerpos we define playerid
linkvehicletointerior puts a vehicle in an interior.
SetVehicleVirtualWorld sets the vehicle's virtual world to the one provided.
Hope you understood


Re: a tp command help - Virus. - 20.10.2012

Alright. Thanks mayn