Set player vehicle on teleport
#1

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

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

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;
}
Reply
#4

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;
    }
Reply
#5

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;
    }
Reply
#6

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)