31.07.2016, 21:31
(
Последний раз редактировалось Luicy.; 02.08.2016 в 13:12.
)
Introduction
Download
V3
Advanced Firearm System was my very first include I ever made, so I decided to update it. This time am I hooking it, and now you can create firearms yourself, anywhere, anytime.Functions
ExplanationКод:FA::CreateFirearm(name[], weaponid, damage); FA::GetFirearmID(name[]); FA::GetFirearmName(id); FA::IsValidFirearm(id); FA::GivePlayerFirearm(playerid, FA::id, FA::ammo); FA::GetPlayerFirearm(playerid, FA::slot); FA::GetPlayerHoldingFirearm(playerid); FA::IsPlayerHoldingAnyFirearm(playerid);
FA::CreateFirearm(name[], weaponid, damage);
This creates the firearm and returns the ID of the firearm.PHP код:
new GUN::AR16;
public OnGameModeInit() {
GUN::AR16 = FA::CreateFirearm("AR-16", 31, 7);
return 1;
}
FA::GetFirearmID(name[]);
This looks for the ID for that weapon, if it's not found it will return INVALID_FIREARM_IDPHP код:
new GUN::AR16;
public OnGameModeInit() {
GUN::AR16 = FA::CreateFirearm("AR-16", 31, 7);
return 1;
}
CMD:ar16(playerid) {
new string[128];
format(string, 128, "The ID of AR 16 are %i.", FA::GetFirearmID("AR-16"));
SendClientMessage(playerid, -1, string);
return 1;
}
FA::GetFirearmName(id);
This looks for the name for that weapon, if it's not found it will return INVALID_FIREARM_IDPHP код:
new GUN::AR16;
public OnGameModeInit() {
GUN::AR16 = FA::CreateFirearm("AR-16", 31, 7);
return 1;
}
CMD:id1(playerid) {
new string[128];
format(string, 128, "The name of ID 1 are %s.", FA::GetFirearmName(1));
SendClientMessage(playerid, -1, string);
return 1;
}
CMD:idar16(playerid) {
new string[128];
format(string, 128, "The name of ID %i are %s.", FA::GetFirearmName(GUN::AR16));
SendClientMessage(playerid, -1, string);
return 1;
}
FA::IsValidFirearm(id);
This checks if the ID exists, it will return 1 if it do, else INVALID_FIREARM_IDPHP код:
new GUN::AR16;
public OnGameModeInit() {
GUN::AR16 = FA::CreateFirearm("AR-16", 31, 7);
return 1;
}
CMD:ar16(playerid) {
if(FA::IsValidFirearm(GUN::AR16)) {
SendClientMessage(playerid, -1, "It's a valid weapon!");
}
}
FA::GivePlayerFirearm(playerid, FA::id, FA::ammo);
This basically gives the player that weapon model with ammunation.PHP код:
new GUN::AR16;
public OnGameModeInit() {
GUN::AR16 = FA::CreateFirearm("AR-16", 31, 7);
return 1;
}
CMD:ar16(playerid) {
if(FA::IsValidFirearm(GUN::AR16)) {
FA::GivePlayerFirearm(playerid, GUN::AR16, 500);
}
}
FA::GetPlayerFirearm(playerid, FA:lot); AND FA::IsPlayerHoldingAnyFirearm(playerid);
This checks if you're holding any firearm, if you are, then it'll tell you which model, sorted by the slot.PHP код:
new GUN::AR16;
public OnGameModeInit() {
GUN::AR16 = FA::CreateFirearm("AR-16", 31, 7);
return 1;
}
CMD:gun(playerid) {
if(FA::IsPlayerHoldingAnyFirearm(playerid)) {
printf("Your gun model are %i.", FA::GetPlayerFirearm(playerid, 2));
}
}
Download
V3