[Help]Can't create vehicle
#1

I want to create a vehicle and put the player in it.

Here is a code:

Код:
...........
new carid;
new Float:x = 0.0, Float:y = 0.0, Float:z = 0.0, Float:a = 0.0;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
SendClientMessage(playerid,COLOR_YELLOW,"bla bla bla");
carid = CreateVehicle(vid, x, y, z, a, 0, 0, 0);
PutPlayerInVehicle(playerid,carid,0);
...........
But nothing happens, the vehicle does not create.
Please help me.
Reply
#2

AddStaticVehicle
Reply
#3

i have this problem since samp 0.3
Reply
#4

AddStaticVehicle only works under OnGameModeInit and it doesn't return the car id

Is your vehicle id valid ?
Try with this
pawn Код:
carid = CreateVehicle(411, x, y, z, a, -1, -1, -1);
Reply
#5

didn't work, the vehicle does not appear
Reply
#6

Try adding
pawn Код:
SetVehicleVirtualWorld(carid, GetPlayerVirtualWorld(playerid));
LinkVehicleToInterior(carid, GetPlayerInterior(playerid));
Reply
#7

also didn't work. did anyone have the same problem ?
Reply
#8

pawn Код:
new carid;
new Float:x,Float:y,Float:z,Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
SendClientMessage(playerid,COLOR_YELLOW,"bla bla bla");
carid = CreateVehicle(vid, x, y, z, a, 0, 0, 0);
PutPlayerInVehicle(playerid,carid,0);
Reply
#9

►Peter Corneile◄ [hugu-hosting.co.uk], how your code differs from mine ? didn't work
Reply
#10

you had defined
pawn Код:
new Float:x = 0.00 .......
This will set the float to 0.00 .. Then the vehicle must spawn at the coord 0.00
Reply
#11

GetPlayerPos(playerid, x, y, z);

here is a code that changes x, y ,z. vehicle must spawn on my coords.
Reply
#12

Quote:
Originally Posted by ►Peter Corneile◄ [hugu-hosting.co.uk
]
you had defined
pawn Код:
new Float:x = 0.00 .......
This will set the float to 0.00 .. Then the vehicle must spawn at the coord 0.00
He did yes, but he was using GetPlayerPos and that stored the new values to x, y, and z floats.
Remember if you do this:
pawn Код:
new Float:x;
it will be 0.0 by default.
Reply
#13

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by ►Peter Corneile◄ [hugu-hosting.co.uk
]
you had defined
pawn Код:
new Float:x = 0.00 .......
This will set the float to 0.00 .. Then the vehicle must spawn at the coord 0.00
He did yes, but he was using GetPlayerPos and that stored the new values to x, y, and z floats.
Remember if you do this:
pawn Код:
new Float:x;
it will be 0.0 by default.
Well idk why this is not actually working but i used the code that i sent in my 0.2 server and it was working just fine
Reply
#14

so any ideas ? maybe a bug in samp 0.3 ?
Reply
#15

Quote:
Originally Posted by SHADOW785
so any ideas ? maybe a bug in samp 0.3 ?
You are very fast to blame.. maybe it's a bug in your code!
Reply
#16

I have no bugs in my code because in samp 0.2x my gamemode worked perfectly
Reply
#17

I know there is new streaming features, maybe Stream the vehicle in?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)