OK rs.
Todas as orgs salvam direito menos a org numero 22(ultima)(existe a 23 em construзгo mas ela nгo da erro).
pawn Код:
public SalvarOrg(org)
{
new string3[12];
format(string3, sizeof(string3), "Orgs/%d.ini", org);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
new var[34];
format(var,34, "Lider=%s\n",OrgInfo[org][Lider]); fwrite(hFile, var);
format(var,34, "SubLider=%s\n",OrgInfo[org][SubLider]); fwrite(hFile, var);
format(var,34, "Membro1=%s\n",OrgInfo[org][Membro1]); fwrite(hFile, var);
format(var,34, "Membro2=%s\n",OrgInfo[org][Membro2]); fwrite(hFile, var);
format(var,34, "Membro3=%s\n",OrgInfo[org][Membro3]); fwrite(hFile, var);
format(var,34, "Membro4=%s\n",OrgInfo[org][Membro4]); fwrite(hFile, var);
format(var,34, "Membro5=%s\n",OrgInfo[org][Membro5]); fwrite(hFile, var);
format(var,34, "Membro6=%s\n",OrgInfo[org][Membro6]); fwrite(hFile, var);
format(var,34, "Membro7=%s\n",OrgInfo[org][Membro7]); fwrite(hFile, var);
format(var,34, "Membro8=%s\n",OrgInfo[org][Membro8]); fwrite(hFile, var);
format(var,34, "Membro9=%s\n",OrgInfo[org][Membro9]); fwrite(hFile, var);
format(var,34, "Membro10=%s\n",OrgInfo[org][Membro10]); fwrite(hFile, var);
format(var,34, "Membro11=%s\n",OrgInfo[org][Membro11]); fwrite(hFile, var);
format(var,34, "Membro12=%s\n",OrgInfo[org][Membro12]); fwrite(hFile, var);
format(var,34, "Membro13=%s\n",OrgInfo[org][Membro13]); fwrite(hFile, var);
format(var,34, "Membro14=%s\n",OrgInfo[org][Membro14]); fwrite(hFile, var);
format(var,34, "Membro15=%s\n",OrgInfo[org][Membro15]); fwrite(hFile, var);
format(var,34, "Membro16=%s\n",OrgInfo[org][Membro16]); fwrite(hFile, var);
format(var,34, "Membro17=%s\n",OrgInfo[org][Membro17]); fwrite(hFile, var);
format(var,34, "Membro18=%s\n",OrgInfo[org][Membro18]); fwrite(hFile, var);
fclose(hFile);
}
return 1;
}
No OnGameModeInit
pawn Код:
CarregarOrg(1);
CarregarOrg(2);
CarregarOrg(3);
CarregarOrg(4);
CarregarOrg(5);
CarregarOrg(6);
CarregarOrg(7);
CarregarOrg(8);
CarregarOrg(9);
CarregarOrg(10);
CarregarOrg(11);
CarregarOrg(12);
CarregarOrg(13);
CarregarOrg(14);
CarregarOrg(15);
CarregarOrg(16);
CarregarOrg(17);
CarregarOrg(18);
CarregarOrg(19);
CarregarOrg(20);
CarregarOrg(21);
CarregarOrg(22);
No on Game Mode exit
pawn Код:
SalvarOrg(1);
SalvarOrg(2);
SalvarOrg(3);
SalvarOrg(4);
SalvarOrg(5);
SalvarOrg(6);
SalvarOrg(7);
SalvarOrg(8);
SalvarOrg(9);
SalvarOrg(10);
SalvarOrg(11);
SalvarOrg(12);
SalvarOrg(13);
SalvarOrg(14);
SalvarOrg(15);
SalvarOrg(16);
SalvarOrg(17);
SalvarOrg(18);
SalvarOrg(19);
SalvarOrg(20);
SalvarOrg(21);
SalvarOrg(22);
/darlider
pawn Код:
if(strcmp(cmd, "/darlider", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USO: /darlider [playerid/Parte-do-Nick] [Number(0-23)]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(level > 23 || level < 0) { SendClientMessage(playerid, COLOR_GREY, " Nъmeros entre 0 e 23"); return 1; }
new nome[24];
GetPlayerName(playerid, nome, sizeof nome);
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(PlayerInfo[para1][pLeader] != 0)
{
new MSG11[80];
format(MSG11,80,"Esse jogador ja era lider da organizaзгo numero %d",PlayerInfo[para1][pLeader]);
SendClientMessage(playerid,COLOR_GRAD1,MSG11);
SendClientMessage(playerid,COLOR_GRAD1,"Seu lider foi retirado para que o novo possa ser dado!");
format(OrgInfo[PlayerInfo[para1][pLeader]][Lider],MAX_PLAYER_NAME,"Vazio");
format(MSG11,80,"%s retirou o lider de %s da org %d(/darlider)",sendername,giveplayer,PlayerInfo[para1][pLeader]);
LideresLog(MSG11);
}
PlayerInfo[para1][pLeader] = level;
format(string, sizeof(string), "%s(ID:%d) lhe deu o direito administraзгo profissional da organizaзгo %d, digite /rg.", sendername,playerid,level);
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "%s(ID:%d) й o novo lнder administrativo profissional (%d).", giveplayer,giveplayerid,level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
if(level == 0) { PlayerInfo[para1][pChar] = 23; }
else if(level == 1) { PlayerInfo[para1][pChar] = 265; gTeam[para1] = 2; } //Police Force
else if(level == 2) { PlayerInfo[para1][pChar] = 286; gTeam[para1] = 2; } //FBI/ATF
else if(level == 3) { PlayerInfo[para1][pChar] = 287; gTeam[para1] = 2;} //National Guard
else if(level == 4) { PlayerInfo[para1][pChar] = 70; gTeam[para1] = 4;} //Fire/Ambulance
else if(level == 5) { PlayerInfo[para1][pChar] = 104; gTeam[para1] = 7;} //Ballas
else if(level == 6) { PlayerInfo[para1][pChar] = 270; gTeam[para1] = 7;} //Grove
else if(level == 7) { PlayerInfo[para1][pChar] = 147; gTeam[para1] = 8;} //prefeito
else if(level == 8) { PlayerInfo[para1][pChar] = 165; gTeam[para1] = 8;} //M.I.
else if(level == 9) { PlayerInfo[para1][pChar] = 295; gTeam[para1] = 9;} //News Reporters
else if(level == 10) { PlayerInfo[para1][pChar] = 47; gTeam[para1] = 47;} //Lowrider
else if(level == 11) { PlayerInfo[para1][pChar] = 174; gTeam[para1] = 174;} //San Fierro
else if(level == 12) { PlayerInfo[para1][pChar] = 108; gTeam[para1] = 7;} //Los Santos Vagos
else if(level == 13) { PlayerInfo[para1][pChar] = 181; gTeam[para1] = 7;} //motoqueiros
else if(level == 14) { PlayerInfo[para1][pChar] = 283; gTeam[para1] = 14;} //PR
else if(level == 15) { PlayerInfo[para1][pChar] = 115; gTeam[para1] = 7; } //Aztecas
else if(level == 16) { PlayerInfo[para1][pChar] = 118; gTeam[para1] = 16; } //Mafia
else if(level == 17) { PlayerInfo[para1][pChar] = 294; gTeam[para1] = 16; } //PRF
else if(level == 18) { PlayerInfo[para1][pChar] = 292; gTeam[para1] = 16; } //Drifters
else if(level == 19) { PlayerInfo[para1][pChar] = 19; gTeam[para1] = 16; } //Comando Vermelho
else if(level == 20) { PlayerInfo[para1][pChar] = 293; gTeam[para1] = 16; } //PCC
else if(level == 21) { PlayerInfo[para1][pChar] = 285; gTeam[para1] = 21; } //swat
else if(level == 22) { PlayerInfo[para1][pChar] = 290; gTeam[para1] = 22; } //Al-Qaeda
else if(level == 23) { PlayerInfo[para1][pChar] = 235; gTeam[para1] = 7; } //em construзгo
PlayerInfo[para1][pMember] = level;
PlayerInfo[para1][pRank] = 6;
format(OrgInfo[level][Lider],MAX_PLAYER_NAME,giveplayer);
SalvarOrg(level);
PlayerInfo[para1][pTeam] = gTeam[para1];
PlayerInfo[para1][pModel] = PlayerInfo[para1][pChar];
SetPlayerSkin(para1, PlayerInfo[para1][pChar]);
new msg12[48];
format(msg12,48,"%s deu para %s o lider da org %d (/darlider)",sendername,giveplayer,PlayerInfo[para1][pLeader]);
LideresLog(msg12);
SalvarOrg(level);
}
}//not connected
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Sem Autorizaзгo.");
}
}
return 1;
}
Demitir lider quando spawna
pawn Код:
if(PlayerInfo[playerid][pLeader] != 0)
{
new Nome[MAX_PLAYER_NAME];
GetPlayerName(playerid,Nome,sizeof(Nome));
if(strcmp(OrgInfo[PlayerInfo[playerid][pLeader]][Lider],Nome,true) != 0)
{
PlayerInfo[playerid][pLeader] = 0;
SendClientMessage(playerid,COLOR_GRAD1,"Seu lider foi removido por algum adm!");
SendClientMessage(playerid,COLOR_GRAD1,"Se vocк acredita que isso й um erro, contate o suporte!");
PlayerInfo[playerid][pTeam] = 3;
PlayerInfo[playerid][pMember] = 0;
PlayerInfo[playerid][pRank] = 0;
PlayerInfo[playerid][pLeader] = 0;
PlayerInfo[playerid][pModel] = 0;
SetPlayerSkin(playerid, 23);
gTeam[playerid] = 3;
}
}
eu SEI que o erro ta na hora que o GM fecha que ta setando o lider pra "Vazio"... o estranho й que sу ta setando da org 22 e nenhuma outra
Vou sair agora sу entro + tarde