SA-MP Forums Archive
Multiplication warnings - 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: Multiplication warnings (/showthread.php?tid=363171)



Multiplication warnings - jameskmonger - 26.07.2012

Код:
new stolenMoney = 1, robChance = random(5);
switch(robChance) {
	case 	0: stolenMoney = 0;
	case 1..4: {
		stolenMoney * 1000 * robChance;
	}
}
The above code gives me a "expression has no effect" warning on the line "stolenMoney * 1000 * robChange" - why?


Re: Multiplication warnings - Jeffry - 26.07.2012

pawn Код:
new stolenMoney = 1, robChance = random(5);
switch(robChance) {
    case    0: stolenMoney = 0;
    case 1..4: {
        stolenMoney = stolenMoney * 1000 * robChance;
    }
}
But this should do the same, as the complete code above.
pawn Код:
new stolenMoney = 1000 * random(5);



Re: Multiplication warnings - jameskmonger - 26.07.2012

Worked brilliantly, thankyou