problem with save info
#1

hi to all dears and friends
i downloaded a clan system from here
and use it on my server
it work good
but it has a problem
when player create clan and disconnect clan will save and when player relog to server he has his clan
but when i turn off the server and again turn on it all clans will destroy
can somebody help me?
ty
Reply
#2

Can you please paste the code?
Reply
#3

yes sure
PHP код:
//Group filterscript by [HiC]TheKiller - Scripted because Weponz wanted it and I was bored :P.
//Friday 5 August 2011 - Saturday 6 August 2011.
#include <a_samp> 
#include <zcmd> // https://sampforum.blast.hk/showthread.ph...5.60344976
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//Variables
#define MAX_GROUPS 100 // Change this if you think you are going to ever have over 100 groups.
new PLAYERLIST_authed[MAX_PLAYERS];
enum ginfo
{
    
grname[75],
    
leader,
    
active
};
enum pginfo
{
    
gid,
    
order,
    
invited,
    
attemptjoin
};
new 
group[MAX_PLAYERS][pginfo];
new 
groupinfo[MAX_GROUPS][ginfo];
public 
OnFilterScriptInit()
{
    for(new 
xx<MAX_PLAYERSx++)
    {
        
group[x][gid] = -1;
        
group[x][order] = -1;
        
group[x][invited] = -1;
        
group[x][attemptjoin] = -1;
    }
    print(
"  Clan Commands !  ");
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if(
PLAYERLIST_authed[playerid] == 1)
    {
        
dUserSet(PlayerName(playerid)).("Clan",group[playerid]);
        }
    return 
1;
}
COMMAND:clan(playeridparams[])
{
      if(
group[playerid][gid] != -1) return SendClientMessage(playerid0xFF0000"Dar Hale Hazer Shoma Dar Clani Hastid Va Nemitavanid Clan Besazid !");
      if(
strlen(params) > 49 || strlen(params) < 3) return SendClientMessage(playerid0xFF0000"TariQe Estefade : /Clan [Name]");
    if(
IsGroupTaken(params)) return SendClientMessage(playerid0xFF0000"In Name Qablan Sabt Shode ASt !");
    if(
GetPlayerMoney(playerid) < 20000000) return SendClientMessage(playerid0xFF0000"Shoma MablaQ $20000000 Baraye Sakht Clan Nadarid !");
    if(
GetPlayerScore(playerid) < 250) return SendClientMessage(playerid0xFF0000"Baraye Sakht Clan Shoma Niyaz Be 250 Score Darid !");
    
CreateGroup(paramsplayerid);
    
GivePlayerMoney(playerid,-20000000);
      return 
1;
}
COMMAND:khoruj(playeridparams[])
{
    if(
group[playerid][gid] == -1) return SendClientMessage(playerid0xFF0000"Shoma Dar Hich Clani Nistid !");
     
LeaveGroup(playerid0);
     return 
1;
}
COMMAND:davat(playeridparams[])
{
    if(
group[playerid][order] != 1) return SendClientMessage(playerid0xFF0000"Shoma Leader clan Nistid Va Nemitavanid Kasi Ra Invite Dahid !");
    new 
cid;
    if(
isnull(params)) return SendClientMessage(playerid0xFF0000"TariQe Estefade : /Davat [ID]");
    
cid strval(params);
    if(!
IsPlayerConnected(cid)) return SendClientMessage(playerid0xFF0000"In Player Dar Server Nist !");
    if(
group[cid][gid] == group[playerid][gid]) return SendClientMessage(playerid0xFF0000"In Player Hamaknon Dar Clan Shoma Mibashad !");
     if(
group[cid][invited] == group[playerid][gid]) return SendClientMessage(playerid0xFF0000"Player Be Clan Shoma Davat Shode ASt !");
    if(
group[cid][attemptjoin] == group[playerid][gid]) return GroupJoin(cidgroup[playerid][gid]);
    
group[cid][invited] = group[playerid][gid];
     new 
string[125], pname[24];
     
GetPlayerName(playeridpname24);
     
format(stringsizeof(string), "Shoma Be Clan {FFFFFF}%s(%d){FFCC66} TavaSote Leader/Co Leader {FFFFFF}%s(%d) Davat Shodid !. /Join %d"groupinfo[group[playerid][gid]][grname], group[playerid][gid], pnameplayeridgroup[playerid][gid]);
    
SendClientMessage(cid0xFFCC66string);
     
GetPlayerName(cidpname24);
    
format(stringsizeof(string), "Shoma Player {FFFFFF}%s(%d){FFCC66} Ra Be Clane Khod Davat Kardid !"pnamecid);
    
SendClientMessage(playerid0xFFCC66string);
     return 
1;
}
COMMAND:cleader(playeridparams[])
{
    if(
group[playerid][order] != 1) return SendClientMessage(playerid0xFF0000"Shoma Leader Clan Nistid Va Nemitavanid Az In CMD Estefade Konid !");
    new 
cid;
    if(
isnull(params)) return SendClientMessage(playerid0xFF0000"TariQe Estefade : /CLeader [ID]");
    
cid strval(params);
    if(!
IsPlayerConnected(cid)) return SendClientMessage(playerid0xFF0000"In Player Dar Server Nist !");
    if(
cid == playerid)  return SendClientMessage(playerid0xFF0000"Shoma Leader Clan Hastid :|");
    if(
group[playerid][gid] != group[cid][gid]) return SendClientMessage(playerid0xFF0000"In Player Dar Clan Shoma Nist !");
    
ChangeMemberOrder(group[playerid][gid], 1);
    
group[playerid][order] = GroupMembers(group[playerid][gid]);
    return 
1;
}
COMMAND:join(playeridparams[])
{
    if(
group[playerid][gid] != -1) return SendClientMessage(playerid0xFF0000"Shoma Hamaknon Dar Yek Clan Hastid Aval Az Clan Kharej Shid Sepas Be Clan Jadid Join Shid !");
    new 
grid;
    if( (
isnull(params) && group[playerid][invited] != -) || ( strval(params) == group[playerid][invited] && group[playerid][invited] != -1) ) return GroupJoin(playeridgroup[playerid][invited]);
    if(
isnull(params)) return SendClientMessage(playerid0xFF0000"TariQe Estefade : {FFFFFF}/groupjoin{FF0000} (groupid)");
    
grid strval(params);
    if(!
groupinfo[grid][active]) return SendClientMessage(playerid0xFF0000"Clani Ke Shoma Mikhayd Dar An Join Shid Vojod Nadarad !");
    
group[playerid][attemptjoin] = grid;
    new 
string[125], pname[24];
    
GetPlayerName(playeridpname24);
    
format(stringsizeof(string), "Shoma Darkhast Join Be Clan Darid ! ~~> %s(ID:%d)"groupinfo[grid][grname], grid);
    
SendClientMessage(playerid0xFFCC66string);
    
format(stringsizeof(string), "{FFFFFF}%s(%d) {FFCC66} Darkhast Join Be Clane Shomara Darad Az CMD Estefade Konid ! ~~> /Joim %d to accept"pnameplayeridplayerid);
    
SendMessageToLeader(gridstring);
    return 
1;
}
COMMAND:ekhraj(playeridparams[])
{
    if(
group[playerid][order] != 1) return SendClientMessage(playerid0xFF0000"Shoma Leader Clan Nistid Va Nemitavanid Kasi Ra KiCk Konid !");
    new 
cid;
    if(
isnull(params)) return SendClientMessage(playerid0xFF0000"Usage: {FFFFFF}/Ekhraj{FF0000} [ID]");
    
cid strval(params);
    if(!
IsPlayerConnected(cid)) return SendClientMessage(playerid0xFF0000"In Player Dar Server Nist !");
    if(
cid == playerid)  return SendClientMessage(playerid0xFF0000"Shoma Nemitavanid Khodetan Ra Az Clan KiCk Konid :|");
    if(
group[playerid][gid] != group[cid][gid]) return SendClientMessage(playerid0xFF0000"In Player Dar Clan Shoma Nist !");
    
LeaveGroup(cid1);
    return 
1;
}
COMMAND:c(playeridparams[])
{
    if(
group[playerid][gid] == -1) return SendClientMessage(playerid0xFF0000"Shoma Dar HiCh Clani Nistid Va Nemitavanid Az In CMD Estefade Konid !");
    if(
isnull(params)) return SendClientMessage(playerid0xFF0000"TariQe Estefade : {FFFFFF}/C{FF0000} [Text]");
    new 
pname[24], string[140+24];
    
GetPlayerName(playeridpname24);
    
format(stringsizeof(string), "{00FF00}[Clan Chat] {00FFFF}%s(%d): {00FF00}%s"pnameplayeridparams);
    
SendMessageToAllGroupMembers(group[playerid][gid], string);
    return 
1;
}
COMMAND:clanlist(playeridparams[])
{
    if(
isnull(params) && group[playerid][gid] == -1) return SendClientMessage(playerid0xFF0000"TariQe Estefade : {FFFFFF}/ClanList{FF0000} (group)");
    if(
isnull(params))
    {
         
DisplayGroupMembers(group[playerid][gid], playerid);
           return 
1;
    }
     new 
grid strval(params);
      if(!
groupinfo[grid][active]) return SendClientMessage(playerid0xFF0000"ID Clani Ke Shoma Vared Kardid Vojod Nadarad !");
       
DisplayGroupMembers(gridplayerid);
    return 
1;
}
COMMAND:clans(playeridparams[])
{
    
ListGroups(playerid);
    return 
1;
}
COMMAND:grl(playeridparams[])
    return 
