CreateVehicle problem
#1

So i am trying to make a test thing for vehicles cause i want to check if something there works.
but when i create the vehicle on the player's X,Y,Z it doesn't appear in the player's position.
Here is my code:
pawn Код:
GetPlayerPos(playerid,x,y,z);
    CreateVehicle(pInfo[playerid][pCar1],x,y,z,-1,-1,-1,-1);
Reply
#2

1) How you define x, y, z ?
2) Try to set the Angle 0.0
Reply
#3

PHP код:
new Float:Pos[3];
GetPlayerPos(playerid,Pos[1],Pos[2],Pos[3]);
    
CreateVehicle(pInfo[playerid][pCar1],Pos[2],Pos[1],Pos[3],-1,-1,-1,-1); 
try this.
Reply
#4

#1 I'd like to point out your structure is incorrect

Xeinss posted a method using a popular method (one I personally use) which is what I'd also recommend

any further questions can be answered
Reply
#5

Quote:
Originally Posted by Ari
Посмотреть сообщение
#1 I'd like to point out your structure is incorrect

Xeinss posted a method using a popular method (one I personally use) which is what I'd also recommend

any further questions can be answered
He can also use this way
PHP код:
    GetPlayerPos(playeridx,y,z); GetPlayerFacingAngle(playerida);
    
pInfo[playerid][pCar1] = CreateVehicle(vehx,y,za, -1, -1, -1); 
Reply
#6

Btw if you use Float: pos[3]; then u need to use pos[0-2] not 1-3
Reply
#7

Quote:
Originally Posted by Xeinss
Посмотреть сообщение
He can also use this way
PHP код:
    GetPlayerPos(playeridx,y,z); GetPlayerFacingAngle(playerida);
    
pInfo[playerid][pCar1] = CreateVehicle(vehx,y,za, -1, -1, -1); 
Quote:
Originally Posted by Xeinss
Посмотреть сообщение
PHP код:
new Float:Pos[3];
GetPlayerPos(playerid,Pos[1],Pos[2],Pos[3]);
    
CreateVehicle(pInfo[playerid][pCar1],Pos[2],Pos[1],Pos[3],-1,-1,-1,-1); 
try this.
Tried both ways nothing works i don't know why but it doesn't create the vehicle at all.
Reply
#8

Does pInfo[playerid][pCar1] store the model of the vehicle or do you want it to store the SAMP vehicle id of the players vehicle?

pawn Код:
new Float:Pos[4],col[2];
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
GetPlayerFacingAngle(playerid,Pos[4]);
vehiclemodel = 560; //560 is a sultan.
col[0] = random(256); //not sure if 256 is the max colour or not, i think it is though.
col[1] = random(256);
pInfo[playerid][pCar1] = CreateVehicle(vehiclemodel,Pos[0],Pos[1],Pos[2],Pos[4],col[0],col[1],-1);
Reply
#9

i am storing the vehicle model in the saving system but when i try to spawn the vehicle nothing happens.
Reply
#10

Try this, and post what it prints into the server console.

What you save the model to the file, does it write it to the file with the correct number? And then when you load it, does it load it properly?
pawn Код:
new Float:Pos[4],col[2];
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
GetPlayerFacingAngle(playerid,Pos[4]);
col[0] = random(256); //not sure if 256 is the max colour or not, i think it is though.
col[1] = random(256);
printf("Player Car1 = %i",pInfo[playerid][pCar1]);
//What gets printed here?
CreateVehicle(pInfo[playerid][pCar1],Pos[0],Pos[1],Pos[2],Pos[4],col[0],col[1],-1);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)