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));
    }
}Â
stock FA::GetPlayerFirearm(playerid, FA::slot) {
    if(FA::Player[playerid][FA::slot] == INVALID_FIREARM_ID)
      return INVALID_FIREARM_ID;
    else
      return FA::Player[playerid][FA::slot];
  }
Can you stop spamming my profile page and my threads correcting my grammar mistakes?
|
Can you stop spamming my profile page and my threads correcting my grammar mistakes?
|
Originally Posted by SickAttack
Why are you still here? Go life your life.
|