SA-MP Forums Archive
[Help]Can't create vehicle - 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: [Help]Can't create vehicle (/showthread.php?tid=102810)



[Help]Can't create vehicle - SHADOW785 - 17.10.2009

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.


Re: [Help]Can't create vehicle - Beaver07 - 17.10.2009

AddStaticVehicle


Re: [Help]Can't create vehicle - SHADOW785 - 17.10.2009

i have this problem since samp 0.3


Re: [Help]Can't create vehicle - dice7 - 17.10.2009

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);



Re: [Help]Can't create vehicle - SHADOW785 - 17.10.2009

didn't work, the vehicle does not appear


Re: [Help]Can't create vehicle - dice7 - 17.10.2009

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



Re: [Help]Can't create vehicle - SHADOW785 - 17.10.2009

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


Re: [Help]Can't create vehicle - Peter_Corneile - 17.10.2009

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);



Re: [Help]Can't create vehicle - SHADOW785 - 17.10.2009

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


Re: [Help]Can't create vehicle - Peter_Corneile - 17.10.2009

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


Re: [Help]Can't create vehicle - SHADOW785 - 17.10.2009

GetPlayerPos(playerid, x, y, z);

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


Re: [Help]Can't create vehicle - Correlli - 17.10.2009

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.


Re: [Help]Can't create vehicle - Peter_Corneile - 17.10.2009

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


Re: [Help]Can't create vehicle - SHADOW785 - 17.10.2009

so any ideas ? maybe a bug in samp 0.3 ?


Re: [Help]Can't create vehicle - JernejL - 17.10.2009

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!



Re: [Help]Can't create vehicle - SHADOW785 - 18.10.2009

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


Re: [Help]Can't create vehicle - Pghpunkid - 18.10.2009

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