09.07.2018, 11:04
Hey guys, i want to make 2 different kinds of Weapon, the weapon with Valid Licenses (Legal) and with No License (Illegal) And i need help from you guys to make /showgun
For example, I want the /showgun command looked like this:
Weapons on %s <<< Player Name
[Legal] Desert Eagle
[Illegal] AK-47
[Illegal] Shotgun
Knife
Parachute
I wanted to copy and edit from /listguns but it makes me confused. /listguns contains server-sided and non-server sided weapons.
/listguns code
I made both of this below
For the Illegal guns, the pGuns will be 0 until 13, the Legal guns will be 14 until 23
For example, I want the /showgun command looked like this:
Weapons on %s <<< Player Name
[Legal] Desert Eagle
[Illegal] AK-47
[Illegal] Shotgun
Knife
Parachute
I wanted to copy and edit from /listguns but it makes me confused. /listguns contains server-sided and non-server sided weapons.
/listguns code
Код:
CMD:listguns(playerid, params[]) { // //if(AdminOnDuty[playerid] < 1) return SendClientMessage(playerid, COLOR_GREY, "{007FFF}[INFO] {FFFFFF}You need to be On-Duty Administrator to use this command"); if(PlayerInfo[playerid][pAdmin] >= 2) { new string[128], giveplayerid; if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "[USAGE] /listguns [playerid]"); if(IsPlayerConnected(giveplayerid)) { new weapons[13][2], weaponname[50]; SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________"); format(string, sizeof(string), "Weapons on %s:", GetPlayerNameEx(giveplayerid)); SendClientMessageEx(playerid, COLOR_WHITE, string); for (new i = 0; i < 13; i++) { GetPlayerWeaponData(giveplayerid, i, weapons[i][0], weapons[i][1]); if(weapons[i][0] > 0) { if(PlayerInfo[giveplayerid][pGuns][i] == weapons[i][0]) { GetWeaponName(weapons[i][0], weaponname, sizeof(weaponname)); format(string, sizeof(string), "%s (%d) Ammo (%d).", weaponname, weapons[i][0], weapons[i][1]); SendClientMessageEx(playerid, COLOR_GRAD1, string); } else { GetWeaponName(weapons[i][0], weaponname, sizeof(weaponname)); format(string, sizeof(string), "%s (%d) Ammo (%d) (non server-side).", weaponname, weapons[i][0], weapons[i][1]); SendClientMessageEx(playerid, COLOR_GRAD1, string); } } } SendClientMessageEx(playerid, COLOR_GREEN,"_______________________________________"); } else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified."); } else { SendClientMessageEx(playerid, COLOR_GRAD1, "{007FFF}[Izin] {FFFFFF}You are not authorized to use this command!"); } return 1; }
For the Illegal guns, the pGuns will be 0 until 13, the Legal guns will be 14 until 23
Код:
GivePlayerIllegalWeapon( playerid, WeaponID, Ammo ) { switch( WeaponID ) { case 0, 1: { PlayerInfo[playerid][pGuns][ 0 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 0 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 2, 3, 4, 5, 6, 7, 8, 9: { PlayerInfo[playerid][pGuns][ 1 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 1 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 22, 23, 24: { PlayerInfo[playerid][pGuns][ 2 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 2 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 25, 26, 27: { PlayerInfo[playerid][pGuns][ 3 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 3 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 28, 29, 32: { PlayerInfo[playerid][pGuns][ 4 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 4 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 30, 31: { PlayerInfo[playerid][pGuns][ 5 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 5 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 33, 34: { PlayerInfo[playerid][pGuns][ 6 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 6 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 35, 36, 37, 38: { PlayerInfo[playerid][pGuns][ 7 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 7 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 16, 17, 18, 39, 40: { PlayerInfo[playerid][pGuns][ 8 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 8 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 41, 42, 43: { PlayerInfo[playerid][pGuns][ 9 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 9 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 10, 11, 12, 13, 14, 15: { PlayerInfo[playerid][pGuns][ 10 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 10 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 44, 45, 46: { PlayerInfo[playerid][pGuns][ 11 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 11 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } } return 1; } GivePlayerLegalWeapon( playerid, WeaponID, Ammo ) { switch( WeaponID ) { case 0, 1: { PlayerInfo[playerid][pGuns][ 12 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 12 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 2, 3, 4, 5, 6, 7, 8, 9: { PlayerInfo[playerid][pGuns][ 13 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 13 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 22, 23, 24: { PlayerInfo[playerid][pGuns][ 14 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 14 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 25, 26, 27: { PlayerInfo[playerid][pGuns][ 15 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 15 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 28, 29, 32: { PlayerInfo[playerid][pGuns][ 16 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 16 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 30, 31: { PlayerInfo[playerid][pGuns][ 17 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 17 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 33, 34: { PlayerInfo[playerid][pGuns][ 18 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 18 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 35, 36, 37, 38: { PlayerInfo[playerid][pGuns][ 19 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 19 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 16, 17, 18, 39, 40: { PlayerInfo[playerid][pGuns][ 20 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 20 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 41, 42, 43: { PlayerInfo[playerid][pGuns][ 21 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 21 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 10, 11, 12, 13, 14, 15: { PlayerInfo[playerid][pGuns][ 22 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 22 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } case 44, 45, 46: { PlayerInfo[playerid][pGuns][ 23 ] = WeaponID; PlayerInfo[playerid][pGunsAmmo][ 23 ] = Ammo; GivePlayerWeapon( playerid, WeaponID, Ammo ); } } return 1; }