PDA

View Full Version : How to fix that?


Lajko1
19/03/2014, 06:49 PM
I want to make if player is near Plane,Bike,Heli and so on.. it will write "This vehicle doesn't have trunk" but this code isn't working, help please.

if(!strcmp(cmdtext, "/trunk", true) || !strcmp(cmdtext, "/tr", true))
{
for(new vid; vid<MAX_VEHICLES; vid++)
{
new Float: vx, Float:vy, Float:vz;
GetVehiclePos(vid,vx,vy,vz);
GetXYBehindCar(vid, vx, vy, 3.5);
if(IsPlayerInRangeOfPoint(playerid,1.5,vx,vy,vz))
{
if(!IsModelAPlane(vid) || !IsModelABike(vid) || !IsModelAHeli(vid) || !IsModelABoat(vid) || !IsModelASpecial(vid))
{
ShowPlayerDialog(playerid, DIALOG_TRUNK, DIALOG_STYLE_LIST, "Choose an option", "{5555FF}Open/Close the trunk \n{5555FF}Put in trunk \n{5555FF}Take from trunk", "Select", "Close");
return 1;
}
else
{
SendClientMessage(playerid, -1, "{FF6A22}INFO: {FFFFFF}This vehicle doesn't have trunk!");
return 1;
}
}
}
return 1;
}

Sascha
19/03/2014, 06:59 PM
don't you want a check for:

if(!IsModelAPlane(vid) && !IsModelABike(vid) && !IsModelAHeli(vid) && !IsModelABoat(vid) && !IsModelASpecial(vid))
{?
(and the range is pretty small, if you are sure you are really in it, leave it like it is, otherwise I'd suggest you to start with a higher range - at least for testing)

Lajko1
19/03/2014, 07:10 PM
don't you want a check for:

if(!IsModelAPlane(vid) && !IsModelABike(vid) && !IsModelAHeli(vid) && !IsModelABoat(vid) && !IsModelASpecial(vid))
{?
(and the range is pretty small, if you are sure you are really in it, leave it like it is, otherwise I'd suggest you to start with a higher range - at least for testing)

Yeah I want to make it if VEHICLE ISN'T model heli, bike etc etc.. it will open dialog else error msg.

Sascha
19/03/2014, 07:19 PM
did you try it with my code? the && instead of your ||?

Lajko1
20/03/2014, 07:42 PM
Yeah it's working Rep + for you ;) ty