10/09/2025 16:26
(Esta mensagem foi modificada pela última vez a: 10/09/2025 20:27 por White_Blue.)
tenho esse sistema de gang porém tá dando 2 warnings que diz que o argumento não bate com a definição que se localiza na linha 60 só aí não sei resolver
a linha q tá dando o erro e exatamente isso
dini_Get(file, key, memberName, sizeof(memberName));
a linha q tá dando o erro e exatamente isso
dini_Get(file, key, memberName, sizeof(memberName));
Código:
#include <a_samp>
#include <zcmd>
#include <dini>
#define COLOR_RED 0xAA3333AA
#define COLOR_GREEN 0x33AA33AA
#define MAX_BANDS 100 // Max Groups 100. You can change to max up to 500!
enum ginfo {
grname[75],
leader,
active,
Float:gX,
Float:gY,
Float:gZ
};
enum pginfo {
gid,
order,
invited,
attemptjoin
};
new BAND[MAX_PLAYERS][pginfo];
new BANDinfo[MAX_BANDS][ginfo];
public OnFilterScriptInit() {
for(new x; x<MAX_PLAYERS; x++) {
BAND[x][gid] = -1;
BAND[x][order] = -1;
BAND[x][invited] = -1;
BAND[x][attemptjoin] = -1;
}
return 1;
}
public OnPlayerConnect(playerid) {
// Resetar informações de gangue do jogador
BAND[playerid][gid] = -1;
BAND[playerid][invited] = -1;
BAND[playerid][attemptjoin] = -1;
new pname[24];
GetPlayerName(playerid, pname, sizeof(pname));
// Procurar se o jogador está em alguma gangue salva
for(new i = 0; i < MAX_BANDS; i++) {
if(BANDinfo[i][active]) {
new file[128], memberName[24], key[16];
format(file, sizeof(file), "gangs/%s.ini", BANDinfo[i][grname]);
if(!fexist(file)) continue;
new total = dini_Int(file, "TotalMembers");
for(new x = 0; x < total; x++) {
format(key, sizeof(key), "Member%d", x);
// Ler o membro do arquivo INI com a sintaxe correta para Dini
dini_Get(file, key, memberName, sizeof(memberName));
if(!strcmp(memberName, pname, true)) {
BAND[playerid][gid] = i;
BAND[playerid][order] = BANDMembers(i); // define a ordem do membro
// Spawnar o jogador na posição da gangue
SetPlayerPos(playerid, BANDinfo[i][gX], BANDinfo[i][gY], BANDinfo[i][gZ]);
break;
}
}
if(BAND[playerid][gid] != -1) break; // já encontrou a gangue
}
}
return 1;
}
public OnPlayerSpawn(playerid) {
SetPlayerPos(playerid,
BANDinfo[BAND[playerid][gid]][gX],
BANDinfo[BAND[playerid][gid]][gY],
BANDinfo[BAND[playerid][gid]][gZ]);
return 1;
}
// =============================
// SALVAMENTO / CARREGAMENTO
// =============================
stock SaveGang(id) {
if(!BANDinfo[id][active]) return 0;
new file[128];
format(file, sizeof(file), "gangs/%s.ini", BANDinfo[id][grname]);
dini_Create(file);
dini_Set(file, "Name", BANDinfo[id][grname]);
dini_IntSet(file, "Leader", BANDinfo[id][leader]);
dini_IntSet(file, "Active", BANDinfo[id][active]);
dini_FloatSet(file, "PosX", BANDinfo[id][gX]);
dini_FloatSet(file, "PosY", BANDinfo[id][gY]);
dini_FloatSet(file, "PosZ", BANDinfo[id][gZ]);
// salvar membros (máximo 15)
new count = 0, pname[24], key[16];
for(new i=0; i<MAX_PLAYERS; i++) {
if(BAND[i][gid] == id) {
GetPlayerName(i, pname, sizeof(pname));
format(key, sizeof(key), "Member%d", count);
dini_Set(file, key, pname);
count++;
if(count >= 15) break;
}
}
dini_IntSet(file, "TotalMembers", count);
return 1;
}
stock LoadGang(name[]) {
new file[128];
format(file, sizeof(file), "gangs/%s.ini", name);
if(!fexist(file)) return -1;
new slotid = FindNextSlot();
dini_Get(file, "Name", BANDinfo[slotid][grname], 75);
BANDinfo[slotid][leader] = dini_Int(file, "Leader");
BANDinfo[slotid][active] = dini_Int(file, "Active");
BANDinfo[slotid][gX] = dini_Float(file, "PosX");
BANDinfo[slotid][gY] = dini_Float(file, "PosY");
BANDinfo[slotid][gZ] = dini_Float(file, "PosZ");
return slotid;
}
// =============================
// COMANDOS
// =============================
COMMAND:criargang(playerid, params[]) {
if(BAND[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "Deixe sua gangue com {FFFFFF}/deixargang{FF0000} antes de criar outra!");
if(strlen(params) > 49 || strlen(params) < 3) return SendClientMessage(playerid, 0xFF0000, "Uso: {FFFFFF}/criargang{FF0000} (nome 3-50 chars)!");
if(IsBANDTaken(params)) return SendClientMessage(playerid, 0xFF0000, "Esse nome já está em uso!");
CreateBAND(params, playerid);
return 1;
}
COMMAND:deixargang(playerid, params[]) {
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "Você não está em uma gangue!");
LeaveBAND(playerid, 0);
return 1;
}
COMMAND:aceitargang(playerid, params[]){
if(BAND[playerid][order] != 1) return SendClientMessage(playerid, 0xFF0000, "você não é líder de uma gangue para convidar pessoas!");
new cid;
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/aceitargang{FF0000} [id]");
cid = strval(params);
if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player nãoe stá conectado!");
if(BAND[cid][gid] == BAND[playerid][gid]) return SendClientMessage(playerid, 0xFF0000, "esse jogador já está em sua gangue!");
if(BAND[cid][invited] == BAND[playerid][gid]) return SendClientMessage(playerid, 0xFF0000, "este jogador foi convidado para sua gangue!");
if(BAND[cid][attemptjoin] == BAND[playerid][gid]) return BANDJoin(cid, BAND[playerid][gid]);
BAND[cid][invited] = BAND[playerid][gid];
new string[125], pname[24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "você foi convidada a se juntar uma gangue {FFFFFF}%s(ID.%d){FFCC66} por {FFFFFF}%s(ID.%d). /juntarseagang %d", BANDinfo[BAND[playerid][gid]][grname], BAND[playerid][gid], pname, playerid, BAND[playerid][gid]);
SendClientMessage(cid, 0xFFCC66, string);
GetPlayerName(cid, pname, 24);
format(string, sizeof(string), "você não foi convidado {FFFFFF}%s(ID.%d){FFCC66} para se juntar essa gangue!", pname, cid);
SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
COMMAND:gangowner(playerid, params[]){
if(BAND[playerid][order] != 1) return SendClientMessage(playerid, 0xFF0000, "You are not the leader of the Gang, you cannot change the leader!");
new cid;
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Gangowner{FF0000} [id]");
cid = strval(params);
if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
if(cid == playerid) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are now Gang Leader :D!");
if(BAND[playerid][gid] != BAND[cid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is not in your Gang!");
ChangeMemberOrder(BAND[playerid][gid], 1);
BAND[playerid][order] = BANDMembers(BAND[playerid][gid]);
return 1;
}
COMMAND:gangjoin(playerid, params[]){
if(BAND[playerid][gid] != -1) return SendClientMessage(playerid, 0xFF0000, "You are already in a Gang! Leave your current one before joining another one!");
new grid;
if( (isnull(params) && BAND[playerid][invited] != -1 ) || ( strval(params) == BAND[playerid][invited] && BAND[playerid][invited] != -1) ) return BANDJoin(playerid, BAND[playerid][invited]);
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Gangjoin{FF0000} [id]");
grid = strval(params);
if(!BANDinfo[grid][active]) return SendClientMessage(playerid, COLOR_RED, "ERROR: You wanted to join band which doesnt Exsist!!");
BAND[playerid][attemptjoin] = grid;
new string[125], pname[24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "You have requested to join band %s(ID:%d)", BANDinfo[grid][grname], grid);
SendClientMessage(playerid, 0xFFCC66, string);
format(string, sizeof(string), "{FFFFFF}%s(ID.%d) {FFCC66}has requested to join your Gang. Type /Gangaccept %d to accept him!", pname, playerid, playerid);
SendMessageToLeader(grid, string);
return 1;
}
COMMAND:gangkick(playerid, params[]){
if(BAND[playerid][order] != 1) return SendClientMessage(playerid, COLOR_RED, "ERROR:You are not the leader of a Gang, you cannot kick!");
new cid;
if(isnull(params)) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Gangkick{FF0000} [id]");
cid = strval(params);
if(!IsPlayerConnected(cid)) return SendClientMessage(playerid, 0xFF0000, "Player Is not connected!");
if(cid == playerid) return SendClientMessage(playerid, 0xFF0000, "You cannot kick yourself, silly.");
if(BAND[playerid][gid] != BAND[cid][gid]) return SendClientMessage(playerid, 0xFF0000, "Player Is not in your Gang!");
LeaveBAND(cid, 1);
return 1;
}
COMMAND:bm(playerid, params[]){
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "ERROR: You are not in Band. You cannot Talk over Radio!");
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: ! [message]. WARNING! Its ICly!");
new pname[24], string[140+24];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "%s(ID.%d): %s", pname, playerid, params);
SendMessageToAllBANDMembers(BAND[playerid][gid], string);
return 1;
}
COMMAND:gangsinfo(playerid, params[]){
if(BAND[playerid][gid] == -1) return SendClientMessage(playerid, COLOR_GREEN, "ERROR: You are not in Gang. To check Gang Stats, go in your Gang!");
SendClientMessage(playerid, COLOR_GREEN ,"Warning: Gang Stats are Currently Under Construction! Need ideas for it. ");
return 1;
}
COMMAND:ganglist(playerid, params[]){
if(isnull(params) && BAND[playerid][gid] == -1) return SendClientMessage(playerid, 0xFF0000, "Usage: {FFFFFF}/Ganglist{FF0000} [id]");
if(isnull(params)){
DisplayBANDMembers(BAND[playerid][gid], playerid);
return 1;
}
new grid = strval(params);
if(!BANDinfo[grid][active]) return SendClientMessage(playerid, 0xFF0000, "The band ID you have entered is not active!");
DisplayBANDMembers(grid, playerid);
return 1;
}
COMMAND:gangs(playerid, params[]){
ListBANDs(playerid);
return 1;
}
// =======================================
// FUNÇÕES EXISTENTES + ALTERAÇÕES
// =======================================
/*stock CreateBAND(grpname[], owner) {
new slotid = FindNextSlot();
BANDinfo[slotid][leader] = owner;
format(BANDinfo[slotid][grname], 75, "%s", grpname);
BANDinfo[slotid][active] = 1;
BAND[owner][gid] = slotid;
BAND[owner][order] = 1;
// salvar posição da criação como spawn
GetPlayerPos(owner, BANDinfo[slotid][gX], BANDinfo[slotid][gY], BANDinfo[slotid][gZ]);
new string[120];
format(string, sizeof(string), "Você criou a Gangue %s(ID:%d)", grpname, slotid);
SendClientMessage(owner, 0xFFCC66, string);
SaveGang(slotid); // salva no arquivo .ini
return slotid;
}*/
/*stock LeaveBAND(playerid, reason) {
new BANDid = BAND[playerid][gid], orderid = BAND[playerid][order], string[100], pname[24];
BAND[playerid][gid] = -1;
BAND[playerid][order] = -1;
BANDCheck(BANDid, orderid);
GetPlayerName(playerid, pname, 24);
if(reason == 0) {
format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} saiu da gangue!", pname, playerid);
SendClientMessage(playerid, 0xFFCC66, "Você saiu da gangue.");
}
if(reason == 1) {
format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} foi expulso da gangue!", pname, playerid);
SendClientMessage(playerid, 0xFFCC66, "Você foi expulso da gangue!");
}
if(reason == 2) format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} saiu da gangue (desconectou)!", pname, playerid);
SendMessageToAllBANDMembers(BANDid, string);
SaveGang(BANDid); // atualiza arquivo após saída
return 1;
}*/
stock DisplayBANDMembers(BANDid, playerid){
new amount[2], string[200], shortstr[55], pname[24];
format(string, sizeof(string), "Band Members for %s(ID:%d)", BANDinfo[BANDid][grname], BANDid);
SendClientMessage(playerid, 0xFFFFFF, string);
string = "";
for(new x; x<MAX_PLAYERS; x++){
if(BAND[x][gid] == BANDid){
amount[0] ++;
amount[1] ++;
GetPlayerName(x, pname, 24);
if(BANDinfo[BANDid][leader] != x) format(shortstr, sizeof(shortstr), "%s(%d),", pname, x);
if(BANDinfo[BANDid][leader] == x) format(shortstr, sizeof(shortstr), "[Leader]%s(%d),", pname, x);
if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
if(amount[0] == 6)
{
strdel(string, strlen(string)-1, strlen(string));
SendClientMessage(playerid, 0xFFCC66, string);
string = "";
amount[0] = 0;
}
}
}
strdel(string, strlen(string)-1, strlen(string));
if(amount[0] != 0) SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
stock ListBANDs(playerid){
new amount[2], string[200], shortstr[55];
SendClientMessage(playerid, 0xFFFFFF, "Current Active Gangs:");
for(new x=0; x<MAX_BANDS; x++){
if(BANDinfo[x][active]){
amount[0] ++;
amount[1] ++;
format(shortstr, sizeof(shortstr), "%s(ID:%d)", BANDinfo[x][grname], x);
if(amount[1] == 1) format(string, sizeof(string), "%s", shortstr);
if(amount[1] != 1) format(string, sizeof(string), "%s %s", string, shortstr);
if(amount[0] == 4)
{
SendClientMessage(playerid, 0xFFCC66, string);
string = "";
amount[0] = 0;
}
}
}
if(amount[1] == 0) SendClientMessage(playerid, 0xFFFF00, "There are currently no active gangs!");
if(amount[1] != 0) SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
stock SendMessageToLeader(BANDi, message[])
return SendClientMessage(BANDinfo[BANDi][leader], 0xFFCC66, message);
stock BANDJoin(playerid, BANDi){
BAND[playerid][gid] = BANDi;
BAND[playerid][order] = BANDMembers(BANDi);
BAND[playerid][attemptjoin] = -1;
BAND[playerid][invited] = -1;
new pname[24], string[130];
GetPlayerName(playerid, pname, 24);
format(string, sizeof(string), "%s is now in your Gang!", pname);
SendMessageToAllBANDMembers(BANDi, string);
format(string, sizeof(string), "You are now in gang %s(ID:%d)", BANDinfo[BANDi][grname] ,BANDi);
SendClientMessage(playerid, 0xFFCC66, string);
return 1;
}
stock FindNextSlot(){
new id;
while(BANDinfo[id][active]) id ++;
return id;
}
stock IsBANDTaken(grpname[]){
for(new x; x<MAX_BANDS; x++){
if(BANDinfo[x][active] == 1){
if(!strcmp(grpname, BANDinfo[x][grname], true) && strlen(BANDinfo[x][grname]) != 0) return 1;
}
}
return 0;
}
stock BANDInvite(playerid, BANDid)
return BAND[playerid][invited] = BANDid;
/*stock CreateBAND(grpname[], owner){
new slotid = FindNextSlot();
BANDinfo[slotid][leader] = owner;
format(BANDinfo[slotid][grname], 75, "%s", grpname);
BANDinfo[slotid][active] = 1;
BAND[owner][gid] = slotid;
BAND[owner][order] = 1;
new string[120];
format(string, sizeof(string), "You created Gang %s(ID:%d)", grpname, slotid);
SendClientMessage(owner, 0xFFCC66, string);
return slotid;
}*/
stock CreateBAND(grpname[], owner){
new slotid = FindNextSlot();
BANDinfo[slotid][leader] = owner;
format(BANDinfo[slotid][grname], 75, "%s", grpname);
BANDinfo[slotid][active] = 1;
BAND[owner][gid] = slotid;
BAND[owner][order] = 1;
// salvar posição da criação como spawn
GetPlayerPos(owner, BANDinfo[slotid][gX], BANDinfo[slotid][gY], BANDinfo[slotid][gZ]);
new string[120];
format(string, sizeof(string), "You created Gang %s(ID:%d)", grpname, slotid);
SendClientMessage(owner, 0xFFCC66, string);
// ? Salva automaticamente no arquivo .ini
SaveGang(slotid);
return slotid;
}
stock LeaveBAND(playerid, reason){
new BANDid = BAND[playerid][gid], orderid = BAND[playerid][order], string[100], pname[24];
BAND[playerid][gid] = -1;
BAND[playerid][order] = -1;
BANDCheck(BANDid, orderid);
GetPlayerName(playerid, pname, 24);
if(reason == 0)
{
format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left the Gang!", pname, playerid);
SendClientMessage(playerid, 0xFFCC66, "You are leave from the gang");
}
if(reason == 1)
{
format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has kicked from the Gang!", pname, playerid);
SendClientMessage(playerid, 0xFFCC66, "You are kicked from the gang!");
}
if(reason == 2) format(string, sizeof(string), "{FFFFFF}%s(%d){FFCC66} has left your Gang (Disconnected)!", pname, playerid);
SendMessageToAllBANDMembers(BANDid, string);
return 1;
}
stock BANDCheck(BANDid, orderid){
new gmems = BANDMembers(BANDid);
if(!gmems) BANDinfo[BANDid][active] = 0;
if(gmems != 0) ChangeMemberOrder(BANDid, orderid);
return 1;
}
stock BANDMembers(BANDid){
if(!BANDinfo[BANDid][active]) return 0;
new BANDmembers;
for(new i; i<MAX_PLAYERS; i++) if(BAND[i][gid] == BANDid) BANDmembers++;
return BANDmembers;
}
stock ChangeMemberOrder(BANDid, orderid){
for(new x; x<MAX_PLAYERS; x++)
{
if(BAND[x][gid] != BANDid || BAND[x][order] < orderid) continue;
BAND[x][order] --;
if(BAND[x][order] == 1)
{
BANDinfo[BANDid][leader] = x;
new string[128], pname[24];
GetPlayerName(x, pname, 24);
format(string, sizeof(string), "{FFFFFF}%s(ID.%d){FFCC66} is now Gang Leader! Congratiulations!", pname, x);
SendMessageToAllBANDMembers(BANDid, string);
}
}
return 1;
}
stock SendMessageToAllBANDMembers(BANDid, message[]){
if(!BANDinfo[BANDid][active]) return 0;
for(new x; x<MAX_PLAYERS; x++) if(BAND[x][gid] == BANDid) SendClientMessage(x, 0xFFCC66, message);
return 1;
}