SA-MP Forums Archive
Set player vehicle on teleport - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Set player vehicle on teleport (/showthread.php?tid=224878)



Set player vehicle on teleport - Beginnercoder - 12.02.2011

I have created a teleport command /bikerace and I would like to know how to set it so that if you teleport there you automatically get a sanchez motorbike.


Re: Set player vehicle on teleport - Ash. - 12.02.2011

Could you show us the code for your /bikerace teleport? We need to add to that...


Re: Set player vehicle on teleport - HyperZ - 12.02.2011

Yes post your teleport command, Well i've wrote a example below.
pawn Код:
if (strcmp("/bikerace", cmdtext, true, 10) == 0)
{
    //your teleport code's here.
    new Float:x, Float:y, Float:z, Float:angle;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, angle);
    new vehicleid = CreateVehicle(468, x, y, z, angle, -1, -1, -1);
    PutPlayerInVehicle(playerid, vehicleid, 0);
    return 1;
}



Re: Set player vehicle on teleport - Beginnercoder - 12.02.2011

Quote:
Originally Posted by funky1234
Посмотреть сообщение
Could you show us the code for your /bikerace teleport? We need to add to that...
pawn Код:
if((strcmp("/bikerace", cmdtext, true) == 0) || (strcmp("/bikerace", cmdtext, true) == 0))
    {
        SetPlayerPos(playerid, -1424.9319, -664.5869, 1059.8585);
        SetPlayerInterior(playerid, 4);
        SetPlayerFacingAngle(playerid, 180);
        SendClientMessage(playerid, 0x00FFFFAA, "You've been teleported to Bike Race.");
        return 1;
    }



Re: Set player vehicle on teleport - Shadow™ - 12.02.2011

pawn Код:
if((strcmp("/bikerace", cmdtext, true) == 0) || (strcmp("/bikerace", cmdtext, true) == 0))
    {
        SetPlayerPos(playerid, -1424.9319, -664.5869, 1059.8585);
        SetPlayerInterior(playerid, 4);
        SetPlayerFacingAngle(playerid, 180);
        SendClientMessage(playerid, 0x00FFFFAA, "You've been teleported to Bike Race.");
        new Float:x, Float:y, Float:z, Float:angle;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, angle);
        new vehicleid = CreateVehicle(468, x, y, z, angle, -1, -1, -1);
        LinkVehicleToInterior(vehicleid, 4);
        PutPlayerInVehicle(playerid, vehicleid, 0);
        return 1;
    }



Re: Set player vehicle on teleport - Beginnercoder - 12.02.2011

Ok, I replaced it with this code from above.
pawn Код:
if((strcmp("/bikerace", cmdtext, true) == 0) || (strcmp("/bikerace", cmdtext, true) == 0))
    {
        SetPlayerPos(playerid, -1424.9319, -664.5869, 1059.8585);
        SetPlayerInterior(playerid, 4);
        SetPlayerFacingAngle(playerid, 180);
        SendClientMessage(playerid, 0x00FFFFAA, "You've been teleported to Bike Race.");
        new Float:x, Float:y, Float:z, Float:angle;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, angle);
        new vehicleid = CreateVehicle(468, x, y, z, angle, -1, -1, -1);
        LinkVehicleToInterior(vehicleid, 4);
        PutPlayerInVehicle(playerid, vehicleid, 0);
        return 1;
    }
But in-game when I type /bikerace it doesn't take me the bike track, it just puts me in a empty interior sort of.


Re: Set player vehicle on teleport - Voldemort - 12.02.2011

try
pawn Код:
if((strcmp("/bikerace", cmdtext, true) == 0)))
{
    SetPlayerInterior(playerid,4);
    SendClientMessage(playerid, 0x00FFFFAA, "You've been teleported to Bike Race.");
    new vehicleid = CreateVehicle(468,-1424.93,-664.58,1059.85, 180.0, -1, -1, -1);
    LinkVehicleToInterior(vehicleid,4);
    PutPlayerInVehicle(playerid,vehicleid, 0);
    return 1;
}
but I dont belive that samp can create car and put you in it so quick, because when you create car its need some 10 ms to spawn car at all