21.06.2016, 22:39
The problem is basically
Thats how I check if player has the difference in his weapons aka if there are any new weapons they should have or if ammo doesnt match
Now with RPG and Bombs, it will never match for some reason.
Everything else works correctly but bombs and rpg's dont..
PHP код:
public CheckPlayerWeapons(playerid) {
new weapons[13][2];
for (new i = 0; i <= 12; i++) {
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
if(weapons[i][0] != PlayerWeapon[playerid][i][P_WeaponID] || weapons[i][1] != PlayerWeapon[playerid][i][P_Ammo]) {
if(weapons[i][0] != 0) {
new string[128];
format(string,sizeof(string),"Suspicious weapons on %s: %i %i",GetName(playerid),weapons[i][0], weapons[i][1]);
SendClientMessageToAll(COLOR_RED,string);
ResetPlayerWeaponsEx(playerid);
}
}
}
}
Now with RPG and Bombs, it will never match for some reason.
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
new weapons[13][2];
if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE)) { //bombs
if(GetPlayerWeapon(playerid) == 16) {
for (new i = 0; i <= 12; i++) {
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
PlayerWeapon[playerid][i][P_WeaponID] = weapons[i][0];
PlayerWeapon[playerid][i][P_Ammo] = weapons[i][1];
}
}
}
if (HOLDING( KEY_FIRE ) && (PRESSED( KEY_FIRE ))) { //rockets
if(GetPlayerWeapon(playerid) == 35) {
for (new i = 0; i <= 12; i++) {
GetPlayerWeaponData(playerid, i, weapons[i][0], weapons[i][1]);
PlayerWeapon[playerid][i][P_WeaponID] = weapons[i][0];
PlayerWeapon[playerid][i][P_Ammo] = weapons[i][1];
}
}
}
return 1;
}