Help me pleaze
#1

Hi Scripters!

Well i was using IsPlayerInArea, to show a GangZone for a player who is passing in that area. But i have some problems, I read a Tutorial and in the Tutorial it don't show where should i use that Function so i decide it to put it on OnPlayerUpdate.

I have this
pawn Код:
if(IsPlayerInArea(playerid, 2220, 2607, -1970, -1571)) //Grove
    {
        GameTextForPlayer(playerid,"Grove Street Territory",1000,1);
        GangZoneShowForPlayer(playerid, GroveStreetZone, 0x00FF0081);
    }
    else
    {
        GangZoneHideForPlayer(playerid, GroveStreetZone);
    }

    if(IsPlayerInArea(playerid, 1832, 2166, -1748, -1141)) //Aztecas
    {
        GameTextForPlayer(playerid,"Aztecas Territory",1000,1);
        GangZoneShowForPlayer(playerid, AztecasZone,0x00FFFF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, AztecasZone);
    }

    if(IsPlayerInArea(playerid, 2121, 2607, -1970, -1571)) //Ballas1
    {
        GameTextForPlayer(playerid,"Ballas Territory",1000,1);
        GangZoneShowForPlayer(playerid, BallasZone1, 0x8080FF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, BallasZone1);
    }

    if(IsPlayerInArea(playerid, 2121, 2585, -1523, -1200)) //Ballas2
    {
        GameTextForPlayer(playerid,"Ballas Territory",1000,1);
        GangZoneShowForPlayer(playerid, BallasZone2, 0x8080FF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, BallasZone2);
    }

    if(IsPlayerInArea(playerid, 2630, 2893, -2234, -1050)) //Vagos1
    {
        GameTextForPlayer(playerid,"Vagos Territory",1000,1);
        GangZoneShowForPlayer(playerid, VagosZone1, 0xFFFF0096);
    }
    else
    {
        GangZoneHideForPlayer(playerid, VagosZone1);
    }

    if(IsPlayerInArea(playerid, 1969, 2790, -1121, -979)) //Vagos2
    {
        GameTextForPlayer(playerid,"Vagos Territory",1000,1);
        GangZoneShowForPlayer(playerid, VagosZone2, 0xFFFF0096);
    }
    else
    {
        GangZoneHideForPlayer(playerid, VagosZone2);
    }
The problems i check are:

I spawn in grove Street and i see the grove street territory, And everyother territory. When i'm in GS Territory i see the GameText of Ballas. And when i exit GS Area it disapear but when i change to balla it desapear too, the same happend in the other territoryes. What is wrong?

I have defined every Gangzone and i also have this

pawn Код:
IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}
More info added:

I have this on the Callback

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerInArea(playerid, 2220, 2607, -1970, -1571)) //Grove
    {
        GameTextForPlayer(playerid,"Grove Street Territory",1000,1);
        GangZoneShowForPlayer(playerid, GroveStreetZone, 0x00FF0081);
    }
    else
    {
        GangZoneHideForPlayer(playerid, GroveStreetZone);
    }

    if(IsPlayerInArea(playerid, 1832, 2166, -1748, -1141)) //Aztecas
    {
        GameTextForPlayer(playerid,"Aztecas Territory",1000,1);
        GangZoneShowForPlayer(playerid, AztecasZone,0x00FFFF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, AztecasZone);
    }

    if(IsPlayerInArea(playerid, 2121, 2607, -1970, -1571)) //Ballas1
    {
        GameTextForPlayer(playerid,"Ballas Territory",1000,1);
        GangZoneShowForPlayer(playerid, BallasZone1, 0x8080FF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, BallasZone1);
    }

    if(IsPlayerInArea(playerid, 2121, 2585, -1523, -1200)) //Ballas2
    {
        GameTextForPlayer(playerid,"Ballas Territory",1000,1);
        GangZoneShowForPlayer(playerid, BallasZone2, 0x8080FF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, BallasZone2);
    }

    if(IsPlayerInArea(playerid, 2630, 2893, -2234, -1050)) //Vagos1
    {
        GameTextForPlayer(playerid,"Vagos Territory",1000,1);
        GangZoneShowForPlayer(playerid, VagosZone1, 0xFFFF0096);
    }
    else
    {
        GangZoneHideForPlayer(playerid, VagosZone1);
    }

    if(IsPlayerInArea(playerid, 1969, 2790, -1121, -979)) //Vagos2
    {
        GameTextForPlayer(playerid,"Vagos Territory",1000,1);
        GangZoneShowForPlayer(playerid, VagosZone2, 0xFFFF0096);
    }
    else
    {
        GangZoneHideForPlayer(playerid, VagosZone2);
    }
   
    if(!IsPlayerConnected(playerid)) return 0;
    if(IsPlayerNPC(playerid)) return 1;

    if(GetPlayerInterior(playerid) == 17)
    {
        if(IsPlayerInRangeOfPoint(playerid,70.0,489.5824,-14.7563,1000.6797)) { // alhambra middle
            if(!GetPVarInt(playerid,"alhambra")) {
                SetPVarInt(playerid,"alhambra",1);
                PlayAudioStreamForPlayer(playerid, "https://dl-web.dropbox.com/get/sak%20noel%20-%20loca%20people%20%28la%20gente%20esta%20muy%20loca%29%20%5Bofficial%20videoclip%5D.mp3");
            }
        }
    }
    else
    {
        if(GetPVarInt(playerid,"alhambra"))
        {
            DeletePVar(playerid,"alhambra");
            StopAudioStreamForPlayer(playerid);
        }
    }

    return 1;
}
Reply
#2

