Clan Commands Filterscript.
#1

i just download this clan fs https://sampforum.blast.hk/showthread.php?tid=401152
the guy there is asking the same question.
where can i create a .ini file for the clans?
so, they can be saved?
Reply
#2

heres the whole script

pawn Код:
// Clan System by COD
// Credits : COD For Scripting , Kitten For help on the commands

#include <a_samp>

// Defines
#define MAX_SAVE            70
#define MAX_CLANS           70 // Change this to amount of the clans you want to have to be created
#define MAX_CLAN_MEMBERS    20 // Change this to amount of members can be in your clan system
#define MAX_CLAN_NAME       16 // Amount of letters for Clan to create cant be longer than that

// Color Defines
#define COLOR_ORANGE 0xF97804FF
#define COLOR_WHITE  0xFFFFFFAA
#define COLOR_YELLOW 0xDABB3EAA
#define COLOR_GREEN 0x21DD00FF
#define COLOR_PINK 0xFFC0CBAA
#define COLOR_BLACK 0x000000FF
#define COLOR_RED 0xE60000FF

// Variables
new clanMembers[MAX_CLANS][MAX_CLAN_MEMBERS];
new clanNames[MAX_CLANS][MAX_CLAN_NAME];
new clanInfo[MAX_CLANS][3]; //0 created 1-members 2 color
new playerclan[MAX_PLAYERS];
new clanInvite[MAX_PLAYERS];
new playerColors[100] = {
0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,0xEE82EEFF,0xFFD720FF,
0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,
0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,
0x275222FF,0xF09F5BFF,0x3D0A4FFF,0x22F767FF,0xD63034FF,0x9A6980FF,0xDFB935FF,0x3793FAFF,0x90239DFF,0xE9AB2FFF,0xAF2FF3FF,
0x057F94FF,0xB98519FF,0x388EEAFF,0x028151FF,0xA55043FF,0x0DE018FF,0x93AB1CFF,0x95BAF0FF,0x369976FF,0x18F71FFF,0x4B8987FF,
0x491B9EFF,0x829DC7FF,0xBCE635FF,0xCEA6DFFF,0x20D4ADFF,0x2D74FDFF,0x3C1C0DFF,0x12D6D4FF,0x48C000FF,0x2A51E2FF,0xE3AC12FF,
0xFC42A8FF,0x2FC827FF,0x1A30BFFF,0xB740C2FF,0x42ACF5FF,0x2FD9DEFF,0xFAFB71FF,0x05D1CDFF,0xC471BDFF,0x94436EFF,0xC1F7ECFF,
0xCE79EEFF,0xBD1EF2FF,0x93B7E4FF,0x3214AAFF,0x184D3BFF,0xAE4B99FF,0x7E49D7FF,0x4C436EFF,0xFA24CCFF,0xCE76BEFF,0xA04E0AFF,
0x9F945CFF,0xDCDE3DFF,0x10C9C5FF,0x70524DFF,0x0BE472FF,0x8A2CD7FF,0x6152C2FF,0xCF72A9FF,0xE59338FF,0xEEDC2DFF,0xD8C762FF,
0x3FE65CFF
};

// Forwards
forward PlayerLeaveClan(playerid);

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Clan System Loaded");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    print("\n--------------------------------------");
    print(" Clan System Unloaded");
    print("--------------------------------------\n");
    return 1;
}


