OnPlayerWeaponShot.....
#1

Hello, i've made a shooting gun in public.

its not working when players shots. please check this?

PHP код:
public OnPlayerWeaponShot(playeridweaponidhittypehitidFloat:fXFloat:fYFloat:fZ)
{
    new 
string[256];
    if(
PlayerInfo[playerid][pSpawn] == && PlayerInfo[playerid][pShootingTime] <= && PlayerInfo[playerid][pJailed] == && 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(stringsizeof(string), "Crime: Shooting Gun In Public");
    
ReportCrimeTOPolice(playerid,string);
    
PlayerInfo[playerid][pShootingTime] =20;
    }
    }
    }
    return 
1;

Reply
#2

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)
Reply
#3

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
Reply
#4

anyone please?
Reply
#5

where is timer to decrease pShootingTime?
Reply
#6

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)