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; }
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; }
serverside weapons are weapons that are given to player by server and others player got with hacking
|
stock CheckWeaponLaws(weaponid)
{
switch(weaponid)
{
case 24: return false;
case 30: return true;
//example, if the weapon is a deagle, returns false, if it's an AK returns true.
}
return 1;
}
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])
{
if(CheckWeaponLaws(weapons[i][0])) //if the weapon id returns true, this means it's illegal.
{
GetWeaponName(weapons[i][0], weaponname, sizeof(weaponname));
format(string, sizeof(string), "[Illegal] %s (%d) Ammo (%d).", weaponname, weapons[i][0], weapons[i][1]);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
}
else //if it doesn't return true, then it means it's legal.
{
GetWeaponName(weapons[i][0], weaponname, sizeof(weaponname));
format(string, sizeof(string), "[Legal] %s (%d) Ammo (%d).", weaponname, weapons[i][0], weapons[i][1]);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
}
}
else
{
if(CheckWeaponLaws(weapons[i][0]))
{
GetWeaponName(weapons[i][0], weaponname, sizeof(weaponname));
format(string, sizeof(string), "[Illegal] %s (%d) Ammo (%d) (non server-side).", weaponname, weapons[i][0], weapons[i][1]);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
}
else
{
GetWeaponName(weapons[i][0], weaponname, sizeof(weaponname));
format(string, sizeof(string), "[Legal] %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;
}