SA-MP Forums Archive
Why doesnt this 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why doesnt this work? (/showthread.php?tid=267145)



Why doesnt this work? - Gemini - 07.07.2011

I'm working on a DM zone, and I want players to only have weapons when inside that zone.
This code doesnt give me any errors when compiled in my GM, but it doesn't seem to work in the server.

public isPlayerInArea()
{
new Float:X, Float:Y, Float:Z;
for(new i=0; i < MAX_PLAYERS; i++)
{
GetPlayerPos(i, X, Y, Z);
if (X <= 2806.4766 && X >= 2566.6860 && Y <= -2332.2461 && Y >= -2562.3301) // area 1
{
}
else
{
ResetPlayerWeapons(i);
}
}
}


Re: Why doesnt this work? - Edvin - 07.07.2011

https://sampforum.blast.hk/showthread.php?tid=222283
pawn Код:
IsPlayerInArea( playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY )
{
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos( playerid, X, Y, Z );
    if(X >= 2806.4766 && X <= 2566.6860 && Y >= -2332.2461 && Y <= -2562.3301)
    {
    }
    else
    {
    ResetPlayerWeapons( playerid );
    }
    return 1;
    }
return 0;
}



Re: Why doesnt this work? - Gemini - 07.07.2011

Gives me 2 errors:
error 010: invalid function or declaration
warning 203: symbol is never used: "IsPlayerInArea"


Re: Why doesnt this work? - Shadoww5 - 07.07.2011

PHP код:
stock IsPlayerInArea(playeridFloat:MinXFloat:MinYFloat:MaxXFloat:MaxY)
{
    new 
Float:XFloat:YFloat:Z;
    
GetPlayerPos(playeridXYZ);
    if(
>= MinX && <= MaxX && >= MinY && <= MaxY
    {
        return 
1;
    }
    return 
0;
}

public 
Check()
{
    new 
Float:XFloat:YFloat:Z;
    for(new 
i=0MAX_PLAYERSi++)
    {
        if(!
IsPlayerInArea(i2566.6860, -2562.33012806.4766, -2332.2461))
        {
            
ResetPlayerWeapons(i);
        }
    }
    return 
1;