16.05.2017, 02:04
Thank you for testing, I highly appreciate it!!
Surprisingly the weaponid parameters OnPlayerWeaponShot & OnPlayerGive(Take)Damage is reliable as it returns the player's correct holding weapon while they are on the vehicle.
Testing in game (with debug messages); Note the message "Weapon I am holding" returns GetPlayerWeapon |
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
{
SetPVarInt(playerid, "old_weapon", GetPlayerWeapon(playerid));
}
return 1;
}
public OnPlayerUpdate(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
SetPlayerArmedWeapon(playerid, GetPVarInt(playerid, "old_weapon"));
}
return 1;
}
I'm not sure that's really undetectable. Just make damage system serverside and check if the HP reported by the client is different from what server knows.
|