Solved thank's for @Jeff -
Sn4ke2 - 01.09.2015
Hey everybody, i make a comand /work to can work with one of for vehicle but i get an error
here is the CMD:
PHP код:
MD:work(playerid,params[])
{
if(IsPlayerConnected(playerid))
{
if (GetPlayerState(playerid) == 1 && PlayerToPoint(3.0, playerid,2214.9500,2123.5903,10.8203))
{
if(PlayerInfo[playerid][pJob] != 4) return SCM(playerid,COLOR_WHITE,"{FFF8C6}Tu nu esti Drugs Dealer.");
DisablePlayerCheckpoint(playerid);
new
Float:dx,Float:dy,Float:dz,Float:pos;
GetPlayerPos(playerid,dx,dy,dz);
GetPlayerFacingAngle(playerid,pos);
new dCar = CreateVehicle(dCarID[0][],dx,dy,dz,pos,-1,-1,-1);
PutPlayerInVehicle(playerid,dCar,0);
CP[playerid] = 12;
SetPlayerCheckpoint(playerid,0.0,0.0,0.0,3.0);
}
}
return 1;
}
And i want when a pleyer type /work to give one of this for vehicle's
PHP код:
new dCarID[4][] = {
{440},
{459},
{482},
{499}
};
And the error
PHP код:
New.pwn(37168) : error 029: invalid expression, assumed zero
Thank you
Re: Vehicles Random ID's -
saffierr - 01.09.2015
I am not sure if you typed it here wrong, but start with "CMD:" not "MD:"
Re: Vehicles Random ID's -
Sn4ke2 - 01.09.2015
I done, but now i have one more problem
![Sad](images/smilies/sad.gif)
He give me only car with id 440
i put like this
PHP код:
new dCar = CreateVehicle(dCarID[0][0],dx,dy,dz,pos,-1,-1,-1);
Re: Vehicles Random ID's -
GatsbyTrieu - 01.09.2015
Simple way to do that. Doesn't need enum.
PHP код:
new modelcar;
new Randveh = random(4);
switch(Randveh)
{
Case 0:
{
modelcar = 440;
}
case 1:
{
modelcar = 459;
}
case 2:
{
modelcar = 482;
}
case 3:
{
modelcar = 499;
}
CreateVehicle(modelcar,dx,dy,dz,pos,-1,-1,-1);
}
Re: Vehicles Random ID's -
Sn4ke2 - 01.09.2015
This what you say i will make inside command ?
Re: Vehicles Random ID's -
Jefff - 01.09.2015
pawn Код:
new dCarID[] = {440, 459, 482, 499};
new dCar = CreateVehicle(dCarID[random(sizeof(dCarID))], ... );
Re: Vehicles Random ID's -
Sn4ke2 - 01.09.2015
i make it inside the command and now cont create the vehicle
Re: Vehicles Random ID's -
Sn4ke2 - 01.09.2015
Thank you @jeff i give you one rep point
![Smiley](images/smilies/smile.png)
Thank's for all.
Re: Vehicles Random ID's -
Sn4ke2 - 01.09.2015
@Jeff one more question, now if i want to destroy the vehicle when player exit the vehicle what i need to do ?
![Smiley](images/smilies/smile.png)
i'm newbie sorry
Re: Vehicles Random ID's -
MarvinPWN - 01.09.2015
PHP код:
new dCar[MAX_PLAYERS];//global
dCar[playerid] = CreateVehicle(dCarID[random(sizeof(dCarID))], ... );
OnPlayerVehicleExit:
PHP код:
if(vehicleid == dCar[playerid])
{
DestroyVehicle(dCar[playerid]);
dCar[playerid] = 0;
}