28.05.2016, 23:09
(
Последний раз редактировалось Luicy.; 29.05.2016 в 11:56.
Причина: Added video.
)
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
ExplanationКод:stock SetPlayerFirearm(playerid, firearm, ammo, debugging = 0) GetPlayerFirearm(playerid, type) GetFirearmName(id)
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.Names & DamagesSetPlayerFirearmGetPlayerFirearmPHP код:
CMD:firearm(playerid, params[])
{
new id, debugfa;
if(!sscanf(params, "ii", id, debugfa))
{
SetPlayerFirearm(playerid, id, 72, debugfa);
}
else
{
SendClientMessage(playerid, -1, "["C_Error"Error"C_Default"] Usage: /firearm [id(1-25)] [debugging(0-1)]");
}
return 1;
}
The command would be /firearm 24 0, for a Remington without a message for damage & firearm model.PHP код:
SetPlayerFirearm(playerid, 1, 64);
SetPlayerFirearm(playerid, 1, 64, 1);
GetFirearmNamePHP код:
CMD:myguns(playerid)
{
if(GetPlayerFirearm(playerid, 1) != 0)
{
new gunText[128];
format(gunText, 128, "Your hand gun ID are %i, named %s", GetPlayerFirearm(playerid, 1), GetFirearmName(GetPlayerFirearm(playerid, 1)));
SendClientMessage(playerid, 0xD1D1D1FF, gunText);
}
if(GetPlayerFirearm(playerid, 2) != 0)
{
new gunText[128];
format(gunText, 128, "Your small hand gun ID are %i, named %s", GetPlayerFirearm(playerid, 2), GetFirearmName(GetPlayerFirearm(playerid, 2)));
SendClientMessage(playerid, 0xD1D1D1FF, gunText);
}
if(GetPlayerFirearm(playerid, 3) != 0)
{
new gunText[128];
format(gunText, 128, "Your silenced hand gun ID are %i, named %s", GetPlayerFirearm(playerid, 3), GetFirearmName(GetPlayerFirearm(playerid, 3)));
SendClientMessage(playerid, 0xD1D1D1FF, gunText);
}
if(GetPlayerFirearm(playerid, 4) != 0)
{
new gunText[128];
format(gunText, 128, "Your shotgun ID are %i, named %s", GetPlayerFirearm(playerid, 4), GetFirearmName(GetPlayerFirearm(playerid, 4)));
SendClientMessage(playerid, 0xD1D1D1FF, gunText);
}
return 1;
}
This is a basic call, it checks if you got a firearm, and returns the id of it, see below for ids=names.PHP код:
GetPlayerFirearm(playerid, type(1-4))
PHP код:
CMD:myguns(playerid)
{
if(GetPlayerFirearm(playerid, 1) != 0)
{
new gunText[128];
format(gunText, 128, "Your hand gun ID are %i, named %s", GetPlayerFirearm(playerid, 1), GetFirearmName(GetPlayerFirearm(playerid, 1)));
SendClientMessage(playerid, 0xD1D1D1FF, gunText);
}
if(GetPlayerFirearm(playerid, 2) != 0)
{
new gunText[128];
format(gunText, 128, "Your small hand gun ID are %i, named %s", GetPlayerFirearm(playerid, 2), GetFirearmName(GetPlayerFirearm(playerid, 2)));
SendClientMessage(playerid, 0xD1D1D1FF, gunText);
}
if(GetPlayerFirearm(playerid, 3) != 0)
{
new gunText[128];
format(gunText, 128, "Your silenced hand gun ID are %i, named %s", GetPlayerFirearm(playerid, 3), GetFirearmName(GetPlayerFirearm(playerid, 3)));
SendClientMessage(playerid, 0xD1D1D1FF, gunText);
}
if(GetPlayerFirearm(playerid, 4) != 0)
{
new gunText[128];
format(gunText, 128, "Your shotgun ID are %i, named %s", GetPlayerFirearm(playerid, 4), GetFirearmName(GetPlayerFirearm(playerid, 4)));
SendClientMessage(playerid, 0xD1D1D1FF, gunText);
}
return 1;
}
This gives the name of the weapon id that's called using it.PHP код:
GetFirearmName(1)
DownloadКод: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
V1Changelog
V2
V2YouTubeQuote:
- Using switch's with cases.
- Added Shotguns, silenced, 9mm's, deagles.
- Changed a few stocks.
https://www.youtube.com/watch?v=ZhEOGGtilZINote: My first include.