[FilterScript] Gang System DK
#13

It looks like you are thinking. I remade the script because it was bugged, very bugged. The founder left samp and so he didn't fixed bugs. And because it was very poor, I added more functions. This is better than the 2007. I prefer mine

PS: There are just one command DCMD. After this I checked with strcmp other commands

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(gang, 4, cmdtext);
    return 0;
}

//gang inizio
dcmd_gang(playerid, params[])
{
    new gcmd[16];
    if(sscanf(params, "s[16]", gcmd))
    {
        SendClientMessage(playerid, COLOR_ARANCIONE, "Use: /gang <Type>");
        SendClientMessage(playerid, COLOR_GIALLO, "_________________Gang System Commands_________________");
        SendClientMessage(playerid, COLOR_VERDE, "/gang info - Help the gang system");
        SendClientMessage(playerid, COLOR_VERDE, "/gang stats - Look at the details of the gang");
        SendClientMessage(playerid, COLOR_VERDE, "/gang list - Generate a list of gang created along with the gang info");
        SendClientMessage(playerid, COLOR_VERDE, "/gang create - Create a new gang");
        if(PlayerInfo[playerid][GangOwner] == true)
        {
            SendClientMessage(playerid, COLOR_VERDE, "/gang tag - Set tag for the gang");
            SendClientMessage(playerid, COLOR_VERDE, "/gang color - Select the color of the gang");
            SendClientMessage(playerid, COLOR_VERDE, "/gang kick - Kick a member of the gang");
            SendClientMessage(playerid, COLOR_VERDE, "/gang PaymentSet - Set the payday's percentage of a Member");
        }
        SendClientMessage(playerid, COLOR_VERDE, "/gang invite - Invites a player to enter the gang");
        SendClientMessage(playerid, COLOR_VERDE, "/gang join - Get into the gang to which you have been invited");
        SendClientMessage(playerid, COLOR_VERDE, "/gang leave - Leave the gang");
        SendClientMessage(playerid, COLOR_VERDE, "/gang PaymentList - See percentage of all member's payday");
        SendClientMessage(playerid, COLOR_GIALLO, "______________________________________________________");
        return 1;
    }
    if(strcmp("info", gcmd, true, sizeof(gcmd)) == 0)
    {
        SendClientMessage(playerid, COLOR_GIALLO, "_________________Tutorial Gang System_________________");
        SendClientMessage(playerid, COLOR_VERDE, "Conquest: In order to win GangZone must be at least 2");
        SendClientMessage(playerid, COLOR_VERDE, "Conquest: If the GangZone is not nobody takes 30 seconds if you are already conquered two minutes");
        SendClientMessage(playerid, COLOR_VERDE, "Earnings: Every conquest of GangZone receive Money");
        SendClientMessage(playerid, COLOR_VERDE, "Earnings: The founder may collect the revenues of the zones (money) and can spartirli, HE WANTS");
        SendClientMessage(playerid, COLOR_VERDE, "Earnings: Most areas have and the more money you'll get");
        SendClientMessage(playerid, COLOR_VERDE, "Withdrawal revenues: The founder may withdraw the revenues going into a Pickup ($ symbol)");
        SendClientMessage(playerid, COLOR_VERDE, "Withdrawal revenues: The Pickup can be found in all gangzone (PS: you can find inside interior sometimes");
        SendClientMessage(playerid, COLOR_VERDE, "Gang Chat: Each gang has its own chat, to use it just type '!' + Text (eg '! Let's win?')");
        SendClientMessage(playerid, COLOR_GIALLO, "______________________________________________________");
        return 1;
    }
    if(strcmp(gcmd, "create", true, sizeof(gcmd)) == 0)
    {
        if(PlayerInfo[playerid][GangID] != -1) return SendClientMessage(playerid, COLOR_VERDE, "You're already in a gang, use /gang leave to leave the gang");
        ShowPlayerDialog(playerid, DIALOG_GANGCREATE, DIALOG_STYLE_INPUT, "Gang Create", "Input the nome of your new gang", "Ok", "Cancel");
        return 1;
    }
    if(strcmp("tag", gcmd, true, sizeof(gcmd)) == 0)
    {
        if(PlayerInfo[playerid][GangID] == -1) return SendClientMessage(playerid, COLOR_ROSSO, "You aren't in any gang!");
        if(PlayerInfo[playerid][GangOwner] == false) return SendClientMessage(playerid, COLOR_ROSSO, "You need to be founder of the gang!");
        ShowPlayerDialog(playerid, DIALOG_GANGTAG, DIALOG_STYLE_INPUT, "Gang Tag", "Input the tag for your gang", "Ok", "Cancel");
        return 1;
    }
    if(strcmp("color", gcmd, true, sizeof(gcmd)) == 0)
    {
        if(PlayerInfo[playerid][GangID] == -1) return SendClientMessage(playerid, COLOR_ROSSO, "You aren't in any gang!");
        if(PlayerInfo[playerid][GangOwner] == false) return SendClientMessage(playerid, COLOR_ROSSO, "You need to be founder of the gang!");
        ShowPlayerDialog(playerid, DIALOG_GANGCOLOUR, DIALOG_STYLE_LIST, "Change Gang Color", "{FF0000}Red\n{9900FF}Fuchsia\n{0000FF}Blue\n{0066FF}Light Blue\n{00FF00}Green\n{00FF99}Water Green\n{FFFF00}Yellow\n{FF9900}Orange\n{663300}Brown\n{FF6666}Pink\n{9900FF}Salmon", "Ok", "Cancel");
        return 1;
    }
    if(strcmp("zone", gcmd, true, sizeof(gcmd)) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_VERDE, "You need to be admin RCon to use this command!");
        if(CreatingZone == false)
        {
            GetPlayerPos(playerid, ZonePos[0][0], ZonePos[0][1], ZonePos[0][2]);
            CreatingZone = true;
            SendClientMessage(playerid, COLOR_GIALLO, "Redo the command in the other side to terminate the creation");
        }
        else
        {
            CreatingZone = false;
            GetPlayerPos(playerid, ZonePos[1][0], ZonePos[1][1], ZonePos[1][2]);
            for(new zoneid = 1; zoneid <= MAX_ZONES; zoneid++) //inizio controllo degli ID liberi
            {
                new ZoneFile[255];
                format(ZoneFile,sizeof(ZoneFile),GangZoneFile, zoneid);
                if(!dini_Exists(ZoneFile))
                {
                    //salvataggio CFG
                    new cfgFile[255];
                    TotZone ++;
                    format(cfgFile,sizeof(cfgFile),GangCFGFile);
                    dini_Create(cfgFile);
                    dini_IntSet(cfgFile,"TotZone", TotZone);

                    //creazione zona
                    format(ZoneFile,sizeof(ZoneFile),GangZoneFile, zoneid);
                    dini_Create(ZoneFile);
                    dini_IntSet(ZoneFile,"ZoneID", zoneid);
                    dini_IntSet(ZoneFile,"OfGangID", -1);
                    if(ZonePos[0][0] < ZonePos[1][0])
                    {
                        dini_FloatSet(ZoneFile,"X1", ZonePos[0][0]);
                        dini_FloatSet(ZoneFile,"X2", ZonePos[1][0]);
                    }
                    else
                    {
                        dini_FloatSet(ZoneFile,"X1", ZonePos[1][0]);
                        dini_FloatSet(ZoneFile,"X2", ZonePos[0][0]);
                    }
                    if(ZonePos[0][1] < ZonePos[1][1])
                    {
                        dini_FloatSet(ZoneFile,"Y1", ZonePos[0][1]);
                        dini_FloatSet(ZoneFile,"Y2", ZonePos[1][1]);
                    }
                    else
                    {
                        dini_FloatSet(ZoneFile,"Y1", ZonePos[1][1]);
                        dini_FloatSet(ZoneFile,"Y2", ZonePos[0][1]);
                    }
                    ZoneInfo[zoneid][ID] = dini_Int(ZoneFile,"ZoneID");
                    ZoneInfo[zoneid][OfGangID] = dini_Int(ZoneFile,"OfGangID");
                    ZoneInfo[zoneid][PosX1] = dini_Float(ZoneFile,"X1");
                    ZoneInfo[zoneid][PosY1] = dini_Float(ZoneFile,"Y1");
                    ZoneInfo[zoneid][PosX2] = dini_Float(ZoneFile,"X2");
                    ZoneInfo[zoneid][PosY2] = dini_Float(ZoneFile,"Y2");

                    ZoneInfo[zoneid][GZID] = GangZoneCreate(ZoneInfo[zoneid][PosX1], ZoneInfo[zoneid][PosY1], ZoneInfo[zoneid][PosX2], ZoneInfo[zoneid][PosY2]);
                    if(ZoneInfo[zoneid][OfGangID] == -1)
                    {
                        GangZoneShowForAll(ZoneInfo[zoneid][GZID], GCOLOR_GRIGIO);
                    }
                    else
                    {
                        GangZoneShowForAll(ZoneInfo[zoneid][GZID], GangInfo[ZoneInfo[zoneid][OfGangID]][Color]);
                    }
                    ZoneInfo[zoneid][CKID] = CreateDynamicRectangle(ZoneInfo[zoneid][PosX1], ZoneInfo[zoneid][PosY1], ZoneInfo[zoneid][PosX2], ZoneInfo[zoneid][PosY2]);

                    //ferma il ciclo dopo la creazione gang
                    zoneid = MAX_ZONES;
                }
            }
        }
        return 1;
    }
    if(strcmp("pickup", gcmd, true, sizeof(gcmd)) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_VERDE, "You need to be admin RCon to use this command!");
        ShowPlayerDialog(playerid, DIALOG_GANGPICKUP, DIALOG_STYLE_INPUT, "PickUp Zone Create", "Input the ID of the zone to assign the Pickup", "Ok", "Cancel");
        return 1;
    }
    if(strcmp("stats", gcmd, true, sizeof(gcmd)) == 0)
    {
        new gangid = PlayerInfo[playerid][GangID];
        if(gangid == -1) return SendClientMessage(playerid, COLOR_ROSSO, "You aren't in any gang!");
        new GangFile[255];
        format(GangFile, sizeof(GangFile), GangIDFile, gangid);
        if(!dini_Exists(GangFile)) return SendClientMessage(playerid, COLOR_ROSSO, "Gang doesn't exist! Il founder will abandoned the gang...");
        new MembriOn = 0;
        for(new l = 0; l < MAX_PLAYERS; l++)
        {
            if(IsPlayerConnected(l) && PlayerInfo[l][GangID] == gangid) MembriOn ++;
        }

        new ZoneDellaGang = 0;
        new ZoneFile[255];
        for(new z = 0; z < MAX_ZONES; z++)
        {
            format(ZoneFile, sizeof(ZoneFile), GangZoneFile, z);
            if(dini_Exists(ZoneFile)) if(ZoneInfo[z][OfGangID] == gangid) ZoneDellaGang ++;
        }
        new strENG[255];
        format(strENG, sizeof(strENG), "ID: %d | Name: %s | Founder: %s | Conquired zones: %d | Online Members: %d", GangInfo[gangid][GangID], GangInfo[gangid][GangName], GangInfo[gangid][Owner], ZoneDellaGang, MembriOn);
        SendClientMessage(playerid, GangInfo[gangid][Color], strENG);
        return 1;
    }
    if(strcmp("invite", gcmd, true, sizeof(gcmd)) == 0)
    {
        if(PlayerInfo[playerid][GangID] == -1) return SendClientMessage(playerid, COLOR_ROSSO, "You aren't in any gang!");

        new gangid = PlayerInfo[playerid][GangID];
        if(GangInfo[gangid][Members] >= MAX_MEMBERS) return SendClientMessage(playerid, COLOR_ROSSO, "Gang reached maximum members");
        ShowPlayerDialog(playerid, DIALOG_GANGINVITE, DIALOG_STYLE_INPUT, "Gang Invite", "Insert the ID of the Player to invite", "Ok", "Cancel");
        return 1;
    }
    if(strcmp("join", gcmd, true, sizeof(gcmd)) == 0)
    {
        if(PlayerInfo[playerid][GangID] != -1) return SendClientMessage(playerid, COLOR_ROSSO, "Are you already part of a gang! Use / gang leave to leave the gang present");
        if(PlayerInfo[playerid][InvitedByGang] == -1) return SendClientMessage(playerid, COLOR_ROSSO, "You have no invitation gang");

        new gangid = PlayerInfo[playerid][InvitedByGang];
        if(GangInfo[gangid][Members] >= MAX_MEMBERS) return SendClientMessage(playerid, COLOR_ROSSO, "Gang reached maximum members");
        new GangFile[255], pName[MAX_PLAYER_NAME], strENG[255], SlotFile[255], slotid = CheckFreeGangSeat(gangid);
        GetPlayerName(playerid, pName, sizeof(pName));
       
        format(GangFile, sizeof(GangFile), GangIDFile, gangid);
        format(SlotFile, sizeof(SlotFile), "Member_%d", slotid);
       
        dini_Set(GangFile, SlotFile, pName);
        MemberInfo[gangid][slotid][Name] = dini_Get(GangFile, SlotFile);
       
        if(IsPlayerInAnyDynamicArea(playerid))
        {
            new zoneid = GetPlayerNumberDynamicAreas(playerid);
            Invaders[gangid][zoneid] ++;
            if(Invaders[gangid][zoneid] == MembersForConq)
            {
                for(new l = 0; l < MAX_PLAYERS; l++)
                {
                    if(IsPlayerConnected(l) && PlayerInfo[l][GangID] == gangid)
                    {
                        SendClientMessage(l, GangInfo[gangid][Color], "You are conquiring the zone");
                    }
                }
                GangZoneFlashForAll(ZoneInfo[zoneid][GZID], GangInfo[gangid][Color]);

                if(ZoneInfo[zoneid][OfGangID] != -1)
                {
                    GangTimer[gangid][zoneid] = SetTimerEx("ConquistaGZ", TimeForConq, false, "ii", zoneid, gangid);
                }
                else
                {
                    GangTimer[gangid][zoneid] = SetTimerEx("ConquistaGZ", TimeForConq/2, false, "ii", zoneid, gangid);
                }
                for(new l; l < MAX_PLAYERS; l++)
                {
                    if(IsPlayerConnected(l) && PlayerInfo[l][GangID] == ZoneInfo[zoneid][OfGangID] && PlayerInfo[playerid][GangID] != ZoneInfo[zoneid][OfGangID] && PlayerInfo[l][GangID] != -1)
                    {
                        SendClientMessage(l, GangInfo[ZoneInfo[zoneid][OfGangID]][Color], "Your zone is under attack!");
                    }
                }
            }
        }
       
        GangInfo[gangid][Members] ++;
        dini_IntSet(GangFile,"Members", GangInfo[gangid][Members]);

        format(strENG, sizeof(strENG), "%s (ID:%d) has joined the gang %s", pName, playerid, GangInfo[PlayerInfo[playerid][InvitedByGang]][GangName]);
        SendClientMessageToAll(GangInfo[gangid][Color], strENG);

        format(strENG, sizeof(strENG), "%s (ID:%d) has joined your gang", pName, playerid);
        for(new p = 0; p < MAX_PLAYERS; p++)
        {
            if(IsPlayerConnected(p) && PlayerInfo[p][GangID] == gangid) SendClientMessage(p, GangInfo[gangid][Color], strENG);
        }

        SetPlayerColor(playerid, GangInfo[gangid][Color]);

        PlayerInfo[playerid][GangID] = PlayerInfo[playerid][InvitedByGang];

        PlayerInfo[playerid][InvitedByGang] = -1;
        return 1;
    }
    if(strcmp("leave", gcmd, true, sizeof(gcmd)) == 0)
    {
        if(PlayerInfo[playerid][GangID] == -1) return SendClientMessage(playerid, COLOR_ROSSO, "You aren't in any gang!");
        new GangFile[255], SlotFile[255], NomeGang[255];
        new gangid = PlayerInfo[playerid][GangID];
        new strENG[255];

        if(IsPlayerInAnyDynamicArea(playerid))
        {
            new zoneid = GetPlayerNumberDynamicAreas(playerid);
            Invaders[gangid][zoneid] --;
            if(Invaders[gangid][zoneid] < MembersForConq)
            {
                KillTimer(GangTimer[gangid][zoneid]);
                GangZoneStopFlashForAll(ZoneInfo[zoneid][GZID]);
            }
        }

        if(PlayerInfo[playerid][GangOwner] == true)
        {
            format(strENG, sizeof(strENG), "The founder of the gang {FFFF00}'%s' {00FF00}has abandoned the gang. The gang has dissolved", GangInfo[gangid][GangName]);
            for(new p = 0; p < MAX_PLAYERS; p++)
            {
                if(IsPlayerConnected(p) && PlayerInfo[p][GangID] == gangid)
                {
                    SendClientMessage(p, COLOR_VERDE, strENG);
                }
            }

            for(new z = 1; z < MAX_ZONES; z++)
            {
                new ZoneFile[255];
                format(ZoneFile, sizeof(ZoneFile), GangZoneFile, z);
                if(dini_Exists(ZoneFile))
                {
                    if(ZoneInfo[z][OfGangID] == gangid)
                    {
                        for(new gvehicleid; gvehicleid < MAX_GVEHICLES; gvehicleid++) DestroyVehicle(GangVehicle[z][gvehicleid][VehID]);

                        dini_IntSet(ZoneFile,"OfGangID",-1);

                        ZoneInfo[z][OfGangID] = dini_Int(ZoneFile,"OfGangID");

                        GangZoneShowForAll(ZoneInfo[z][GZID], GCOLOR_GRIGIO);
                    }
                }
            }

            format(GangFile, sizeof(GangFile), GangIDFile, PlayerInfo[playerid][GangID]);
            if(dini_Exists(GangFile))
            {
                dini_Remove(GangFile);
            }
            PlayerInfo[playerid][GangOwner] = false;
        }
        else
        {
            new slotid = CheckGangPlayerSlot(gangid, playerid);
            format(GangFile, sizeof(GangFile), GangIDFile, gangid);
            format(SlotFile, sizeof(GangFile), "Member_%d", slotid);
            GangInfo[gangid][Members] --;
           
            dini_IntSet(GangFile,"Members", GangInfo[gangid][Members]);
            dini_Set(GangFile, SlotFile, "");
           
            MemberInfo[gangid][slotid][Name] = dini_Get(GangFile, SlotFile);

            format(GangFile, sizeof(GangFile), GangIDFile, PlayerInfo[playerid][GangID]);
            if(dini_Exists(GangFile))
            {
                NomeGang = dini_Get(GangFile,"Name");
            }
            format(strENG, sizeof(strENG), "You left the gang %s (ID:%d)", GangInfo[gangid][GangName], gangid);
            SendClientMessage(playerid, COLOR_VERDE, strENG);
        }
       
        PlayerInfo[playerid][GangID] = -1;
        PlayerInfo[playerid][GangOwner] = false;
        return 1;
    }
    if(strcmp("kick", gcmd, true, sizeof(gcmd)) == 0)
    {
        if(PlayerInfo[playerid][GangOwner] == false) return SendClientMessage(playerid, COLOR_ROSSO, "You need to be founder of the gang!");
        ShowPlayerDialog(playerid, DIALOG_GANGKICK, DIALOG_STYLE_INPUT, "Kick Player from Gang", "Input the ID of the player to kick by the Gang", "Ok", "Cancel");
        return 1;
    }
    if(strcmp("list", gcmd, true, sizeof(gcmd)) == 0)
    {
        SendClientMessage(playerid, COLOR_VERDE, "________________Gang List________________");
        for(new g = 0; g < MAX_GANGS; g++)
        {
            new GangFile[255], strENG[255];
            format(GangFile, sizeof(GangFile), GangIDFile, g);
            if(dini_Exists(GangFile))
            {
                new MembriOn = 0;
                for(new l = 0; l < MAX_PLAYERS; l++)
                {
                    if(IsPlayerConnected(l) && PlayerInfo[l][GangID] == g) MembriOn ++;
                }
                new ZoneDellaGang = 0;
                new ZoneFile[255];
                for(new z = 0; z < MAX_ZONES; z++)
                {
                    format(ZoneFile, sizeof(ZoneFile), GangZoneFile, z);
                    if(dini_Exists(ZoneFile)) if(ZoneInfo[z][OfGangID] == g) ZoneDellaGang ++;
                }

                format(strENG, sizeof(strENG), "ID: %d | Name: %s | Founder: %s | Conquired zones: %d | Members: %d | Online Members: %d", GangInfo[g][GangID], GangInfo[g][GangName], GangInfo[g][Owner], ZoneDellaGang, GangInfo[g][Members], MembriOn);
                SendClientMessage(playerid, GangInfo[g][Color], strENG);
            }
        }
        return 1;
    }

    if(strcmp("resetcash", gcmd, true, sizeof(gcmd)) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_VERDE, "You must be RCon Admin to use this command!");
        new ZoneFile[255];
        for(new zoneid = 1; zoneid <= MAX_ZONES; zoneid++)
        {
            format(ZoneFile, sizeof(ZoneFile), GangZoneFile, zoneid);
            if(dini_Exists(ZoneFile))
            {
                dini_IntSet(ZoneFile,"Cash", 0);

                ZoneInfo[zoneid][PickUpCash] = 0;

                new txt[50];
                format(txt, sizeof(txt), "Money\n%d$", ZoneInfo[zoneid][PickUpCash]);
                Update3DTextLabelText(ZoneInfo[zoneid][Label], COLOR_VERDE, txt);
            }
        }
        SendClientMessage(playerid, COLOR_VERDE, "Zones' zone resetted!");
        return 1;
    }
    if(strcmp("vehzone", gcmd, true, 7) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_ROSSO, "You need to be admin RCon to use this command!");
        new zoneid, gvehicleid;
        if(sscanf(params, "s[16]dd", gcmd, zoneid, gvehicleid)) return SendClientMessage(playerid, COLOR_ARANCIONE, "Use: /Gang Vehicle <zoneid> <slotvehicleid>");
        if(zoneid > MAX_ZONES || zoneid < 1) return SendClientMessage(playerid, COLOR_ROSSO, "Zone ID too large or small");
        if(gvehicleid >= MAX_GVEHICLES || gvehicleid < 0) return SendClientMessage(playerid, COLOR_ROSSO, "Vehicle slot too large or small");
        new Float: gvPos[3], Float: gvAngle;
        if(IsPlayerInAnyVehicle(playerid))
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            GetVehiclePos(vehicleid, gvPos[0], gvPos[1], gvPos[2]);
            GetVehicleZAngle(vehicleid, gvAngle);
        }
        else
        {
            GetPlayerPos(playerid, gvPos[0], gvPos[1], gvPos[2]);
            GetPlayerFacingAngle(playerid, gvAngle);
        }
        new ZoneFile[255], strX[16], strY[16], strZ[16], strAngle[16];
        format(ZoneFile, sizeof(ZoneFile), GangZoneFile, zoneid);
        format(strX, sizeof(strX), "Veh%d_X", gvehicleid);
        format(strY, sizeof(strY), "Veh%d_Y", gvehicleid);
        format(strZ, sizeof(strZ), "Veh%d_Z", gvehicleid);
        format(strAngle, sizeof(strAngle), "Veh%d_Ang", gvehicleid);
        dini_FloatSet(ZoneFile, strX, gvPos[0]);
        dini_FloatSet(ZoneFile, strY, gvPos[1]);
        dini_FloatSet(ZoneFile, strZ, gvPos[2]);
        dini_FloatSet(ZoneFile, strAngle, gvAngle);

        GangVehicle[zoneid][gvehicleid][PosX] = dini_Float(ZoneFile, strX);
        GangVehicle[zoneid][gvehicleid][PosY] = dini_Float(ZoneFile, strY);
        GangVehicle[zoneid][gvehicleid][PosZ] = dini_Float(ZoneFile, strZ);
        GangVehicle[zoneid][gvehicleid][Angle] = dini_Float(ZoneFile, strAngle);
       
        new strENG[128];
        format(strENG, sizeof(strENG), "vPosX: %0.02f | vPosY: %0.02f | vPosZ: %0.02f | vAng: %0.02f", GangVehicle[zoneid][gvehicleid][PosX], GangVehicle[zoneid][gvehicleid][PosY], GangVehicle[zoneid][gvehicleid][PosZ], GangVehicle[zoneid][gvehicleid][Angle]);
        SendClientMessage(playerid, COLOR_VERDE, strENG);

        DestroyVehicle(GangVehicle[zoneid][gvehicleid][VehID]);

        if(ZoneInfo[zoneid][OfGangID] != -1)
        {
            new gangid = ZoneInfo[zoneid][OfGangID], gPlate[8];
            if(GangInfo[gangid][VehModel] >= 400 && GangInfo[gangid][VehModel] <= 611)
            {
                new vehiclemodel = GangInfo[gangid][VehModel], col1 = GangInfo[gangid][VehCol1], col2 = GangInfo[gangid][VehCol2];
                GangVehicle[zoneid][gvehicleid][VehID] = CreateVehicle(vehiclemodel, GangVehicle[zoneid][gvehicleid][PosX], GangVehicle[zoneid][gvehicleid][PosY], GangVehicle[zoneid][gvehicleid][PosZ], GangVehicle[zoneid][gvehicleid][Angle], col1, col2, 1800000);
                format(gPlate, sizeof(gPlate), "[%s]-%d", GangInfo[gangid][Tag], gvehicleid);
                SetVehicleNumberPlate(GangVehicle[zoneid][gvehicleid][VehID], gPlate);
            }
        }

        format(strENG, sizeof(strENG), "Zone ID: %d | Vehicle Slot: %d", zoneid, gvehicleid);
        SendClientMessage(playerid, COLOR_VERDE, strENG);
        return 1;
    }
   
    if(strcmp("paymentlist", gcmd, true, 11) == 0)
    {
        if(PlayerInfo[playerid][GangID] == -1) return SendClientMessage(playerid, COLOR_ROSSO, "You aren't in any gang!");
        if(PlayerInfo[playerid][GangOwner] == false) return SendClientMessage(playerid, COLOR_ROSSO, "You need to be founder of the gang!");
        new strENG[512], gangid = PlayerInfo[playerid][GangID], PerCentRemain, strTitle[128];
        format(strENG, sizeof(strENG), "Member Name\tPercentage\n");
        for(new slotid; slotid < MAX_MEMBERS; slotid++)
        {
            if(strlen(MemberInfo[gangid][slotid][Name]) > 1) format(strENG, sizeof(strENG), "%s{00FF00}%s\t%d/100\n", strENG, MemberInfo[gangid][slotid][Name], MemberInfo[gangid][slotid][Percentage]);
            else format(strENG, sizeof(strENG), "%s{FF0000}<Empty>\t%d/100\n", strENG, MemberInfo[gangid][slotid][Name], MemberInfo[gangid][slotid][Percentage]);
            PerCentRemain += MemberInfo[gangid][slotid][Percentage];
        }
       
        PerCentRemain = 100 - PerCentRemain;
        format(strTitle, sizeof(strTitle), "Payment (%d/100 percentage Remains) Gang's Bank: $%d", PerCentRemain, GangInfo[gangid][Bank]);
        ShowPlayerDialog(playerid, DIALOG_PAYMENT, DIALOG_STYLE_TABLIST_HEADERS, strTitle, strENG, "Select", "Exit");
        return 1;
    }
   
    if(strcmp("paymentset", gcmd, true, 10) == 0)
    {
        if(PlayerInfo[playerid][GangID] == -1) return SendClientMessage(playerid, COLOR_ROSSO, "You aren't in any gang!");
        if(PlayerInfo[playerid][GangOwner] == false) return SendClientMessage(playerid, COLOR_ROSSO, "You need to be founder of the gang!");
        new pName[MAX_PLAYER_NAME], UserPay;
        if(sscanf(params, "s[16]s[MAX_PLAYER_NAME]d", gcmd, pName, UserPay)) return SendClientMessage(playerid, COLOR_ARANCIONE, "Use: /Gang PaymentSet <NickName> <Percentage>");
        new GangFile[255], gangid = PlayerInfo[playerid][GangID], SlotFile[255], slotid;
        format(GangFile, sizeof(GangFile), GangIDFile, gangid);
        if(IsNumeric(pName))
        {
            new UserID = strval(pName);
            if(!IsPlayerConnected(UserID)) return SendClientMessage(playerid, COLOR_ROSSO, "The player is not connected");
            slotid = CheckGangPlayerSlot(gangid, UserID);
           
        }
        else slotid = CheckGangPlayerNameSlot(gangid, pName);
       
        format(SlotFile, sizeof(SlotFile), "MemberCash_%d", slotid);
        dini_IntSet(GangFile, SlotFile, UserPay);
        MemberInfo[gangid][slotid][Percentage] = dini_Int(GangFile, SlotFile);
        return 1;
    }

    if(strcmp("vehicle", gcmd, true, 7) == 0)
    {
        if(PlayerInfo[playerid][GangID] == -1) return SendClientMessage(playerid, COLOR_ROSSO, "You aren't in any gang!");
        if(PlayerInfo[playerid][GangOwner] == false) return SendClientMessage(playerid, COLOR_ROSSO, "You need to be founder of the gang!");
        new modelid, col1, col2;
        if(sscanf(params, "s[16]ddd", gcmd, modelid, col1, col2)) return SendClientMessage(playerid, COLOR_ARANCIONE, "Use: /gang vehicle <modelid> <Color1> <Color2>");
        if(modelid < 400 || modelid > 611) return SendClientMessage(playerid, COLOR_ROSSO, "Use numbers from 400 to 611");
        new GangFile[255], gangid = PlayerInfo[playerid][GangID];
        format(GangFile, sizeof(GangFile), GangIDFile, gangid);
        dini_IntSet(GangFile, "VehModel", modelid);
        dini_IntSet(GangFile, "VehCol1", col1);
        dini_IntSet(GangFile, "VehCol2", col2);

        GangInfo[gangid][VehModel] = dini_Int(GangFile, "VehModel");
        GangInfo[gangid][VehCol1] = dini_Int(GangFile, "VehCol1");
        GangInfo[gangid][VehCol2] = dini_Int(GangFile, "VehCol2");
       
        new strENG[128];
        format(strENG, sizeof(strENG), "You setted %s (Model: %d) (Color 1: %d | Color 2: %d) as gang vehicle", VehicleNames[GangInfo[gangid][VehModel]-400], GangInfo[gangid][VehModel], GangInfo[gangid][VehCol1], GangInfo[gangid][VehCol2]);
        SendClientMessage(playerid, GangInfo[gangid][Color], strENG);

        for(new zoneid = 1; zoneid < MAX_ZONES; zoneid++)
        {
            if(ZoneInfo[zoneid][PosX1] != 0 && ZoneInfo[zoneid][OfGangID] == gangid)
            {
                new gPlate[8];
                for(new gvehicleid; gvehicleid < MAX_GVEHICLES; gvehicleid++)
                {
                    DestroyVehicle(GangVehicle[zoneid][gvehicleid][VehID]);
                    if(GangVehicle[zoneid][gvehicleid][PosX] != 0)
                    {
                        GangVehicle[zoneid][gvehicleid][VehID] = CreateVehicle(GangInfo[gangid][VehModel], GangVehicle[zoneid][gvehicleid][PosX], GangVehicle[zoneid][gvehicleid][PosY], GangVehicle[zoneid][gvehicleid][PosZ], GangVehicle[zoneid][gvehicleid][Angle], GangInfo[gangid][VehCol1], GangInfo[gangid][VehCol2], 1800000);
                        format(gPlate, sizeof(gPlate), "[%s]-%d", GangInfo[gangid][Tag], gvehicleid);
                        SetVehicleNumberPlate(GangVehicle[zoneid][gvehicleid][VehID], gPlate);
                    }
                }
            }
        }
        return 1;
    }

    return SendClientMessage(playerid, COLOR_ROSSO, "[Gang]Unknown gang command: type /gang to see all gang's commands");
}
About too many dini... yes, but it is to update the Gang and Zones Stats, About user saving are just in OnPlayerConnect and Disconnect
Reply