I never worked on these actually, but reading a tutorial, I think you'd need a stock for the IsPlayerInArea.

Код:
IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
    new Float:X, Float:Y, Float:Z;

    GetPlayerPos(playerid, X, Y, Z);
    if(X >= MinX && X <= MaxX && Y >= MinY && Y <= MaxY) {
        return 1;
    }
    return 0;
}
Paste it on the bottom of the script. Also use [code] tags to display any code that you may have.

Cut it out from the OnPlayerUpdate...
Reply
#3

I'm using that High

PD: Thanks for answering fast
Reply
#4

Have you forwarded IsPlayerInArea? Like this...

Код:
forward IsPlayerInArea();
Paste your code into a following public...

Код:
public IsPlayerInArea()
Does that work?
Reply
#5

I change everything to this

pawn Код:
//forward IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY);

public IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY) //Line 5653
{
    if(IsPlayerInArea(playerid, 2220, 2607, -1970, -1571)) //Grove
    {
        GameTextForPlayer(playerid,"Grove Street Territory",1000,1);
        GangZoneShowForPlayer(playerid, GroveStreetZone, 0x00FF0081);
    }
    else
    {
        GangZoneHideForPlayer(playerid, GroveStreetZone);
    }

    if(IsPlayerInArea(playerid, 1832, 2166, -1748, -1141)) //Aztecas
    {
        GameTextForPlayer(playerid,"Aztecas Territory",1000,1);
        GangZoneShowForPlayer(playerid, AztecasZone,0x00FFFF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, AztecasZone);
    }

    if(IsPlayerInArea(playerid, 2121, 2607, -1970, -1571)) //Ballas1
    {
        GameTextForPlayer(playerid,"Ballas Territory",1000,1);
        GangZoneShowForPlayer(playerid, BallasZone1, 0x8080FF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, BallasZone1);
    }

    if(IsPlayerInArea(playerid, 2121, 2585, -1523, -1200)) //Ballas2
    {
        GameTextForPlayer(playerid,"Ballas Territory",1000,1);
        GangZoneShowForPlayer(playerid, BallasZone2, 0x8080FF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, BallasZone2);
    }

    if(IsPlayerInArea(playerid, 2630, 2893, -2234, -1050)) //Vagos1
    {
        GameTextForPlayer(playerid,"Vagos Territory",1000,1);
        GangZoneShowForPlayer(playerid, VagosZone1, 0xFFFF0096);
    }
    else
    {
        GangZoneHideForPlayer(playerid, VagosZone1);
    }

    if(IsPlayerInArea(playerid, 1969, 2790, -1121, -979)) //Vagos2
    {
        GameTextForPlayer(playerid,"Vagos Territory",1000,1);
        GangZoneShowForPlayer(playerid, VagosZone2, 0xFFFF0096);
    }
    else
    {
        GangZoneHideForPlayer(playerid, VagosZone2);
    }

    return 1;
}
And i get this Error

