09.04.2011, 11:23
Hi,
I have founded some gangs script in old GM. Everything works fine but if I shut down or restart server all created gangs disapear.
So, maybe someone can help me to find way to saved them?
there's that script:
I have founded some gangs script in old GM. Everything works fine but if I shut down or restart server all created gangs disapear.
So, maybe someone can help me to find way to saved them?
there's that script:
pawn Код:
#define MAX_GANGS 200
enum giitem
{
ganame[128],
leader[MAX_PLAYER_NAME],
members,
gfondas,
Float:bustine[3],
bool:invited[MAX_PLAYERS],
bool:isgang
};
enum gitems
{
pgang,
bool:islead
};
new gangDB[MAX_GANGS][giitem];
new gplayerDB[MAX_PLAYERS][gitems];
forward UnInvite(gang,playerid);
pawn Код:
CMD:uzdaryti(playerid, params[])
{
if(gplayerDB[playerid][pgang] != -1)
{
if(gplayerDB[playerid][islead])
{
new msg[128];
format(msg,sizeof(msg),"Gauja \"%s\" uzdaryta.",gangDB[gplayerDB[playerid][pgang]][ganame]);
SendClientMessage(playerid,GANG_COLOR,msg);
gangDB[gplayerDB[playerid][pgang]][isgang]=false;
gplayerDB[playerid][pgang]=-1;
gplayerDB[playerid][islead]=false;
for(new player=0;player<MAX_PLAYERS; player++)
{
if(IsPlayerConnected(player) && gplayerDB[player][pgang] == gplayerDB[playerid][pgang] && player != playerid)
{
gplayerDB[player][pgang]=-1;
SendClientMessage(playerid,GANG_COLOR,"* Jusu gauja buvo uzdaryta. Dabar jus nepriklausote jokiai gaujai.");
Delete3DTextLabel(gaujos[playerid]);
}
}
}
}
return 1;
}
CMD:clead(playerid, params[])
{
if(gplayerDB[playerid][pgang] != -1)
{
if(gplayerDB[playerid][islead])
{
new id;
if( sscanf( params, "u", id))
return SendClientMessage( playerid, ZALSVA, ">> Paskirti nauju gaujos lyderiu: /clead [dalis nicko]");
if(id==INVALID_PLAYER_ID)
{
SendClientMessage(playerid,ELEKTRO, ">> Tokio zaidejo nera");
return 1;
}
if(gplayerDB[id][pgang] != gplayerDB[playerid][pgang])
{
SendClientMessage(playerid,GANG_COLOR,"* Zaidejas ne jusu gaujoje.");
return 1;
}
new pname[MAX_PLAYER_NAME],msg[128],string[128];
GetPlayerName(id,pname,sizeof(pname));
format(msg,sizeof(msg),"Paskyrete %s i gaujos lyderio pozicija.",pname);
SendClientMessage(playerid,GANG_COLOR,msg);
format(msg,sizeof(msg),"Jus esate paskirtas gaujos \"%s\" lyderiu. Sveikiname!.",gangDB[gplayerDB[playerid][pgang]][ganame]);
SendClientMessage(id,GANG_COLOR,msg);
gplayerDB[playerid][islead]=false;
gplayerDB[id][islead]=true;
strmid(gangDB[gplayerDB[playerid][pgang]][leader],pname,0,MAX_PLAYER_NAME,MAX_PLAYER_NAME);
format(string,sizeof(string),"%s",gangDB[gplayerDB[playerid][pgang]][ganame]);
gaujos[playerid] = Create3DTextLabel(string,SILVER,30.0,40.0,50.0,40.0,0);
Delete3DTextLabel(gaujos[playerid]);
Attach3DTextLabelToPlayer(gaujos[playerid], id, 0.0, 0.0, 0.5);
}
}
return 1;
}
CMD:gkick(playerid, params[])
{
if(gplayerDB[playerid][pgang] != -1)
{
if(gplayerDB[playerid][islead])
{
new id;
if( sscanf( params, "u", id))
return SendClientMessage( playerid, ZALSVA, ">> ismesti id gaujos: /gkick [dalis nicko]");
if(id==INVALID_PLAYER_ID)
{
SendClientMessage(playerid,ELEKTRO, ">> Tokio zaidejo nera");
return 1;
}
new pname[MAX_PLAYER_NAME],msg[128];
GetPlayerName(id,pname,sizeof(pname));
format(msg,sizeof(msg),"Ismetete %s is \"%s\".",pname,gangDB[gplayerDB[playerid][pgang]][ganame]);
SendClientMessage(playerid,GANG_COLOR,msg);
format(msg,sizeof(msg),"Jus ismestas is \"%s\".",gangDB[gplayerDB[playerid][pgang]][ganame]);
SendClientMessage(id,GANG_COLOR,msg);
format(msg,sizeof(msg),"%s buvo ismestas is \"%s\".",pname,gangDB[gplayerDB[playerid][pgang]][ganame]);
SendMessageToGM(gplayerDB[playerid][pgang],GANG_COLOR,msg);
gplayerDB[id][pgang]=-1;
Delete3DTextLabel(gaujos[playerid]);
gangDB[gplayerDB[id][pgang]][members]--;
}
}
return 1;
}
CMD:gkviest(playerid, params[])
{
if(gplayerDB[playerid][pgang] != -1)
{
if(gplayerDB[playerid][islead])
{
new id;
if( sscanf( params, "u", id))
return SendClientMessage( playerid, ZALSVA, ">> Pakviesti i gauja: /gkviest [dalis nicko]");
if(id==INVALID_PLAYER_ID)
{
SendClientMessage(playerid,ELEKTRO, ">> Tokio zaidejo nera");
return 1;
}
if(gplayerDB[id][pgang] != -1)
{
SendClientMessage(playerid,GANG_COLOR,"* Zaidejas jau gaujoje.");
return 1;
}
if(gangDB[gplayerDB[playerid][pgang]][invited][id])
{
SendClientMessage(playerid,GANG_COLOR,"* Zaidejas jau pakviestas.");
return 1;
}
new pname[MAX_PLAYER_NAME],msg[128];
GetPlayerName(id,pname,sizeof(pname));
format(msg,sizeof(msg),"Kvieciate %s i \"%s\". Kvietimas galios 5 min.",pname,gangDB[gplayerDB[playerid][pgang]][ganame]);
SendClientMessage(playerid,GANG_COLOR,msg);
format(msg,sizeof(msg),"Jus kvieciamas \"%s\" gauja. Istoti galite su: /istoti %i",gangDB[gplayerDB[playerid][pgang]][ganame],gplayerDB[playerid][pgang]+1);
SendClientMessage(id,GANG_COLOR,msg);
gangDB[gplayerDB[playerid][pgang]][invited][id]=true;
SetTimerEx("UnInvite",300000,false,"ii",gplayerDB[playerid][pgang],playerid);
}
}
return 1;
}
CMD:palikti(playerid, params[])
{
if(gplayerDB[playerid][pgang] != -1)
{
if(gplayerDB[playerid][islead])
{
SendClientMessage(playerid,GANG_COLOR,"* Jus esate gaujos vadas, negalite palikti gaujos.");
return 1;
}
new msg[128];
format(msg,sizeof(msg),"Palikote \"%s\".",gangDB[gplayerDB[playerid][pgang]][ganame]);
SendClientMessage(playerid,GANG_COLOR,msg);
gangDB[gplayerDB[playerid][pgang]][members]--;
gplayerDB[playerid][pgang]=-1;
Delete3DTextLabel(gaujos[playerid]);
}
return 1;
}
CMD:c(playerid, params[])
{
if(gplayerDB[playerid][pgang] != -1)
{
new fraze[230];
if( sscanf( params, "s[256]", fraze))
return SendClientMessage( playerid, ZALSVA, ">> Gaujos chatas: /c [tekstas]");
new zin[256],vardas[MAX_PLAYER_NAME];
GetPlayerName(playerid,vardas,MAX_PLAYER_NAME);
format(zin,sizeof(zin),"[GAUJA]%s: %s",vardas,fraze);
SendMessageToGM(gplayerDB[playerid][pgang],MELSVA,zin);
}
return 1;
}
CMD:istoti(playerid, params[])
{
new tid, id;
if( sscanf( params, "i", tid))
return SendClientMessage( playerid, ZALSVA, ">> Istoti i gauja: /istoti [id]");
id = tid - 1;
if(id >= MAX_GANGS)
{
SendClientMessage(playerid,GANG_COLOR,"* Tokios gaujos nera.");
return 1;
}
if(!gangDB[id][isgang])
{
SendClientMessage(playerid,GANG_COLOR,"* Tokios gaujos nera.");
return 1;
}
if(!gangDB[id][invited][playerid])
{
SendClientMessage(playerid,GANG_COLOR,"* I sia gauja jus ne(be)kvieciamas.");
return 1;
}
new msg[128],pname[MAX_PLAYER_NAME],string[128];
format(msg,sizeof(msg),"Kvietimas priimtas. Sveikinu istojus i \"%s\".",gangDB[id][ganame]);
SendClientMessage(playerid,GANG_COLOR,msg);
GetPlayerName(playerid,pname,sizeof(pname));
format(msg,sizeof(msg),"%s ka tik istojo i musu gauja: \"%s\".",pname,gangDB[id][ganame]);
SendMessageToGM(id,GANG_COLOR,msg);
gangDB[id][members]++;
gplayerDB[playerid][pgang]=id;
format(string,sizeof(string),"%s",gangDB[gplayerDB[playerid][pgang]][ganame]);
gaujos[playerid] = Create3DTextLabel(string,SILVER,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(gaujos[playerid],playerid, 0.0, 0.0, 0.5);
gplayerDB[playerid][islead]=false;
gangDB[id][invited][playerid]=false;
return 1;
}
CMD:cgang(playerid, params[])
{
if(gplayerDB[playerid][pgang] != -1)
{
SendClientMessage(playerid,GANG_COLOR,"* Jus jau priklausote gaujai. Naujos kurti negalite.");
return 1;
}
new gauja[56];
if( sscanf( params, "s[128]", gauja))
return SendClientMessage( playerid, ZALSVA, ">> Sukurti gauja: /cgang [pavadinimas]");
for(new i=0; i<MAX_GANGS; i++)
{
if(!gangDB[i][isgang])
{
new pname[MAX_PLAYER_NAME],msg[128],string[128];
GetPlayerName(playerid,pname,sizeof(pname));
strmid(gangDB[i][leader],pname,0,MAX_PLAYER_NAME,MAX_PLAYER_NAME);
strmid(gangDB[i][ganame],gauja,0,MAX_PLAYER_NAME,MAX_PLAYER_NAME);
gangDB[i][isgang]=true;
gangDB[i][members]=1;
gplayerDB[playerid][pgang]=i;
gplayerDB[playerid][islead]=true;
GetPlayerPos(playerid,gangDB[i][bustine][0],gangDB[i][bustine][1],gangDB[i][bustine][2]);
format(msg,sizeof(msg),"Gauja pavadinimu: \"%s\" sukurta. Jusu bustine yra cia.",gauja);
SendClientMessage(playerid,GANG_COLOR,msg);
format(string,sizeof(string),"%s",gangDB[gplayerDB[playerid][pgang]][ganame]);
gaujos[playerid] = Create3DTextLabel(string,SILVER,30.0,40.0,50.0,40.0,0);
Attach3DTextLabelToPlayer(gaujos[playerid],playerid, 0.0, 0.0, 0.5);
return 1;
}
}
SendClientMessage(playerid,GANG_COLOR,"* Atsiprasome, taciau dabar vietos naujai gaujai nera.");
return 1;
}
pawn Код:
gplayerDB[playerid][pgang]=-1;
pawn Код:
dini_IntSet(file,"Gang",gplayerDB[playerid][pgang]);
dini_BoolSet(file,"Islead",gplayerDB[playerid][islead]);
pawn Код:
if(dini_Int(file,"Islead")==1) gplayerDB[playerid][islead]=true;
gplayerDB[playerid][pgang] = dini_Int(file,"Gang");
if(gplayerDB[playerid][pgang]!=-1 && !gangDB[gplayerDB[playerid][pgang]][isgang])
{
gplayerDB[playerid][pgang]=-1;
gplayerDB[playerid][islead]=false;
}
return 1;
}
pawn Код:
public UnInvite(gang,playerid)
{
gangDB[gang][invited][playerid]=false;
}