public PlayerLeaveClan(playerid) {
    new string[256];
    new playername[MAX_PLAYER_NAME];
    new clannum = playerclan[playerid];

    if(clannum > 0) {
        for(new i = 0; i < clanInfo[clannum][1]; i++) {
            if(clanMembers[clannum][i]==playerid) {
                clanInfo[clannum][1]--;
                for(new j = i; j < clanInfo[clannum][1]; j++) {
                    clanMembers[clannum][j]=clanMembers[clannum][j+1];
                }
                if(clanInfo[clannum][1]<1) {
                    clanInfo[clannum][0]=0;
                    clanInfo[clannum][1]=0;
                }
                for(new j = 0; j < clanInfo[clannum][1]; j++) {
                    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
                    format(string, sizeof(string),"%s has quit your clan.", playername);
                    SendClientMessage(clanMembers[clannum][j], COLOR_ORANGE, string);
                }

                format(string, sizeof(string),"You have quit the clan '%s' (id: %d)", clanNames[clannum], clannum);
                SendClientMessage(playerid, COLOR_ORANGE, string);
                playerclan[playerid]=0;
                SetPlayerColor(playerid,playerColors[playerid]);
                return;
            }
        }
    } else {
        SendClientMessage(playerid, COLOR_RED, "You are not in a clan.");
    }
}

