max c4s - 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: max c4s (
/showthread.php?tid=616403)
max c4s -
XHunterZ - 04.09.2016
hey i want to know how to make a max_c4s i did something similar b4 but not when you buy
i need when you buy 10 c4s or 2 if it reachs more than 10 c4s it wont accept it i know i can do if c4s >= 10 tell him he cant but it can occur a bug that u can buy more than 10 c4s.
Re: max c4s -
XHunterZ - 05.09.2016
bump
Re: max c4s -
XHunterZ - 06.09.2016
no one know? :v
Re: max c4s -
SickAttack - 06.09.2016
Buying 1 C4 at a time:
pawn Код:
// on top
#define MAX_C4_PER_PLAYER 10
new pC4[MAX_PLAYERS];
// when they buy C4
pC4[playerid] ++;
// when they use C4
pC4[playerid] --;
// when they try to buy C4
if((pC4[playerid] + 1) > MAX_C4_PER_PLAYER)
{
SendClientMessage(playerid, -1, "You can only carry up to "#MAX_C4_PER_PLAYER" at a time.");
}
Buying 2 C4 at a time:
pawn Код:
// on top
#define MAX_C4_PER_PLAYER 10
new pC4[MAX_PLAYERS];
// when they buy C4
pC4[playerid] += 2;
// when they use C4
pC4[playerid] --;
// when they try to buy C4
if((pC4[playerid] + 2) > MAX_C4_PER_PLAYER)
{
SendClientMessage(playerid, -1, "Error while buying C4, try buying 1!");
}
I don't know how anyone wouldn't know how, it's vastly simple. I would just remind you that this section isn't for requests, but I left you an example above. Enjoy!