SA-MP Forums Archive
[Tutorial] How to make a simple weapon system - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] How to make a simple weapon system (/showthread.php?tid=459412)



How to make a simple weapon system - efrim123 - 22.08.2013

include zcmd first
pawn Code:
#include <zcmd>
and ofc define the color thx for Bravo for reminding me
pawn Code:
#define COLOR_RED 0xFF0000
pawn Code:
CMD:wpack(playerid, params[]) // this how you  need to preform the command
{
    if(GetPlayerMoney(playerid) < 1000)
    return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to buy /wpack");
    GivePlayerMoney(playerid, -1000); //this takes the money from the player so it wont be free
    GivePlayerWeapon(playerid, 10, 0); //You can change the weapons if you want
    GivePlayerWeapon(playerid, 24, 500); //those functions are the weapons
    GivePlayerWeapon(playerid, 26, 500);
    GivePlayerWeapon(playerid, 32, 500);
    GivePlayerWeapon(playerid, 31, 500);
    GivePlayerWeapon(playerid, 34, 500);
    SendClientMessage(playerid, COLOR_RED, "You have succesfully used /wpack!"); //this shows that the cmd works
    return 1;
}
Hope it helped you guys have a nice day


Re: How to make a simple weapon system - Bravo6 - 22.08.2013

Nice Command I'm impressed of it simple but efficient.One more thing:you gotta define the color in order for it to work.Newbies will get undefined simbol error.Color define:

pawn Code:
#DEFINE COLOR_RED color code



Re: How to make a simple weapon system - efrim123 - 22.08.2013

Thanks i forgot about the defines
will edit it


Re: How to make a simple weapon system - efrim123 - 24.08.2013

Small Update: Now if you buy a pack you cannot buy it if you have less then 1000 cash


Re: How to make a simple weapon system - Konstantinos - 24.08.2013

You forgot to close the text.
pawn Code:
// SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to buy /wpack"); // <--
SendClientMessage(playerid, COLOR_RED, "You don't have enough cash to buy /wpack);
To be honest, I don't see a weapon system as you stated in the title, but a command which gives you 5 weapons.


Re: How to make a simple weapon system - efrim123 - 24.08.2013

Weapon systems can be made from commands too