Help - 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: Help (
/showthread.php?tid=647405)
Help -
BluePlayBG - 04.01.2018
Код:
if (!Inventory_HasItem(playerid, "Weapon License A") || !Inventory_HasItem(playerid, "Weapon License B") || !Inventory_HasItem(playerid, "Weapon License C")
return SendErrorMessage(playerid, "You are not allowed to purchase from here without a weapon license.");
Should be working like, if you don't have license A, it should see if you don't have B and then it should check if you don't have C. If you don't have it should print the error. But in-game I can buy the item with Weapon License C ONLY, not with A or B.
Help with fixing that, no any errors while compiling.
Re: Help -
RogueDrifter - 04.01.2018
change all of your
|| to
&& so it should look like this:
PHP код:
if (!Inventory_HasItem(playerid, "Weapon License A") && !Inventory_HasItem(playerid, "Weapon License B") && !Inventory_HasItem(playerid, "Weapon License C")
return SendErrorMessage(playerid, "You are not allowed to purchase from here without a weapon license.");
Explanation: You're checking if the player doesnt have A OR B OR C which means in order to get past this returned block he must have ALL 3, and you want him to pass if he has 1 so you must do if he doesnt have A AND B AND C instead of OR (||) we put (&&) that should solve it.
Re: Help -
rfr - 04.01.2018
just make 3 if statements and see