[FilterScript] Simple Weapon System With Commands
#2

pawn Код:
new price, weaponid, ammo;

    switch(listitem)
    {
        case 0: { price = 1000, weaponid = 6, ammo = 10; }
        case 1: { price = 50, weaponid = 1, ammo = 100; }
        case 2: { price = 1540, weaponid = 23, ammo = 1000; }
       
    }
   
    if(GetPlayerMoney(playerid) < price)
        return SendClientMessage(playerid, 0x0000FFAA, "Sorry, you have no cash. DON'T FOOL ME...");

    GivePlayerMoney(playerid, -price);
    GivePlayerWeapon(playerid, weaponid, ammo);
    SendClientMessage(playerid, 0x00FFFFAA, "Enjoy your new weapon!");
Very simple, if using variables. It is efficient, and reduces duplicating codes. You can also add more things easier. Many users have created a weapon shop system with your same code.
Reply


Messages In This Thread
Simple Weapon System With Commands - by Krisna - 29.01.2013, 08:09
Re: Simple Weapon System With Commands - by Madeline - 29.01.2013, 08:20
Re: Simple Weapon System With Commands - by FiReMaNStone - 30.01.2013, 05:22
Re: Simple Weapon System With Commands - by zProfessional - 30.01.2013, 09:29

Forum Jump:


Users browsing this thread: 1 Guest(s)