a tp command help
#1

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.
Reply
#2

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

is something wrong with this code??
Reply
#4

can anyone help ??
Reply
#5

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");

Reply
#6

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
Reply
#7

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
Reply
#8

Alright. Thanks mayn
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)