Код:
C:\Documents and Settings\Administrador\Escritorio\Juegos\Server 0.3d\gamemodes\RPG.pwn(5653) : warning 235: public function lacks forward declaration (symbol "IsPlayerInArea")
C:\Documents and Settings\Administrador\Escritorio\Juegos\Server 0.3d\gamemodes\RPG.pwn(5974) : error 025: function heading differs from prototype
C:\Documents and Settings\Administrador\Escritorio\Juegos\Server 0.3d\gamemodes\RPG.pwn(5975) : error 021: symbol already defined: "IsPlayerInArea"

Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
pawn Код:
IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy) //Line 5974
{ //Line 5975
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}
Reply
#6

First of all, uncomment the forward. Add stock before the function if you haven't so it looks like this.

Код:
stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy) 
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}
And I assume you have IsInPlayerArea defined somewhere again, Ctrl+F, search for it, and remove it.
Reply
#7

Now i have this

pawn Код:
forward IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY);

public IsPlayerInArea(playerid, Float:MinX, Float:MinY, Float:MaxX, Float:MaxY)
{
    if(IsPlayerInArea(playerid, 2220, 2607, -1970, -1571)) //Grove
    {
        GameTextForPlayer(playerid,"Grove Street Territory",1000,1);
        GangZoneShowForPlayer(playerid, GroveStreetZone, 0x00FF0081);
    }
    else
    {
        GangZoneHideForPlayer(playerid, GroveStreetZone);
    }

    if(IsPlayerInArea(playerid, 1832, 2166, -1748, -1141)) //Aztecas
    {
        GameTextForPlayer(playerid,"Aztecas Territory",1000,1);
        GangZoneShowForPlayer(playerid, AztecasZone,0x00FFFF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, AztecasZone);
    }

    if(IsPlayerInArea(playerid, 2121, 2607, -1970, -1571)) //Ballas1
    {
        GameTextForPlayer(playerid,"Ballas Territory",1000,1);
        GangZoneShowForPlayer(playerid, BallasZone1, 0x8080FF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, BallasZone1);
    }

    if(IsPlayerInArea(playerid, 2121, 2585, -1523, -1200)) //Ballas2
    {
        GameTextForPlayer(playerid,"Ballas Territory",1000,1);
        GangZoneShowForPlayer(playerid, BallasZone2, 0x8080FF96);
    }
    else
    {
        GangZoneHideForPlayer(playerid, BallasZone2);
    }

    if(IsPlayerInArea(playerid, 2630, 2893, -2234, -1050)) //Vagos1
    {
        GameTextForPlayer(playerid,"Vagos Territory",1000,1);
        GangZoneShowForPlayer(playerid, VagosZone1, 0xFFFF0096);
    }
    else
    {
        GangZoneHideForPlayer(playerid, VagosZone1);
    }

    if(IsPlayerInArea(playerid, 1969, 2790, -1121, -979)) //Vagos2
    {
        GameTextForPlayer(playerid,"Vagos Territory",1000,1);
        GangZoneShowForPlayer(playerid, VagosZone2, 0xFFFF0096);
    }
    else
    {
        GangZoneHideForPlayer(playerid, VagosZone2);
    }
   
    return 0;
}
And i do this

pawn Код:
/*stock IsPlayerInArea(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    if (x > minx && x < maxx && y > miny && y < maxy) return 1;
    return 0;
}
*/
And now i don't have any errors, or Warnings, but it isn't working, i pass by the areas and nothing happend.
Reply
#8

Because you've commented out the stock. You found another one? If you read "error 021: symbol already defined: "IsPlayerInArea", it clearly shows that the symbol is defined more than once. Check also your includes, these may have the stock in there.
Reply
#9

There i put it again, the same error and warning, and i check all include i can't find another one
Reply
#10

Ah, just noticed, use return 1; when closing the public instead of return 0;

Also, where are you placing your public and your stock? Best if you placed them at the bottom of the script, and they must be out of any other public, if you haven't done already so.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)