Combining gangzones with families
#4

Yeah, I want to create a gangzone system which is captureable by the dynamic families.. I have a point system implented, could I possibly add the turfs to that system?

Point sys:
pawn Код:
enum pointInfo
{
    pName[32],
    pTime,
    pOwner,
    Float:pX,
    Float:pY,
    Float:pZ,
    pProfit,
    pPickup,
    Text3D:pText
}
new PointInfo[MAX_POINTS][pointInfo];

stock SavePoints()
{
    new idx = 0, File:file;
    new string[256];
    while(idx < MAX_POINTS)
    {
        format(string, sizeof(string), "%s|%d|%d|%f|%f|%f|%d\r\n",
        PointInfo[idx][pName],
        PointInfo[idx][pTime],
        PointInfo[idx][pOwner],
        PointInfo[idx][pX],
        PointInfo[idx][pY],
        PointInfo[idx][pZ],
        PointInfo[idx][pProfit]);
        if(idx == 0)
        {
            file = fopen("points.cfg", io_write);
        }
        else
        {
            file = fopen("points.cfg", io_append);
        }
        fwrite(file, string);
        fclose(file);
        idx++;
    }
    print("Points saved successfully.");
}

stock LoadPoints()
{
    new dinfo[7][128];
    new string[256];
    new File:file = fopen("points.cfg", io_read);
    if(file)
    {
        new idx = 0;
        while(idx < MAX_POINTS)
        {
            fread(file, string);
            split(string, dinfo, '|');
            format(PointInfo[idx][pName], 32, "%s", dinfo[0]);
            PointInfo[idx][pTime] = strval(dinfo[1]);
            PointInfo[idx][pOwner] = strval(dinfo[2]);
            PointInfo[idx][pX] = floatstr(dinfo[3]);
            PointInfo[idx][pY] = floatstr(dinfo[4]);
            PointInfo[idx][pZ] = floatstr(dinfo[5]);
            PointInfo[idx][pProfit] = strval(dinfo[6]);
            if(!PointInfo[idx][pTime]) // If point time is 0
            {
                DestroyDynamicPickup(PointInfo[idx][pPickup]);
                DestroyDynamic3DTextLabel(PointInfo[idx][pText]);
                PointInfo[idx][pProfit] = 0;
                PointInfo[idx][pText] = CreateDynamic3DTextLabel("Point\n/capture", COLOR_WHITE, PointInfo[idx][pX], PointInfo[idx][pY], PointInfo[idx][pZ]+0.3, 15);
                format(string, sizeof(string), "The {00FF00}%s {FF6347}is available to be captured.", PointInfo[idx][pName]);
                SendClientMessageToAll(COLOR_LIGHTRED, string);
            }
            idx++;
        }
    }
    print("Points loaded successfully.");
    return 1;
}


Point capture:
pawn Код:
CMD:capture(playerid, params[])
{
    new string[128], done;
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(PlayerInfo[playerid][pFamRank] < 5) return SendClientMessage(playerid, COLOR_GREY, "You are not a family leader.");
    for(new idx = 0; idx < MAX_POINTS; idx++)
    {
        if(IsPlayerInRangeOfPoint(playerid, 1, PointInfo[idx][pX], PointInfo[idx][pY], PointInfo[idx][pZ]))
        {
            if(PointInfo[idx][pTime] > 1) return SendClientMessage(playerid, COLOR_GREY, "Please wait for the point time to cool down.");
            if(Capturing) return SendClientMessage(playerid, COLOR_GREY, "Please wait for the point capturing to cool down.");
            format(string, sizeof(string), " %s is attempting to capture the %s.", RPN(playerid), PointInfo[idx][pName]);
            SendNearbyMessage(playerid, 30, string, COLOR_ORANGE, COLOR_ORANGE, COLOR_ORANGE, COLOR_ORANGE, COLOR_ORANGE);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "Stay in your position for 10 seconds to make the capture attempt succeed.");
            Capturing = 1;
            GetPlayerPos(playerid, Capture[0], Capture[1], Capture[2]);
            Capturer = playerid;
            CapturerFam = idx;
            SetTimerEx("CapturePoint", 10000, false, "dd", Capturer, CapturerFam);
            done = 1;
            break;
        }
    }
    if(!done) SendClientMessage(playerid, COLOR_GREY, "You are not near a capturable point.");
    return 1;
}

The point system is combined with the family system...
Reply


Messages In This Thread
Combining gangzones with families - by Zens - 08.06.2014, 15:45
Re: Combining gangzones with families - by icra - 08.06.2014, 16:18
Re: Combining gangzones with families - by Laure - 08.06.2014, 16:28
Re: Combining gangzones with families - by Zens - 08.06.2014, 16:38
Re: Combining gangzones with families - by iFarbod - 08.06.2014, 16:47
Re: Combining gangzones with families - by Zens - 08.06.2014, 17:36
Re: Combining gangzones with families - by Zens - 11.06.2014, 20:12
Re: Combining gangzones with families - by MacT - 11.06.2014, 21:30

Forum Jump:


Users browsing this thread: 1 Guest(s)