[Help] Gangzones
#6

Quote:
Originally Posted by CutX
Посмотреть сообщение
//EDIT: forgot to change the params of the control structure from wiki in my first post, sorry! fixed that by now


well, you don't really have to #define it. You can write comments to the area lines in the switch of the function
but yeah, that's how it works

also, just coded that, in case you need to get a area id:
pawn Код:
stock GetAreaID(playerid)
{
    new Float:p[3],Float:ap[4],areaid;
    GetPlayerPos(playerid, p[0], p[1], p[2]);
    for(new i=0; i<3; i++)//loop for the areas you've defined, it's 3 here. ( 0.. 1.. 2)
    {
        switch(i)
        {
            case 0: ap[0] = 1212.34234, ap[1] = 234.123, ap[2] = -111.222, ap[3] = 213.44;
            case 1: ap[0] = 1212.34234, ap[1] = 234.123, ap[2] = -111.222, ap[3] = 213.44;
            case 2: ap[0] = 1212.34234, ap[1] = 234.123, ap[2] = -111.222, ap[3] = 213.44;
            //and so on, add your areas...
        }
        if(p[0] <= ap[0] && p[0] >= ap[1] && p[1] <= ap[2] && p[1] >= ap[3]) return i;//return the area-id
    }
    return -1;//failed, player is not in a area defined by you, returning 0. But... 0 is an area id too, we'll just go with -1 i guess
}
pawn Код:
CMD:claimturf(playerid)
{
if(IsInArea(playerid,0))
{
    SendClientMessage(playerid, COLOR_NEWBIE, "This is the Wang Family's home turf, you can not /claimturf here!");
}
else if(IsInArea(playerid,1))
{
    GangZoneFlashForAll(GangZone1, COLOR_WHITE);
    SetTimerEx("GangZoneTimer", 300000, false, "i", playerid);
}
else if(IsInArea(playerid,2))
{
    GangZoneFlashForAll(GangZone2, COLOR_WHITE);
    SetTimerEx("GangZoneTimer", 300000, false, "i", playerid);
}
return 1;
}
So, after it starts the timer, it needs to finish obviously:

pawn Код:
public GangZoneTimer(playerid)
{
    return 1;
}
What would I use to check if any Gang[playerid] = 1 members were in the area, Would I use
pawn Код:
for (new i; i < MAX_PLAYERS; i++)
if(IsInArea(i, areaid)
or would I use something different?
Reply


Messages In This Thread
[Help] Gangzones - by BornHuman - 21.01.2014, 18:27
Re: [Help] Gangzones - by Ace155 - 21.01.2014, 18:33
Re: [Help] Gangzones - by CutX - 21.01.2014, 18:38
Re: [Help] Gangzones - by BornHuman - 21.01.2014, 18:47
Re: [Help] Gangzones - by CutX - 21.01.2014, 18:57
Re: [Help] Gangzones - by BornHuman - 21.01.2014, 19:03
Re: [Help] Gangzones - by CutX - 21.01.2014, 19:15
Re: [Help] Gangzones - by BornHuman - 21.01.2014, 19:33

Forum Jump:


Users browsing this thread: 2 Guest(s)