10.07.2018, 13:30
PHP код:
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;
}