CMD:checkweapons(playerid, params[])
{
if(GetPVarInt(playerid, "LoggedIn") == 0) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be logged in to use this command.");
new string[256], id;
if(Player[playerid][AdminLevel] >= 2)
{
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_GREY, "[Server Command]: /checkweapons [playerid]");
new weapons[13][2];
for(new i=0; i<13; i++)
{
GetPlayerWeaponData(id, i, weapons[i][0], weapons[i][1]);
format(string, sizeof(string), "Slot %i: %i", i, weapons[i][0]);
}
ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Player's Client-Side Weapons", string, "OK", "");
format(string, sizeof(string), "%s's account weapons:", GetName(id));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "Slot 1: {FFFFFF}%i{C0C0C0} - Slot 2: {FFFFFF}%i{C0C0C0} - Slot 3: {FFFFFF}%i{C0C0C0} - Slot 4: {FFFFFF}%i{C0C0C0} - Slot 5: {FFFFFF}%i{C0C0C0} - Slot 6: {FFFFFF}%i{C0C0C0}", Player[id][Weapon1], Player[id][Weapon2], Player[id][Weapon3], Player[id][Weapon4], Player[id][Weapon5], Player[id][Weapon6]);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), "Slot 7: {FFFFFF}%i{C0C0C0} - Slot 8: {FFFFFF}%i{C0C0C0} - Slot 9: {FFFFFF}%i{C0C0C0} - Slot 10: {FFFFFF}%i{C0C0C0} - Slot 11: {FFFFFF}%i{C0C0C0} - Slot 12: {FFFFFF}%i{C0C0C0}", Player[id][Weapon7], Player[id][Weapon8], Player[id][Weapon9], Player[id][Weapon10], Player[id][Weapon11], Player[id][Weapon12]);
SendClientMessage(playerid, COLOR_GREY, string);
SendClientMessage(playerid, COLOR_LIGHTRED, "Note: If their client-side weapons don't match their account weapons, they are weapon hacking.");
}
else return SendClientMessage(playerid, COLOR_GREY, ADMIN);
return 1;
}
for(new i=0; i<13; i++) { GetPlayerWeaponData(id, i, weapons[i][0], weapons[i][1]); format(string, sizeof(string), "%sSlot %i: %i",string, i, weapons[i][0]); }
CMD:checkweapons(playerid, params[])
{
if(!GetPVarInt(playerid, "LoggedIn")) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be logged in to use this command.");
if(Player[playerid][AdminLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, ADMIN);
new id;
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_GREY, "[Server Command]: /checkweapons [playerid]");
if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: That player is not connected.");
new weapons[13][2], string[150];
for(new i = 0; i < 13; i++)
{
new fstr[12];
GetPlayerWeaponData(id, i, weapons[i][0], weapons[i][1]);
if(weapons[i][0])
{
format(fstr, sizeof(fstr), "Slot %i: %i\n", i, weapons[i][0]);
strcat(string, fstr);
}
}
ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Player's Client-Side Weapons", string, "OK", "");
format(string, sizeof(string), "%s's account weapons:", GetName(id));
SendClientMessage(playerid, COLOR_LIGHTRED, string);
format(string, sizeof(string), "{C0C0C0}Slot 1: {FFFFFF}%i{C0C0C0} - Slot 2: {FFFFFF}%i{C0C0C0} - Slot 3: {FFFFFF}%i", Player[id][Weapon1], Player[id][Weapon2], Player[id][Weapon3]);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), "{C0C0C0}Slot 4: {FFFFFF}%i{C0C0C0} - Slot 5: {FFFFFF}%i{C0C0C0} - Slot 6: {FFFFFF}%i", Player[id][Weapon4], Player[id][Weapon5], Player[id][Weapon6]);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), "{C0C0C0}Slot 7: {FFFFFF}%i{C0C0C0} - Slot 8: {FFFFFF}%i{C0C0C0} - Slot 9: {FFFFFF}%i", Player[id][Weapon7], Player[id][Weapon8], Player[id][Weapon9]);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), "{C0C0C0}Slot 10: {FFFFFF}%i{C0C0C0} - Slot 11: {FFFFFF}%i{C0C0C0} - Slot 12: {FFFFFF}%i", Player[id][Weapon10], Player[id][Weapon11], Player[id][Weapon12]);
SendClientMessage(playerid, COLOR_GREY, string);
SendClientMessage(playerid, COLOR_LIGHTRED, "Note: If their client-side weapons don't match their account weapons, they are weapon hacking.");
return 1;
}
This function GetPlayerWeaponData() is fairly unreliable because the client can easily send incorrect data to the server.
|