SA-MP Forums Archive
[FilterScript] Weapon Commands! | Simple FS - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] Weapon Commands! | Simple FS (/showthread.php?tid=364596)



Weapon Commands! | Simple FS - MaxEMO - 31.07.2012

Weapon Commands

Info:
Just Created it :P,didn't take much time its simple one hope you like it

Bugs:
oh comeon...ofc no bugs :P

How to use:
Well just enter the game and do /guns,and you will know the rest,or just check the script

Download:
http://www.multiupload.nl/T4T23NISVO



Re: Weapon Commands! | Simple FS - Zarky - 31.07.2012

Nice, i'll test this


Re: Weapon Commands! | Simple FS - Majed - 31.07.2012

Nice,
But can u upload it also on
pastebin.com please.?


Re: Weapon Commands! | Simple FS - MaxEMO - 01.08.2012

uploaded on pastebin.

http://pastebin.com/69WgfcHT


Re: Weapon Commands! | Simple FS - Ben_Gale - 01.08.2012

got any screenshots?


Re: Weapon Commands! | Simple FS - MaxEMO - 01.08.2012

It's not a dialog,so there is nothing to show,its simple,a command for every weapon to give it to you
like "/m4",to see all the list your do /guns,thats it.


Re: Weapon Commands! | Simple FS - jpeg - 01.08.2012

Great, simple and useful!


Re: Weapon Commands! | Simple FS - coole210 - 01.08.2012

Oh, god.. I don't even think this should work. Why not make it so you do /guns (ammo) (weapon id/name) ?

Not very hard.. I'll whip one up.

Here it is (uses sscanf, ycmd and some functions..):

pawn Код:
//Custom enum made by me (put at top of script)
enum _WeaponInfo {
    Name[60],Valid,Slot,
}
new WeaponInfo[][_WeaponInfo] =
{
    {"Fist",1,0},
    {"Brass Knuckles",1,0},
    {"Golf Club",1,1},
    {"Nightstick",1,1},
    {"Knife",1,1},
    {"Baseball Bat",1,1},
    {"Shovel",1,1},
    {"Pool cue",1,1},
    {"Katana",1,1},
    {"Chainsaw",1,1},
    {"Double-ended Dildo",1,10},
    {"Dildo",1,10},
    {"Vibrator",1,10},
    {"Silver Vibrator",1,10},
    {"Flowers",1,10},
    {"Cane",1,10},
    {"Grenade",1,8},
    {"Tear Gas",1,8},
    {"Molotov Cocktail",1,8},
    {"",0},
    {"",0},
    {"",0},
    {"9mm Pistol",1,2},
    {"Silenced 9mm",1,2},
    {"Deagle",1,2},
    {"Shotgun",1,3},
    {"Sawnoff Shotgun",1,3},
    {"Combat Shotgun",1,3},
    {"Micro SMG",1,4},
    {"MP5",1,4},
    {"AK-47",1,5},
    {"M4",1,5},
    {"Tec-9",1,4},
    {"Country Rifle",1,6},
    {"Sniper Rifle",1,6},
    {"RPG",1,7},
    {"HS Rocket",1,7},
    {"Flamethrower",1,7},
    {"Minigun",1,7},
    {"Sachel Charge",1,8},
    {"Detonator",1,12},
    {"Spray Can",1,9},
    {"Fire Extinguisher",1,9},
    {"Camera",1,9},
    {"Night Vision Goggles",0,11},
    {"Thermal Goggles",0,11},
    {"Parachute",1,11}
};

//And the command:
YCMD:guns(playerid,params[],help)
{
    new weaponstring[45], ammo, weaponid = -1, str[70];
    if(sscanf(params,"is[45]", ammo, weaponstring)) return SendClientMessage(playerid,0xFFFFFFFF,"USAGE: /guns (ammo) (weapon id/name)");
    if(ammo > 65535 || ammo < 1) return SendClientMessage(playerid,0xFFFFFFFF,"You have entered an invalid ammo value");
    if(StringNumeric(weaponstring))
    {
        weaponid = strval(weaponstring);
    }
    else
    {
        weaponid = CheckWeaponID(weaponstring);
    }
    if(weaponid == -1) return SendClientMessage(playerid,0xFFFFFFFF,"Error: The processed weapon id is invalid");
    if(weaponid == -2) return SendClientMessage(playerid,0xFFFFFFFF,"Error: The weapon id you chose is forbidden");
    if(WeaponInfo[weaponid][Valid] == 0) return SendClientMessage(playerid,0xFFFFFFFF,"Error: The weapon id you chose is forbidden");
    if(weaponid < 0 || weaponid > 46) return SendClientMessage(playerid,0xFFFFFFFF,"Error: You have entered an invalid weapon id");
    GivePlayerWeapon(playerid, weaponid, ammo);
    format(str, sizeof(str),"Server: You have been given a(n) %s (Slot: %d) with %d ammo.",
    WeaponInfo[weaponid][Name], WeaponInfo[weaponid][Slot], ammo);
    SendClientMessage(playerid, 0xFFFFFFFF, str);
    return 1;
}
//Functions:
StringNumeric(const str[])
{
    for(new i = 0,ii = strlen(str);i < ii;i++)
    {
        if(str[i] > '9' || str[i] < '0') return 0;
    }
    return 1;
}
stock CheckWeaponID(name[])
{
    for(new i = 0; i < 46; i++)
    {
        if(strfind(WeaponInfo[i][Name], name, true) != -1)
        {
            if(WeaponInfo[i][Valid] == 0) return -2;
            return i;
        }
    }
    return -1;
}



Re: Weapon Commands! | Simple FS - Gamer_007 - 01.08.2012

nice for beginners dude


Re: Weapon Commands! | Simple FS - Majed - 01.08.2012

Quote:
Originally Posted by MaxEMO
Посмотреть сообщение
uploaded on pastebin.

http://pastebin.com/69WgfcHT
Thanks (+rep)