PutPlayerInVehicle - Doesn't Works
#1

Hello,

I Have this command :-

pawn Код:
CMD:joinderby(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid,x,y,z);
    new vehicle = CreateVehicle(411, x, y, z, 90, 0, 1, 60);
    PutPlayerInVehicle(playerid,vehicle,0);
    InDerby[playerid] = 1;
    return 1;
}
When i uses it, It doesn't spawn me Infernus(411 is Infernus)
If anyone can Help me, I Would be thank full of him.
Reply
#2

Cos your cords are x,y,z , go in game, go to the place where you want the infernus write /save>go to Documents>SAMP>saved pos>Get the pos and replace it.

If i helped+rep please
Reply
#3

Quote:
Originally Posted by bustern
Посмотреть сообщение
Cos your cords are x,y,z , go in game, go to the place where you want the infernus write /save>go to Documents>SAMP>saved pos>Get the pos and replace it.

If i helped+rep please
What a N**B You are.
X,Y,Z there are used to get player's current Position.
And you want rep? LOL.
Reply
#4

Try changing to:

pawn Код:
CMD:joinderby(playerid, params[])
{
    new Float:x, Float:y, Float:z, vehicle;
    GetPlayerPos(playerid,x,y,z);
    prtinf("Creating vehicle...");
    vehicle = CreateVehicle(411, x, y, z, 90, 0, 1, 60);
    printf("The vehicle has been created");
    PutPlayerInVehicle(playerid,vehicle,0);
    printf("Player putted in vehicle");
    InDerby[playerid] = 1;
    return 1;
}
And then tell me if anything will be pasted in your console or if it will either work
Reply
#5

Quote:

[22:33:26] [join] Avi has joined the server (0:127.0.0.1)
[22:33:48] Creating vehicle...
[22:33:48] The vehicle has been created
[22:33:48] Player putted in vehicle

But In-Game, Player is not in Vehicle.
Reply
#6

Does it spawn an vehicle at all?
Reply
#7

The command is fine, I guess CreateVehicle returns INVALID_VEHICLE_ID. You can make sure by debugging it:
pawn Код:
CMD:joinderby(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid,x,y,z);
    new vehicle = CreateVehicle(411, x, y, z, 90, 0, 1, 60);
    printf("vehicleid: %d", vehicle);
    PutPlayerInVehicle(playerid,vehicle,0);
    InDerby[playerid] = 1;
    return 1;
}
What does it print to the console after using the command?
Reply
#8

I got what's problem.
My players world ID was not same of vehicle ID.
Btw, thanks for helping.
Reply
#9

Ah, you could use the 'GetPlayerWorld(playerid)' at the end of the CreateVehicle next time or wherever so you wont have problems. Glad to help you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)