Messages In This Thread
Gang System DK - by DarK_FeneR - 08.01.2016, 18:15
Re: Gang System DK - by Zikoo - 08.01.2016, 18:37
Re: Gang System DK - by Infinity - 08.01.2016, 21:13
Re: Gang System DK - by DarK_FeneR - 09.01.2016, 00:24
Re: Gang System DK - by Bolex_ - 09.01.2016, 13:40
Re: Gang System DK - by DarK_FeneR - 09.01.2016, 18:00
Re: Gang System DK - by DarK_FeneR - 21.03.2016, 12:38
Re: Gang System DK - by Roozevelt - 21.03.2016, 13:04
Re: Gang System DK - by DarK_FeneR - 21.03.2016, 13:42
Re: Gang System DK - by Roozevelt - 21.03.2016, 13:57
Re: Gang System DK - by Pottus - 21.03.2016, 14:24
Re: Gang System DK - by DarK_FeneR - 21.03.2016, 14:49
Re: Gang System DK - by DarK_FeneR - 21.03.2016, 14:53
Re: Gang System DK - by DarK_FeneR - 21.03.2016, 15:25
Re: Gang System DK - by Roozevelt - 21.03.2016, 15:48
Re: Gang System DK - by DarK_FeneR - 21.03.2016, 16:14
Re: Gang System DK - by jazzyKISS - 21.03.2016, 17:07
Re: Gang System DK - by DarK_FeneR - 21.03.2016, 17:20
Re: Gang System DK - by Roozevelt - 22.03.2016, 19:22
Re: Gang System DK - by DarK_FeneR - 22.03.2016, 20:10
Re: Gang System DK - by JamalMaddox - 23.03.2016, 06:32
Re: Gang System DK - by DarK_FeneR - 24.03.2016, 12:09
Re: Gang System DK - by Roozevelt - 25.03.2016, 20:30
Re: Gang System DK - by DarK_FeneR - 26.03.2016, 12:06
Re: Gang System DK - by XSharkX - 26.03.2016, 21:37
Re: Gang System DK - by DarK_FeneR - 29.05.2016, 15:52
Re: Gang System DK - by Roozevelt - 30.05.2016, 07:37
Re: Gang System DK - by Tommyx3 - 30.05.2016, 11:05
Re: Gang System DK - by DarK_FeneR - 30.05.2016, 22:47
Re: Gang System DK - by shourya12 - 31.05.2016, 04:25
Re: Gang System DK - by DarK_FeneR - 31.05.2016, 17:08
Re: Gang System DK - by Romero837 - 15.08.2016, 22:30
Re: Gang System DK - by XHunterZ - 15.08.2016, 23:44
Re: Gang System DK - by Mozzarela - 25.04.2018, 08:05

Forum Jump:


Users browsing this thread: 2 Guest(s)