What is not correct about this? Help.
#1

I am learning to use dcmd to create teleports, but why doesnt this code work properly?

PHP код:
dcmd_drift1(playeridparams[])
{
    
#pragma unused params
    
SetPlayerInterior(playerid,0);
    if(
GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
    {
        
SendClientMessage(playerid,COLOR_RED,"You must be the driver to teleport this vehicle!");
     }
     else
    {
         if(
GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        {
            
SetVehiclePos(playerid,-355.2756,1529.9248,75.3594);
        }
         else
          {
              
SetPlayerPos(playerid,-355.2756,1529.9248,75.3594);
        }
    }
    return 
1;

as you can see, I want persons to be teleported to big ear drift when they write /drift1. IF a player is in any vehicle he will be teleported, and also if a player is on foot (I will change the coords later so that if player is on foot he will be teleported else where). AND IF a player is as a passenger in someones car, he can not teleport the vehicle.

But for some reason, the teleporting for persons IN VEHICLES does not work. Help please.

Thanks in advance.
Reply
#2

Quote:

if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
SetVehiclePos(playerid,-355.2756,1529.9248,75.3594);
}
else
{
SetPlayerPos(playerid,-355.2756,1529.9248,75.3594);
}

Its should be vehicleid, not playerid

ClickMe
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)