[Tutorial] How to make a simple weapon system
#1

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
Reply
#2

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
Reply
#3

Thanks i forgot about the defines
will edit it
Reply
#4

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

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.
Reply
#6

Weapon systems can be made from commands too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)