CreateVehicle problem -
DarkLored - 23.04.2014
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);
Re: CreateVehicle problem -
Mauricee - 23.04.2014
1) How you define x, y, z ?
2) Try to set the Angle 0.0
Re: CreateVehicle problem -
Xeinss - 23.04.2014
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.
Re: CreateVehicle problem -
Ari - 23.04.2014
#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
Re: CreateVehicle problem -
Xeinss - 23.04.2014
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(playerid, x,y,z); GetPlayerFacingAngle(playerid, a);
pInfo[playerid][pCar1] = CreateVehicle(veh, x,y,z, a, -1, -1, -1);
Re: CreateVehicle problem -
PrinceKumar - 23.04.2014
Btw if you use Float: pos[3]; then u need to use pos[0-2] not 1-3
Re: CreateVehicle problem -
DarkLored - 24.04.2014
Quote:
Originally Posted by Xeinss
He can also use this way
PHP код:
GetPlayerPos(playerid, x,y,z); GetPlayerFacingAngle(playerid, a);
pInfo[playerid][pCar1] = CreateVehicle(veh, x,y,z, a, -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.
Re: CreateVehicle problem -
EiresJason - 24.04.2014
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);
Re: CreateVehicle problem -
DarkLored - 24.04.2014
i am storing the vehicle model in the saving system but when i try to spawn the vehicle nothing happens.
Re: CreateVehicle problem -
EiresJason - 24.04.2014
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);