SA-MP Forums Archive
PAWNO scripting: Teleport with Cars? - 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: PAWNO scripting: Teleport with Cars? (/showthread.php?tid=455917)



PAWNO scripting: Teleport with Cars? - nabeelfarooqui98 - 03.08.2013

ok, so I know that this should be possible without too much trouble.
I have started coding just a few days ago, currently I'm making a gamemode (freeroam, gonna use it on LAN)

Now my question:

I have made a command called '/mod1' which teleports the player to a modding garage, there are several modable vehicles parked there for you to easily pick one. Then the player modifies it. That all goes perfectly.

Then another command is '/race' which teleports the player to a 'race track' (a highway).

What happens is that when the player types /race then only he is teleported to the race track and not his car, even tough he is in it.

Now I did find a method online (never tried it), which basically checked which car the player was in before teleporting and then spawns the car at the 'race track'.

But I dont want to spawn an identical car, but the same car. I know that this is possible as I have modified and teleported along with cars in this server


Sorry if this has been asked already, i couldnt find what i was looking for.


Re : PAWNO scripting: Teleport with Cars? - Garwan50 - 03.08.2013

Make
pawn Код:
if(!playerisinanyvehicle(playerid))
//code for teleporting the player
else
{
 // take the car coordinate (and not player's coordinate), and PutPlayerInVehicle (vehicleid)
}
Or something like this


Re: PAWNO scripting: Teleport with Cars? - nabeelfarooqui98 - 03.08.2013

um.....

i dont get it. heres what im using:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/mod1", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, 2645.0203,-2016.9821,13.5533);
        SendClientMessage(playerid,COLOR_GREEN,"INFO: Reached the Loco Co Garage!");
        return 1;
    }
   

   
    if (strcmp("/race", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, 1455.4469,-952.3265,36.1328);
        SendClientMessage(playerid,COLOR_PURPLE,"INFO: Get to the starting position!");
        return 1;
    }
   

    return 0;
}


Could you expand or explain your method a little more?


Re: PAWNO scripting: Teleport with Cars? - arjanforgames - 03.08.2013

Put this under /mod1
pawn Код:
{
       new vehid = GetPlayerVehicleID(playerid) ;
       SetVehiclePos(vehid, //your coords);
       SetPlayerPos(playerid, //your coords) ;
       PutPlayerInVehicle(playerid, vehid, 0);
       // and your SendClientMessage
}