CMD:returnveh issue - 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)
+--- Thread: CMD:returnveh issue (
/showthread.php?tid=427219)
CMD:returnveh issue -
UnknownGamer - 31.03.2013
pawn Код:
CMD:returnveh(playerid, params[])
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
{
if(IsPlayerInRangeOfPoint(playerid, 15,1568.7477,-1689.9850,6.2188))
{
new carid = GetPlayerVehicleID(playerid);
if(lspdspawn[playerid] == 0) return SCM(playerid, COLOR_LIGHTRED, "You do not have a LSPD vehicle out.");
if(GetVehicleModel(carid) != 596 || GetVehicleModel(carid) != 597 || GetVehicleModel(carid) != 598 || GetVehicleModel(carid) != 523) return SCM(playerid, COLOR_LIGHTRED, "Your not in a LSPD vehicle.");
DestroyVehicle(carid);
SCM(playerid, COLOR_WHITE, "You have returned the LSPD Vehicle, to the police garage.");
lspdspawn[playerid] = 0;
}
}
return 1;
}
Even though I am at PD garage, It says Im not in a lspd veh? (im on 523 / motorbike).
Re: CMD:returnveh issue -
Nathan_Taylor - 31.03.2013
Your problem is in your IF statement I believe. You are saying the following
pawn Код:
if(GetVehicleModel(carid) != 596 || GetVehicleModel(carid) != 597 || GetVehicleModel(carid) != 598 || GetVehicleModel(carid) != 523) return SCM(playerid, COLOR_LIGHTRED, "Your not in a LSPD vehicle.");
Which is always going to say "Your not in a LSPD vehicle" because what you are saying is, If the vehicle model is not 596 OR vehiel model is not 597 OR vehicle model is not 598 OR etc etc.... and because the vehicle model can't be all of those at once, it is returning that error message. Try switching to AND instead of OR
pawn Код:
if(GetVehicleModel(carid) != 596 && GetVehicleModel(carid) != 597 && GetVehicleModel(carid) != 598 && GetVehicleModel(carid) != 523) return SCM(playerid, COLOR_LIGHTRED, "Your not in a LSPD vehicle.");