[Include] Advanced Firearm System
#1

Introduction
Advanced Firearm System is my very first include, I wont say that this is advanced yet since I'm still developing it, working on over 100 weapon models, so basically, this will be available to add real life models to your SAMP Script.
Functions
Код:
stock SetPlayerFirearm(playerid, firearm, ammo, debugging = 0)

GetPlayerFirearm(playerid, type)
GetFirearmName(id)
Explanation
So currently, this include is one of the smallest in SAMP, but I got my full version with around 100 weapons, but that'll wait some hours/days.
SetPlayerFirearm
PHP код:
CMD:firearm(playeridparams[])
{
    new 
iddebugfa;
    if(!
sscanf(params"ii"iddebugfa))
    {
           
SetPlayerFirearm(playeridid72debugfa);
    }
    else
    {
         
SendClientMessage(playerid, -1"["C_Error"Error"C_Default"] Usage: /firearm [id(1-25)] [debugging(0-1)]");
     }
     return 
1;

PHP код:
SetPlayerFirearm(playerid164);
SetPlayerFirearm(playerid1641); 
The command would be /firearm 24 0, for a Remington without a message for damage & firearm model.
GetPlayerFirearm
PHP код:
CMD:myguns(playerid)
{
    if(
GetPlayerFirearm(playerid1) != 0)
    {
        new 
gunText[128];
        
format(gunText128"Your hand gun ID are %i, named %s"GetPlayerFirearm(playerid1), GetFirearmName(GetPlayerFirearm(playerid1)));
        
SendClientMessage(playerid0xD1D1D1FFgunText);
    }
    if(
GetPlayerFirearm(playerid2) != 0)
    {
        new 
gunText[128];
        
format(gunText128"Your small hand gun ID are %i, named %s"GetPlayerFirearm(playerid2), GetFirearmName(GetPlayerFirearm(playerid2)));
        
SendClientMessage(playerid0xD1D1D1FFgunText);
    }
    if(
GetPlayerFirearm(playerid3) != 0)
    {
        new 
gunText[128];
        
format(gunText128"Your silenced hand gun ID are %i, named %s"GetPlayerFirearm(playerid3), GetFirearmName(GetPlayerFirearm(playerid3)));
        
SendClientMessage(playerid0xD1D1D1FFgunText);
    }
    if(
GetPlayerFirearm(playerid4) != 0)
    {
        new 
gunText[128];
        
format(gunText128"Your shotgun ID are %i, named %s"GetPlayerFirearm(playerid4), GetFirearmName(GetPlayerFirearm(playerid4)));
        
SendClientMessage(playerid0xD1D1D1FFgunText);
    }
    return 
1;

PHP код:
GetPlayerFirearm(playeridtype(1-4)) 
This is a basic call, it checks if you got a firearm, and returns the id of it, see below for ids=names.
GetFirearmName
PHP код:
CMD:myguns(playerid)
{
    if(
GetPlayerFirearm(playerid1) != 0)
    {
        new 
gunText[128];
        
format(gunText128"Your hand gun ID are %i, named %s"GetPlayerFirearm(playerid1), GetFirearmName(GetPlayerFirearm(playerid1)));
        
SendClientMessage(playerid0xD1D1D1FFgunText);
    }
    if(
GetPlayerFirearm(playerid2) != 0)
    {
        new 
gunText[128];
        
format(gunText128"Your small hand gun ID are %i, named %s"GetPlayerFirearm(playerid2), GetFirearmName(GetPlayerFirearm(playerid2)));
        
SendClientMessage(playerid0xD1D1D1FFgunText);
    }
    if(
GetPlayerFirearm(playerid3) != 0)
    {
        new 
gunText[128];
        
format(gunText128"Your silenced hand gun ID are %i, named %s"GetPlayerFirearm(playerid3), GetFirearmName(GetPlayerFirearm(playerid3)));
        
SendClientMessage(playerid0xD1D1D1FFgunText);
    }
    if(
GetPlayerFirearm(playerid4) != 0)
    {
        new 
gunText[128];
        
format(gunText128"Your shotgun ID are %i, named %s"GetPlayerFirearm(playerid4), GetFirearmName(GetPlayerFirearm(playerid4)));
        
SendClientMessage(playerid0xD1D1D1FFgunText);
    }
    return 
1;

PHP код:
GetFirearmName(1
This gives the name of the weapon id that's called using it.
Names & Damages
Код:
ID          NAME           DAMAGE           TYPE
1          Glock 18          28               1
2          Glock 19          32               1
3          Glock 23          41               1
4          Glock 40          46               1
5          Glock 41          51               1
6          M1911             43               1
7          CZ74              33               1
8          FS92              52               1
9          USPS              45               1
10         P2000             35               1
11         C45               36               1
12         P250               7               2
13         R8                 9               2
14         Gock 27            8               2
15         ACP45             12               2
16         TP9SA             16               2
17         TP9SF             16               2
18         APB               14               3
19         Silencer 22       34               3
20         MK23              47               3
21         KFOR              31               3
22         LR22              48               3
23         Mossberg 500      46               4
24         Remington 870     87               4
25         R12               64               4
Download
V1
V2
Changelog
V2
Quote:

- Using switch's with cases.
- Added Shotguns, silenced, 9mm's, deagles.
- Changed a few stocks.

YouTube
https://www.youtube.com/watch?v=ZhEOGGtilZI
Note: My first include.
Reply
#2

Use switches instead of so many if's this code will make CPUs bleed Q_Q

Anyway can't really judge the script since it seems "early access" so i'll wait when you finish it.

Seems like a nice idea (if you plan making the models etc.)
Reply
#3

The include has been updated to V2, including 25 firearms, check Changelog for more information.
Reply
#4

Nice, any screenshots?
Reply
#5

Good job Meller. Nice one. +rep
Reply
#6

Quote:
Originally Posted by vannesenn
Посмотреть сообщение
Nice, any screenshots?
Thanks, forgot about the screenshots, I'll make a video at *******, hold on please.

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Good job Meller. Nice one. +rep
Thanks mate.
Reply
#7

Nice ..
Good Job
Reply
#8

nice one
Reply
#9

That's nice. Rep+
Reply
#10

Good organisation!!!

+Rep!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)