cmd_khoruj(playeridparams);
COMMAND:grc(playeridparams[])
    return 
cmd_clan(playeridparams);
    
COMMAND:gri(playeridparams[])
    return 
cmd_davat(playeridparams);
COMMAND:grlead(playeridparams[])
    return 
cmd_cleader(playeridparams);
    
COMMAND:grj(playeridparams[])
    return 
cmd_join(playeridparams);
COMMAND:grk(playeridparams[])
    return 
cmd_ekhraj(playeridparams);
COMMAND:gm(playeridparams[])
    return 
cmd_c(playeridparams);
    
COMMAND:grlist(playeridparams[])
    return 
cmd_clanlist(playeridparams);
    
stock DisplayGroupMembers(groupidplayerid)
{
    new 
amount[2], string[200], shortstr[55], pname[24];
    
format(stringsizeof(string), "Group Members for %s(ID:%d)"groupinfo[groupid][grname], groupid);
    
SendClientMessage(playerid0xFFFFFFstring);
    
string "";
    for(new 
xx<MAX_PLAYERSx++)
    {
        if(
group[x][gid] == groupid)
        {
            
amount[0] ++;
            
amount[1] ++;
            
GetPlayerName(xpname24);
            if(
groupinfo[groupid][leader] != xformat(shortstrsizeof(shortstr), "%s(%d),"pnamex);
            if(
groupinfo[groupid][leader] == xformat(shortstrsizeof(shortstr), "[LEADER]%s(%d),"pnamex);
            if(
amount[1] == 1format(stringsizeof(string), "%s"shortstr);
            if(
amount[1] != 1format(stringsizeof(string), "%s %s"stringshortstr);
            if(
amount[0] == 6)
            {
                
strdel(stringstrlen(string)-1strlen(string));
                
SendClientMessage(playerid0xFFCC66string);
                
string "";
                
amount[0] = 0;
            }
        }
    }
    
strdel(stringstrlen(string)-1strlen(string));
    if(
amount[0] != 0SendClientMessage(playerid0xFFCC66string);
    return 
1;
}
stock ListGroups(playerid)
{
    new 
amount[2], string[200], shortstr[55];
    
SendClientMessage(playerid0xFFFFFF"Current groups:");
    for(new 
x=0x<MAX_GROUPSx++)
    {
        if(
groupinfo[x][active])
        {
             
amount[0] ++;
             
amount[1] ++;
             
format(shortstrsizeof(shortstr), "%s(ID:%d)"groupinfo[x][grname], x);
            if(
amount[1] == 1format(stringsizeof(string), "%s"shortstr);
            if(
amount[1] != 1format(stringsizeof(string), "%s %s"stringshortstr);
            if(
amount[0] == 4)
            {
                
SendClientMessage(playerid0xFFCC66string);
                
string "";
                
amount[0] = 0;
            }
        }
    }
    if(
amount[1] == 0SendClientMessage(playerid0xFFFF00"There are currently no active groups!");
    if(
amount[1] != 0SendClientMessage(playerid0xFFCC66string);
    return 
1;
}
stock SendMessageToLeader(groupimessage[])
    return 
SendClientMessage(groupinfo[groupi][leader], 0xFFCC66message);
stock GroupJoin(playeridgroupi)
{
    
group[playerid][gid] = groupi;
    
group[playerid][order] = GroupMembers(groupi);
    
group[playerid][attemptjoin] = -1;
    
group[playerid][invited] = -1;
    new 
pname[24], string[130];
    
GetPlayerName(playeridpname24);
    
format(stringsizeof(string), "%s Be Clan Shoma Join Shod !"pname);
    
SendMessageToAllGroupMembers(groupistring);
    
format(stringsizeof(string), "Shoma Be Clan %s(ID:%d) Join Shodid !"groupinfo[groupi][grname] ,groupi);
    
SendClientMessage(playerid0xFFCC66string);
    return 
1;
}
stock FindNextSlot()
{
    new 
id;
    while(
groupinfo[id][active]) id ++;
    return 
id;
}
stock IsGroupTaken(grpname[])
{
    for(new 
xx<MAX_GROUPSx++) if(!strcmp(grpnamegroupinfo[x][grname], true) && strlen(groupinfo[x][grname]) != && groupinfo[x][active] == 1) return 1;
    return 
0;
}
stock GroupInvite(playeridgroupid)
    return 
group[playerid][invited] = groupid;
stock CreateGroup(grpname[], owner)
{
    new 
slotid FindNextSlot();
    
groupinfo[slotid][leader] = owner;
    
format(groupinfo[slotid][grname], 75"%s"grpname);
    
groupinfo[slotid][active] = 1;
    
group[owner][gid] = slotid;
    
group[owner][order] = 1;
    new 
string[120];
    
format(stringsizeof(string), "{FF00FF}Shoma Clan {00FFFF}%s(ID:%d) {FF00FF} Ra Sakhtid !"grpnameslotid);
    
SendClientMessage(owner0xFFCC66string);
    return 
slotid;
}
stock LeaveGroup(playeridreason)
{
    new 
groupid group[playerid][gid], orderid group[playerid][order], string[100], pname[24];
    
group[playerid][gid] = -1;
    
group[playerid][order] = -1;
    
GroupCheck(groupidorderid);
    
GetPlayerName(playeridpname24);
    if(
reason == 0)
    {
         
format(stringsizeof(string), "{FFFFFF}%s(%d){FFCC66} Az Clan Shoma Kharej Shod !"pnameplayerid);
         
SendClientMessage(playerid0xFFCC66"Shoma Az Clanetan Kharej Shodid !");
     }
    if(
reason == 1)
    {
        
format(stringsizeof(string), "{FFFFFF}%s(%d){FFCC66} Az Clan Shoma KiCk Shod !"pnameplayerid);
        
SendClientMessage(playerid0xFFCC66"Shoma Az Clan KiCk Shodid !");
    }
    if(
reason == 2format(stringsizeof(string), "{FFFFFF}%s(%d){FFCC66} Az Clan Shoma Kharej Shod !"pnameplayerid);
    
SendMessageToAllGroupMembers(groupidstring);
    return 
1;
}
stock GroupCheck(groupidorderid)
{
    new 
gmems GroupMembers(groupid);
    if(!
gmemsgroupinfo[groupid][active] = 0;
    if(
gmems != 0ChangeMemberOrder(groupidorderid);
    return 
1;
}
stock GroupMembers(groupid)
{
    if(!
groupinfo[groupid][active]) return 0;
    new 
groupmembers;
    for(new 
ii<MAX_PLAYERSi++) if(group[i][gid] == groupidgroupmembers++;
    return 
groupmembers;
}
stock ChangeMemberOrder(groupidorderid)
{
    for(new 
xx<MAX_PLAYERSx++)
    {
        if(
group[x][gid] != groupid || group[x][order] < orderid) continue;
        
group[x][order] --;
        if(
group[x][order] == 1)
        {
            
groupinfo[groupid][leader] = x;
            new 
string[128], pname[24];
            
GetPlayerName(xpname24);
            
format(stringsizeof(string), "{FFFFFF}%s(%d){FFCC66} Be Onvan Leader Jadid Clan Entekhab Shod"pnamex);
            
SendMessageToAllGroupMembers(groupidstring);
        }
    }
    return 
1;
}
stock SendMessageToAllGroupMembers(groupidmessage[])
{
    if(!
groupinfo[groupid][active]) return 0;
    for(new 
xx<MAX_PLAYERSx++) if(group[x][gid] == groupidSendClientMessage(x0xFFCC66message);
    return 
1;

Reply
#4

Please Help Me
i need it
ty
Reply
#5

up______________
Help Pls (
Reply
#6

You need to create a code to save the values (You can use ini, dini, mysql, and more to make this)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)