OnPlayerWeaponShot..... -
danish007 - 23.07.2014
Hello, i've made a shooting gun in public.
its not working when players shots. please check this?
PHP код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new string[256];
if(PlayerInfo[playerid][pSpawn] == 1 && PlayerInfo[playerid][pShootingTime] <= 0 && PlayerInfo[playerid][pJailed] == 0 && PlayerInfo[playerid][pAJailed] == 0)
{
if(PlayerInfo[playerid][pTeam] != TEAM_LAW && PlayerInfo[playerid][pVigilante] == 0)
{
if(IsSuspectInRangeOfPolice1(playerid) && !IsPlayerInAnyVehicle(playerid))
{
if(PlayerInfo[playerid][pWantedLevel] >= 6)PlayerInfo[playerid][pWantedLevel]++;else PlayerInfo[playerid][pWantedLevel] =6;
SetPlayerWantedStats(playerid,"Shooting Gun In Public");
format(string, sizeof(string), "Crime: Shooting Gun In Public");
ReportCrimeTOPolice(playerid,string);
PlayerInfo[playerid][pShootingTime] =20;
}
}
}
return 1;
}
Re: OnPlayerWeaponShot..... -
Mauzen - 23.07.2014
if(PlayerInfo[playerid][pWantedLevel] >= 6)
This one is wrong here, you dont want to check if the players wanted level is bigger that 6, but if it is smaller
if(PlayerInfo[playerid][pWantedLevel] < 6)
Re: OnPlayerWeaponShot..... -
danish007 - 23.07.2014
its right. if player wanted is more than 6 wanted level increase one by one and if less than 6 wanted level direct to 6.
function is not working why? when i shoot near cop even msgs are not showing
Re: OnPlayerWeaponShot..... -
danish007 - 23.07.2014
anyone please?
Re: OnPlayerWeaponShot..... -
Ihateyou - 23.07.2014
where is timer to decrease pShootingTime?
Re: OnPlayerWeaponShot..... -
Virtual1ty - 23.07.2014
It's hard to say considering we don't know what many of those variables in the "if" check evaluate to. One of them must be faulty when the code doesn't pass to desired actions, SetPlayerWanted..etc.
Try loosing one by one variable/function from the "if" check to narrow down the cause, I hardly think it's the public's fault.
I would bet on the range check because that's the one we have least information on.
Good luck debugging! Also, for the love of God, INDENT your future code, imagine how much we have had to struggle reading that, and me trying to optimise your GM.
Best of luck!
Edit: the solution is to enable 'lagcompmode' in the server.cfg as this was introduced in 0.3z.