SA-MP Forums Archive
Why it doesn't work ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why it doesn't work ? (/showthread.php?tid=575171)



Why it doesn't work ? - KillerDVX - 24.05.2015

Why there is no explosions ?

At least, the script works fine !

PHP код:
PUBLIC:Explosions()
{
    foreach(new 
i:Player)
    {
      if(
PlayerToPoint(10.0i, -1479.7295,971.4417,10.7425))
        {
            if(
CentraleBlown == 0)
            {
                if(
gTeam[i] != TEAM_COP || gTeam[i] != TEAM_ARMY || gTeam[i] != TEAM_CIA || gTeam[i] != TEAM_LEADERRAID || gTeam[i] != TEAM_COLEADERRAID || gTeam[i] != TEAM_RAID || gTeam[i] != TEAM_LEADERSWAT || gTeam[i] != TEAM_COLEADERSWAT || gTeam[i] != TEAM_SWAT)
                {
                    
SendClientMessage(i,COLOR_RED,"Vous devez exploser la centrale йlйctrique afin d'йviter les explosions.");
                    new 
Float:xFloat:yFloat:z;
                    
GetPlayerPos(ixyz);
                    
CreateExplosion(x,y,z910.0);
                }
               }
        } 
:/


Re: Why it doesn't work ? - Vince - 24.05.2015

I have no idea what you're trying to do, but I'm 90% sure that your if-statement is wrong. I think you mean to check if the player is: not in TEAM_COP AND not in TEAM_ARMY AND not in TEAM_CIA AND ...


Re : Why it doesn't work ? - KillerDVX - 25.05.2015

What I'm trying to do is simple,

If a criminal get into those coordinates, he get exploded

But, there is no explosion ..

I chose the best loop, "foreach"..

Thanks.



Re: Why it doesn't work ? - BKarner - 26.05.2015

I believe PlayerToPoint is deprecated, use IsPlayerInRangeOfPoint.

What I like to do is do a "SendClientMessage" saying "Debug stage: #" so that you know where it's breaking.


Re: Why it doesn't work ? - Beckett - 26.05.2015

What isn't working, the explosion only?


Re: Why it doesn't work ? - J4Rr3x - 26.05.2015

pawn Код:
PUBLIC:Explosions()
{
    foreach(new i:Player)
    {
        if(IsPlayerInRangeOfPoint(i, 10.0, -1479.7295,971.4417,10.7425))
        {
            if(CentraleBlown == 0)
            {
                if(gTeam[i] != TEAM_COP && gTeam[i] != TEAM_ARMY && gTeam[i] != TEAM_CIA && gTeam[i] != TEAM_LEADERRAID && gTeam[i] != TEAM_COLEADERRAID && gTeam[i] != TEAM_RAID && gTeam[i] != TEAM_LEADERSWAT && gTeam[i] != TEAM_COLEADERSWAT && gTeam[i] != TEAM_SWAT)
                {
                    SendClientMessage(i,COLOR_RED,"Vous devez exploser la centrale йlйctrique afin d'йviter les explosions.");
                    new Float:x, Float:y, Float:z;
                    GetPlayerPos(i, x, y, z);
                    CreateExplosion(x,y,z, 9, 10.0);
                }
            }
        }  
    }
}
Instead of:
pawn Код:
if(gTeam[i] != TEAM_COP && gTeam[i] != TEAM_ARMY && gTeam[i] != TEAM_CIA && gTeam[i] != TEAM_LEADERRAID && gTeam[i] != TEAM_COLEADERRAID && gTeam[i] != TEAM_RAID && gTeam[i] != TEAM_LEADERSWAT && gTeam[i] != TEAM_COLEADERSWAT && gTeam[i] != TEAM_SWAT)
You can create a class for criminal and do:
pawn Код:
if(gTeam[i] == TEAM_CRIMINAL)