public OnPlayerDisconnect(playerid, reason)
{
    PlayerLeaveClan(playerid);
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new string[256];
    new sendername[MAX_PLAYER_NAME];
    new giveplayer[MAX_PLAYER_NAME];
    new cmd[256];
    new giveplayerid , idx;
    cmd = strtok(cmdtext, idx);

    if(strcmp(cmd, "/commands", true) == 0) {
        SendClientMessage(playerid, COLOR_YELLOW,"/clan create [name]");
        SendClientMessage(playerid, COLOR_YELLOW,"/clan join");
        SendClientMessage(playerid, COLOR_YELLOW,"/clan invite [playerID]");
        SendClientMessage(playerid, COLOR_YELLOW,"/clan quit");
        SendClientMessage(playerid, COLOR_YELLOW,"/claninfo [number]");
        SendClientMessage(playerid, COLOR_YELLOW,"/clans - Displays the current clans");
        return 1;
    }

    if(strcmp(cmd, "/clan", true) == 0) {
        new tmp[256];
        new clancmd, clannum;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp)) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [create/join/invite/quit] [name/number]");
            return 1;
        }
        giveplayerid = strval(tmp);

        if(strcmp(tmp, "create", true)==0)
            clancmd = 1;
        else if(strcmp(tmp, "invite", true)==0)
            clancmd = 2;
        else if(strcmp(tmp, "join", true)==0)
            clancmd = 3;
        else if(strcmp(tmp, "quit", true)==0)
            clancmd = 4;

        tmp = strtok(cmdtext, idx);
        if(clancmd < 3 && !strlen(tmp)) {
            if(clancmd==0)
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [create/join/invite/quit] [name/number]");
            else if(clancmd==1)
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [create] [name]");
            else if(clancmd==2)
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /clan [invite] [playerID]");
            return 1;
        }
        if(clancmd==1) {
            if(playerclan[playerid]>0) {
                SendClientMessage(playerid, COLOR_RED, "You are already in a clan!");
                return 1;
            }

            for(new i = 1; i < MAX_CLANS; i++) {
                if(clanInfo[i][0]==0) {
                    format(clanNames[i], MAX_CLAN_NAME, "%s", tmp);
                    clanInfo[i][0]=1;
                    clanInfo[i][1]=1;
                    clanInfo[i][2]=playerColors[playerid];
                    clanMembers[i][0] = playerid;
                    format(string, sizeof(string),"You have created the clan '%s' (id: %d)", clanNames[i], i);
                    SendClientMessage(playerid, COLOR_GREEN, string);

                    playerclan[playerid]=i;

                    return 1;
                }
            }

            return 1;
        } else if (clancmd==3) {
            clannum = clanInvite[playerid];

            if(playerclan[playerid]>0) {
                SendClientMessage(playerid, COLOR_RED, "You are already in a clan!");
                return 1;
            }
            if(clanInvite[playerid]==0) {
                SendClientMessage(playerid, COLOR_RED, "You have not been invited to a clan.");
                return 1;
            }
            if(clanInfo[clannum][0]==0) {
                SendClientMessage(playerid, COLOR_RED, "That clan does not exist!");
                return 1;
            }

            if(clanInfo[clannum][1] < MAX_CLAN_MEMBERS) {
                new i = clanInfo[clannum][1];

                clanInvite[playerid]=0;

                clanMembers[clannum][i] = playerid;

                GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
                for(new j = 0; j < clanInfo[clannum][1]; j++) {
                    format(string, sizeof(string),"%s has joined your clan.", sendername);
                    SendClientMessage(clanMembers[clannum][j], COLOR_ORANGE, string);
                }

                clanInfo[clannum][1]++;
                playerclan[playerid] = clannum;

                SetPlayerColor(playerid,clanInfo[clannum][2]);

                format(string, sizeof(string),"You have joined the clan '%s' (id: %d)", clanNames[clannum], clannum);
                SendClientMessage(playerid, COLOR_GREEN, string);

                return 1;
            }

            SendClientMessage(playerid, COLOR_RED, "That clan is full.");
            return 1;
        } else if (clancmd==2) {
            giveplayerid = strval(tmp);

            if(playerclan[playerid]==0) {
                SendClientMessage(playerid, COLOR_RED, "You are not in a clan!");
                return 1;
            }

            if(IsPlayerConnected(giveplayerid)) {
                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                GetPlayerName(playerid, sendername, sizeof(sendername));

                format(string, sizeof(string),"You have sent a clan invite to %s.", giveplayer);
                SendClientMessage(playerid, COLOR_GREEN, string);
                format(string, sizeof(string),"You have recieved a clan invite from %s to '%s' (id: %d)", sendername, clanNames[playerclan[playerid]],playerclan[playerid]);
                SendClientMessage(giveplayerid, COLOR_GREEN, string);

                clanInvite[giveplayerid]=playerclan[playerid];

            } else
                SendClientMessage(playerid, COLOR_RED, "No such player exists!");

        } else if (clancmd==4) {
            PlayerLeaveClan(playerid);
        }
        return 1;
    }

    if(strcmp(cmd, "/claninfo", true) == 0) {
        new tmp[256];
        new clannum;
        tmp = strtok(cmdtext, idx);

        if(!strlen(tmp) && playerclan[playerid]==0) {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /claninfo [number]");
            return 1;
        } else if (!strlen(tmp))
            clannum = playerclan[playerid];
        else
            clannum = strval(tmp);

        if(clanInfo[clannum][0]==0) {
            SendClientMessage(playerid, COLOR_RED, "No such clan exists!");
            return 1;
        }

        format(string, sizeof(string),"'%s' clan Members (id: %d)", clanNames[clannum], clannum);
        SendClientMessage(playerid, COLOR_GREEN, string);

        for(new i = 0; i < clanInfo[clannum][1]; i++) {
            GetPlayerName(clanMembers[clannum][i], giveplayer, sizeof(giveplayer));
            format(string, sizeof(string),"%s (%d)", giveplayer, clanMembers[clannum][i]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }
        return 1;
    }

    if(strcmp(cmd, "/clans", true) == 0)
    {
        new x;

        SendClientMessage(playerid, COLOR_GREEN, "Current clan:");
        for(new i=0; i < MAX_CLANS; i++) {
            if(clanInfo[i][0]==1) {
                format(string, sizeof(string), "%s%s(%d) - %d members", string,clanNames[i],i,clanInfo[i][1]);

                x++;
                if(x > 2) {
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    x = 0;
                    format(string, sizeof(string), "");
                } else {
                    format(string, sizeof(string), "%s, ", string);
                }
            }
        }

        if(x <= 2 && x > 0) {
            string[strlen(string)-2] = '.';
            SendClientMessage(playerid, COLOR_YELLOW, string);
        }
        return 1;
    }
    return 0;
}

strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Reply
#3

plz help guys!
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=390214 here is something..
#define Path "/Gang/%s.ini" //this create file plays and .ini file with gang name.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)