IsPlayerInArea
#1

Hello, i have i problem with the capture zones system that i made,

http://pastebin.com/DEscECvD

i did when i do the command /clan capture its will start only if there are three members from clan in area
i think IsPlayerInArea didn't worked, because i did when a player is in area its up the value of the variable
and if the variable value is lower than 3 the capture cant start, and its not give me to start even if i have 7 players in area from my clan,

sorry for my english,
please help
Reply
#2

Give this a shot:
pawn Код:
else if(!strcmp(Option, "Capture", true))
    {
        if(pInfo[playerid][Clan] == -1) return SendClientMessage(playerid, 0x989898FF, "[ERROR]: !аъд ма бчмап");
        if(pInfo[playerid][ClanLevel] < 4) return SendClientMessage(playerid, 0x989898FF, "[ERROR]: шч сврй мйгш еотмд оешщйн мбцт фчегд жаъ");
        if(!ServerData[CaptureAreas]) return SendClientMessage(playerid, 0x989898FF, "[ERROR]: айрк роца бажеш бц'чфейри щм лбйщд");
        new bool:found = false;
        for(new i = 0; i < ServerData[CaptureAreas]; i++)
        {
            if(IsPlayerInDynamicCP(playerid, CaptureData[i][CheckPoint]))
            {
                found = true;
                if(CaptureData[i][ClanCapturing] > -1) return SendClientMessage(playerid, 0x989898FF, "[ERROR]: ажеш лбйщд жд лбш орсйн млбещ");
                new CCount;
                for(new j = 0, g = GetPlayerPoolSize(); j <= g; j++)
                {
                    if(!IsPlayerConnected(j) || !pInfo[j][IsLogged]) continue;
                    if(pInfo[j][Clan] != pInfo[playerid][Clan]) continue;
                    if(IsPlayerInArea(j, CaptureData[i][GZMinX], CaptureData[i][GZMinY], CaptureData[i][GZMaxX], CaptureData[i][GZMaxY])) CCount++;
                }
                if(CCount < 3) return SendClientMessage(playerid, 0x989898FF, "[ERROR]: айп осфйч щзчрйн одчмап тм оръ млбещ, мфзеъ 3");
                new Text[144];
                CaptureData[i][ClanCapturing] = pInfo[playerid][Clan];
                GangZoneFlashForAll(CaptureData[i][GangZone], pInfo[UserData[playerid][Clan]][CColor]);
                CaptureAreaCountDown(pInfo[playerid][Clan], i, 180);
                format(Text, sizeof(Text), "•> {D9DAF2}дзм дщъмиеъ тм ажеш длбйщд: {B03060}%s {%06x}%s {D9DAF2}дчмап", CaptureData[i][AreaName], ClanData[pInfo[playerid][Clan]][CColor] >>> 8, ClanData[UserDpInfota[playerid][Clan]][ClanName]);
                SendClientMessageToAll(0xB03060FF, Text);
            }
        }
        if(!found) return SendClientMessage(playerid, 0x989898FF, "[ERROR]: айрк роца бажеш бц'чфейри щм лбйщд");
    }
I doubt it was an issue with your IsPlayerInArea, but here's my version if you want to try it:
pawn Код:
// At the top of your script
bool:IsPlayerInArea(playerid, Float:minx, Float:miny, Float:maxx, Float:maxy)
{
    if(!IsPlayerConnected(playerid)) return false;
    new Float:var, Float:playerposx, Float:playerposy;
    if(minx > maxx)
    {
        var = minx;
        minx = maxx;
        maxx = var;
    }
    if(miny > maxy)
    {
        var = miny;
        miny = maxy;
        maxy = var;
    }
    GetPlayerPos(playerid, playerposx, playerposy, var);
    if(minx <= playerposx <= maxx && miny <= playerposy <= maxy) return true;
    return false;
}
Reply
#3

thank you very much man
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)