[ajuda] Sitema VIP em Dof2
#1

Pessoal tenho este sistema de VIP que tive a fazer ontem com a ajuda de alguns users daqui.

No topo
pawn Код:
new Vip[MAX_PLAYERS];
em OnGameModeInit
pawn Код:
if(!fexist("Nivel/Vip.ini")) { DOF2_CreateFile("Nivel/Vip.ini");}
em OnPlayerConnect
pawn Код:
if(DOF2_IsSet("Nivel/Vip.ini",PlayerName(playerid))) Vip[playerid] = DOF2_GetInt("Nivel/Vip.ini",PlayerName(playerid));
para dar vip e tirar vip tenho esse comando aqui

pawn Код:
if(strcmp(cmd, "/darvip", true) == 0)
{
    new tmp[128];
    tmp = strtok(cmdtext, idx);
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"Comando reservado apenas para Administradores");
    if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Uso do Comando: /darvip ID");
    if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFFFFFFFF, "Jogador invalido");
    Vip[strval(tmp)] = 1;
    SendClientMessage(strval(tmp), 0xFFFFFFFF, "{FF0000}Aviso:{A0D197} Agora es membro VIP do Patos-Tugas {FF0000}/VIP!");
    SendClientMessage(playerid, TEAM_COMERCIO_COLOR, "{FF0000}Aviso:{A0D197} Desde estado VIP a um jogdor!");
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    new pName1[MAX_PLAYER_NAME];
    GetPlayerName(strval(tmp),pName1,sizeof(pName1));
    new string[248];
    format(string,sizeof(string),"{FFB01F}O administrador/a {FFEA00}%s{FFB01F} colocou o{FFEA00} %s como VIP!",pName,pName1);
    SendClientMessageToAll(TEAM_COMERCIO_COLOR, string);
    DOF2_SetInt("Nivel/Vip.ini",PlayerName(strval(tmp)),Vip[strval(tmp)]);
    DOF2_SaveFile();
    return 1;
}

if(strcmp(cmd, "/tirarvip", true) == 0)
{
    new tmp[128];
    tmp = strtok(cmdtext, idx);
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"Comando reservado apenas para Administradores");
    if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Uso do Comando: /tirarvip ID");
    if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFFFFFFFF, "Jogador invalido");
    Vip[strval(tmp)] = 0;
    SendClientMessage(strval(tmp), 0xFFFFFFFF, "{FF0000}Aviso:{A0D197} Agora ja nгo es VIP do Patos-Tugas");
    SendClientMessage(playerid, TEAM_COMERCIO_COLOR, "{FF0000}Aviso:{A0D197} Tiraste estado Vip a um jogador!");
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    new pName1[MAX_PLAYER_NAME];
    GetPlayerName(strval(tmp),pName1,sizeof(pName1));
    new string[248];
    format(string,sizeof(string),"{FFB01F}O administrador/a{FFEA00} %s{FFB01F} tirou o{FFEA00} %s de jogador Vip!",pName,pName1);
    SendClientMessageToAll(TEAM_COMERCIO_COLOR, string);
    DOF2_SetInt("Nivel/Vip.ini",PlayerName(strval(tmp)),Vip[strval(tmp)]);
    return 1;
}


й o seguinte, eu dou vip aos jogadores normais tudo bem, guarda normal, carrega normal so que quando entra alguem novo ele coloca essa pessoa com VIP ou seja coloca os jogadores novos como Vip[playerid] == 1 equanto devia meter == 0 !

Podem dar ai uma ajuda ?
Reply
#2

Vocк estб verificando apenas um arquivo, vocк deve salvar/carregar um arquivo de cada player, veja:
pawn Код:
new playername[MAX_PLAYER_NAME], arquivo[30];
GetPlayerName(playerid, playername, sizeof(playername));
format(arquivo, sizeof(arquivo), "Vips/%s.inc", playername);
if(!fexist(arquivo)) { DOF2_CreateFile(arquivo);}
...
Reply
#3

E nao da do jeito que eu fiz dentro de um arquivo ter la todos ? dentro do arquivo Vip.ini tinha assim

Rick_DR = 1
PEdro = 1
joaftt = 0
Reply
#4

Tenta:
pawn Код:
//CONNECT
Vip[playerid] = DOF2_GetInt("Nivel/Vip.ini",PlayerName(playerid));
//COMANDO
if(strcmp(cmd, "/darvip", true) == 0)
{
    new tmp[128];
    tmp = strtok(cmdtext, idx);
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"Comando reservado apenas para Administradores");
    if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Uso do Comando: /darvip ID");
    if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFFFFFFFF, "Jogador invalido");
    Vip[strval(tmp)] = 1;
    SendClientMessage(strval(tmp), 0xFFFFFFFF, "{FF0000}Aviso:{A0D197} Agora es membro VIP do Patos-Tugas {FF0000}/VIP!");
    SendClientMessage(playerid, TEAM_COMERCIO_COLOR, "{FF0000}Aviso:{A0D197} Desde estado VIP a um jogdor!");
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    new pName1[MAX_PLAYER_NAME];
    GetPlayerName(strval(tmp),pName1,sizeof(pName1));
    new string[248];
    format(string,sizeof(string),"{FFB01F}O administrador/a {FFEA00}%s{FFB01F} colocou o{FFEA00} %s como VIP!",pName,pName1);
    SendClientMessageToAll(TEAM_COMERCIO_COLOR, string);
    DOF2_SetInt("Nivel/Vip.ini", pName1, 1);
    DOF2_SaveFile();
    return 1;
}

if(strcmp(cmd, "/tirarvip", true) == 0)
{
    new tmp[128];
    tmp = strtok(cmdtext, idx);
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFFFFFFFF,"Comando reservado apenas para Administradores");
    if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "Uso do Comando: /tirarvip ID");
    if(!IsPlayerConnected(strval(tmp))) return SendClientMessage(playerid, 0xFFFFFFFF, "Jogador invalido");
    Vip[strval(tmp)] = 0;
    SendClientMessage(strval(tmp), 0xFFFFFFFF, "{FF0000}Aviso:{A0D197} Agora ja nгo es VIP do Patos-Tugas");
    SendClientMessage(playerid, TEAM_COMERCIO_COLOR, "{FF0000}Aviso:{A0D197} Tiraste estado Vip a um jogador!");
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,sizeof(pName));
    new pName1[MAX_PLAYER_NAME];
    GetPlayerName(strval(tmp),pName1,sizeof(pName1));
    new string[248];
    format(string,sizeof(string),"{FFB01F}O administrador/a{FFEA00} %s{FFB01F} tirou o{FFEA00} %s de jogador Vip!",pName,pName1);
    SendClientMessageToAll(TEAM_COMERCIO_COLOR, string);
    DOF2_SetInt("Nivel/Vip.ini", pName1, 0);
    DOF2_SaveFile();
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)