[Ajuda] Sistema de admin nгo salva
#1

eae pessoal blz ? estou usando o sistema de admin do xxRaioxx porem quando eu entro no servidor eu tento setar meu cargo mostra que setou mas nгo setou . tento sair do server modificar o level ai modifica o level no bloco de notas , ai eu logo tento usar algum comando de admin e dб que eu nгo tenho permissгo depois eu saio de server e volta pro level de admin 0 no bloco de notas alguйm poderia me passar um sistema melhor ?
Reply
#2

LL_ADMIN com esse vocк nгo terб problemas
Reply
#3

Quote:
Originally Posted by iTakelot
Посмотреть сообщение
LL_ADMIN com esse vocк nгo terб problemas
mas tipo eu so quero o sistema sem os comandos spawns e outras coisas que tem . serб que eu consigo remo velos facilmente ?
Reply
#4

Nesse caso seria melhor um sistema mais simples porque o LL_ADMIN te daria muito trabalho...
Reply
#5

Quote:
Originally Posted by iTakelot
Посмотреть сообщение
Nesse caso seria melhor um sistema mais simples porque o LL_ADMIN te daria muito trabalho...
poderia me ajudar ? skype : ribeirinho225
Reply
#6

Manda o cуdigo que faz o salvamento.
Reply
#7

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Manda o cуdigo que faz o salvamento.
salva ao desconectar
PHP код:
public OnPlayerDisconnect(playerid)
{
    
// admin
    
new arquiva[34], playernome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernomesizeof(playernome));
    
format(arquivasizeof(arquiva), "Admins/%s.ini"playernome);
    if(
DOF2_FileExists(arquiva))
    {
        
DOF2_SetInt(arquiva"Level"pAdmin[playerid][Level]);
        
DOF2_SaveFile();
    }
    else
    {
        
DOF2_CreateFile(arquiva);
        
DOF2_SetInt(arquiva"Level"pAdmin[playerid][Level]);
        
DOF2_SaveFile();
    }
    
// admin
    
    
return 1;

dб o admin

PHP код:

CMD
:setadmin(playeridparams[])
{
    new 
idlevelstring[256], string2[256], ganhou[MAX_PLAYER_NAME], deu[MAX_PLAYER_NAME];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xAD0000AA"{00E5FF}Vocк nгo estб autorizado.");
    if(
sscanf(params"ud"idlevel)) return SendClientMessage(playerid0xAD0000AA"Use /daradmin [ID] [LEVEL]");
    if (
level || level 6) return SendClientMessage(playerid0xFF0000FF"Level invбlido. Use de 1 б 6 .");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid0xAD0000AA"Este jogador nгo estб online.");
    
GetPlayerName(idganhousizeof(ganhou));
    
GetPlayerName(playeriddeusizeof(deu));
    
format(stringsizeof(string), "Vocк deu admin level %s para o %s"GetLevelAdmin(level), ganhou);
    
SendClientMessage(playerid0x00F6F6AAstring);
    
format(string2sizeof(string2), "O admin %s deu admin level %s para vocк."deu GetLevelAdmin(level));
    
SendClientMessage(idVERDEstring2);
    
pAdmin[id][Level] =  level;
    return 
1;

Reply
#8

Tente assim:
PHP код:
#include <a_samp>
#include <DOF2>
#include <sscanf>

#define function::%0(%1) forward %0(%1);public %0(%1)

function::save_player(playerid
{
    new
        
nome_player[MAX_PLAYER_NAME]
        
arquivo[34]
    ;
    
GetPlayerName(playeridnome_playersizeof(nome_player));
    
format(arquivosizeof(arquivo), "Admins/%s.ini"nome_player);
    if(!
DOF2_FileExists(arquivo)) 
        
DOF2_CreateFile(arquivo);
    if(
DOF2_FileExists(arquivo))
        
DOF2_SetInt(arquivo"Level"pAdmin[playerid][Level]); 
        
DOF2_SaveFile();
    return 
1;
}

CMD:setadmin(playeridparams[]) 

    new 
idlevelstring[256], string2[256], ganhou[MAX_PLAYER_NAME], deu[MAX_PLAYER_NAME]; 
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xAD0000AA"{00E5FF}Vocк nгo estб autorizado."); 
    if(
sscanf(params"ud"idlevel)) return SendClientMessage(playerid0xAD0000AA"Use /daradmin [ID] [LEVEL]"); 
    if (
level || level 6) return SendClientMessage(playerid0xFF0000FF"Level invбlido. Use de 1 б 6 ."); 
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid0xAD0000AA"Este jogador nгo estб online."); 
    
GetPlayerName(idganhousizeof(ganhou)); 
    
GetPlayerName(playeriddeusizeof(deu)); 
    
format(stringsizeof(string), "Vocк deu admin level %s para o %s"GetLevelAdmin(level), ganhou); 
    
SendClientMessage(playerid0x00F6F6AAstring); 
    
format(string2sizeof(string2), "O admin %s deu admin level %s para vocк."deu GetLevelAdmin(level)); 
    
SendClientMessage(idVERDEstring2); 
    
pAdmin[id][Level] =  level;
    
save_player(id); 
    return 
1

Reply
#9

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
tente assim
deu no mesmo me dei adm reloguei no server mr.ovelha.ini >> level 0 entrei no sv dnv dei adm tentei usar cmd de adm e tb nгo foi !!!!

print /.>>


PHP код:
//==============================INCLUDES=============================//
#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <string>
#include <DOF2>
#define VERMELHO 0xFF0000C8
#define VERDE 0x00D200C8
#define Azul_C 0x00FFFFC8
#define COR_ERRO 0xFF0000C8
#define function::%0(%1) forward %0(%1);public %0(%1)
/******************************************************************************/
enum PlayerAdmin
{
     
Level
}
/******************************************************************************/
#define Kick(%0) SetTimerEx("Kicka", 100, false, "i", %0)
#pragma unused ret_memcpy
// Nametag
#define NAME_DRAWDISTANCE (5)
new Text3D:NameTag[MAX_PLAYERS];
#define Helper         1
#define Moderator  2
#define Admin   3
#define Developer        4
#define Master       5
#define Owner     6
/******************************************************************************/
new Text:Inicioserver[15];
new 
pAdmin[MAX_PLAYERS][PlayerAdmin];
/******************************************************************************/
main()
{
    print(
"\n----------------------------------");
    print(
" Gamemode by Jefferson");
    print(
"----------------------------------\n");
}
/******************************************************************************/
// New's
    
public OnGameModeInit()
{
    
SetWeather(11);
    
UsePlayerPedAnims();
    
SetGameModeText("Test");
    
// fs
    
print("\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
    print(
" DJ.PEROBA TOCANDO AS MELHORES TUTS TUTS");
    print(
"           Creditos: JEFFERSON");
    print(
"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
    
//====================================================
    
Inicioserver[0] = TextDrawCreate(29.000000154.000000"Penis");
    
TextDrawBackgroundColor(Inicioserver[0], 255);
    
TextDrawFont(Inicioserver[0], 3);
    
TextDrawLetterSize(Inicioserver[0], 0.7699993.899997);
    
TextDrawColor(Inicioserver[0], -1);
    
TextDrawSetOutline(Inicioserver[0], 1);
    
TextDrawSetProportional(Inicioserver[0], 1);
    
Inicioserver[1] = TextDrawCreate(28.000000188.000000"Valdo");
    
TextDrawBackgroundColor(Inicioserver[1], 255);
    
TextDrawFont(Inicioserver[1], 1);
    
TextDrawLetterSize(Inicioserver[1], 0.6199982.599998);
    
TextDrawColor(Inicioserver[1], -1);
    
TextDrawSetOutline(Inicioserver[1], 1);
    
TextDrawSetProportional(Inicioserver[1], 1);
    
Inicioserver[2] = TextDrawCreate(108.000000188.000000"16");
    
TextDrawBackgroundColor(Inicioserver[2], 255);
    
TextDrawFont(Inicioserver[2], 1);
    
TextDrawLetterSize(Inicioserver[2], 0.5500002.700001);
    
TextDrawColor(Inicioserver[2], -1);
    
TextDrawSetOutline(Inicioserver[2], 1);
    
TextDrawSetProportional(Inicioserver[2], 1);
    
Inicioserver[13] = TextDrawCreate(644.000000355.000000"_");
    
TextDrawFont(Inicioserver[13], 1);
    
TextDrawLetterSize(Inicioserver[13], 0.500000, -0.099999);
    
TextDrawColor(Inicioserver[13], -1);
    
TextDrawSetOutline(Inicioserver[13], 0);
    
TextDrawSetProportional(Inicioserver[13], 1);
    
TextDrawSetShadow(Inicioserver[13], 1);
    
TextDrawUseBox(Inicioserver[13], 1);
    
TextDrawBoxColor(Inicioserver[13], 396367716);
    
TextDrawTextSize(Inicioserver[13], -4.0000000.000000);
    
Inicioserver[14] = TextDrawCreate(644.00000067.000000"_");
    
TextDrawBackgroundColor(Inicioserver[14], 255);
    
TextDrawFont(Inicioserver[14], 1);
    
TextDrawLetterSize(Inicioserver[14], 0.500000, -0.099999);
    
TextDrawColor(Inicioserver[14], -1);
    
TextDrawSetOutline(Inicioserver[14], 0);
    
TextDrawSetProportional(Inicioserver[14], 1);
    
TextDrawSetShadow(Inicioserver[14], 1);
    
TextDrawUseBox(Inicioserver[14], 1);
    
TextDrawBoxColor(Inicioserver[14], 396367716);
    
TextDrawTextSize(Inicioserver[14], -4.0000000.000000);
    
TextDrawSetSelectable(Inicioserver[14], 0);
    
Inicioserver[3] = TextDrawCreate(644.0000002.000000"_");
    
TextDrawBackgroundColor(Inicioserver[3], 255);
    
TextDrawFont(Inicioserver[3], 1);
    
TextDrawLetterSize(Inicioserver[3], 0.5000006.800000);
    
TextDrawColor(Inicioserver[3], -1);
    
TextDrawSetOutline(Inicioserver[3], 0);
    
TextDrawSetProportional(Inicioserver[3], 1);
    
TextDrawSetShadow(Inicioserver[3], 1);
    
TextDrawUseBox(Inicioserver[3], 1);
    
TextDrawBoxColor(Inicioserver[3], 33686116);
    
TextDrawTextSize(Inicioserver[3], -4.0000000.000000);
    
Inicioserver[4] = TextDrawCreate(644.000000358.000000"_");
    
TextDrawBackgroundColor(Inicioserver[4], 255);
    
TextDrawFont(Inicioserver[4], 1);
    
TextDrawLetterSize(Inicioserver[4], 0.50000010.000002);
    
TextDrawColor(Inicioserver[4], -1);
    
TextDrawSetOutline(Inicioserver[4], 0);
    
TextDrawSetProportional(Inicioserver[4], 1);
    
TextDrawSetShadow(Inicioserver[4], 1);
    
TextDrawUseBox(Inicioserver[4], 1);
    
TextDrawBoxColor(Inicioserver[4], 33686116);
    
TextDrawTextSize(Inicioserver[4], -4.0000000.000000);
    
//============
    //fs
    
return 1;
}
public 
OnGameModeExit()
{
    
DOF2_Exit();
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    for(new 
txd 0txd <= 16txd++) TextDrawShowForPlayer(playeridInicioserver[txd]);
    
//++++++++++++++++++++++++++++ NAME LABEL --------------------------------------------------
    
new string[128];
    
format(stringsizeof(string), "%s (%d)"p_name(playerid));
    
NameTag[playerid] = Create3DTextLabel(string0xFFFFFFFF000NAME_DRAWDISTANCE0);
    
Attach3DTextLabelToPlayer(NameTag[playerid], playerid0.00.00.2);
      
//++++++++++++++++++++++++++++ NAME LABEL --------------------------------------------------
    
return 1;
}
public 
OnPlayerSpawn(playerid)
{
    for(new 
txd 0txd <= 16txd++) TextDrawHideForPlayer(playeridInicioserver[txd]);
    
// admin
    
new arquivi[34], nomeplayer[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnomeplayersizeof(nomeplayer));
    
format(arquivisizeof(arquivi), "Admins/%s.ini"nomeplayer);
    
pAdmin[playerid][Level] = DOF2_GetInt(arquivi"Level");
    
//  admin
    
    
return 1;
}
public 
OnPlayerDisconnect(playerid)
{
    
// admin
    
new arquiva[34], playernome[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernomesizeof(playernome));
    
format(arquivasizeof(arquiva), "Admins/%s.ini"playernome);
    if(
DOF2_FileExists(arquiva))
    {
        
DOF2_SetInt(arquiva"Level"pAdmin[playerid][Level]);
        
DOF2_SaveFile();
    }
    else
    {
        
DOF2_CreateFile(arquiva);
        
DOF2_SetInt(arquiva"Level"pAdmin[playerid][Level]);
        
DOF2_SaveFile();
    }
    
// admin
    
    
return 1;
}
public 
OnPlayerRequestClass(playeridclassid)
{
    
SpawnPlayer(playerid);
    
SetPlayerCameraPos(playerid, -2551.772751.12130.06);
    
SetPlayerCameraLookAt(playerid, -2557.272748.87129.20);
    return 
1;
}
/////////////////////////////////////COMANDOS/////////////////////////////////////////////
CMD:gl(playerid,params[]){
    new 
texto[128],string[230];
    if(
sscanf(params,"s[128]",texto))
    return 
SendClientMessage(playerid,-1,"Use: /global [texto]");
    
format(string,230,"(( GLOBAL )): %s: %s",Nome(playerid),texto);
    
SendClientMessageToAll(-1,string);
    return 
1;
}
CMD:slap(playeridparams[])
{
    new 
Playersstring[128], reason[128];
    if(
sscanf(params"us"Playersreason)) return SendClientMessage(playeridCOR_ERRO"SERVER: /slap [playerid] [reason]");
    if(
pAdmin[playerid][Level] < 2) return SendClientMessage(playeridCOR_ERRO"ERROR: You do not have permission.");
    if(
pAdmin[playerid][Level] < 1) return SendClientMessage(playeridVERMELHO"ERROR: You do not have permission.");
    if(
Players == INVALID_PLAYER_ID) return SendClientMessage(playeridCOR_ERRO"ERROR: Invalid player ID.");
    new 
Float:XFloat:YFloat:Z;
    
GetPlayerPos(PlayersXYZ);
    
SetPlayerPos(PlayersXYZ+9);
    
format(stringsizeof(string), "SERVER: Administrator: {FFFFFF}%s(%d) {d42525}has slapped you. (Reason: {FFFFFF}%s{d42525} )"p_name(playerid), playeridreason);
    
SendClientMessage(Players,COR_ERRO,string);
    return 
1;
}
CMD:setadmin(playeridparams[])
{
    new 
idlevelstring[256], string2[256], ganhou[MAX_PLAYER_NAME], deu[MAX_PLAYER_NAME];
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xAD0000AA"{00E5FF}Vocк nгo estб autorizado.");
    if(
sscanf(params"ud"idlevel)) return SendClientMessage(playerid0xAD0000AA"Use /daradmin [ID] [LEVEL]");
    if (
level || level 6) return SendClientMessage(playerid0xFF0000FF"Level invбlido. Use de 1 б 6 .");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid0xAD0000AA"Este jogador nгo estб online.");
    
GetPlayerName(idganhousizeof(ganhou));
    
GetPlayerName(playeriddeusizeof(deu));
    
format(stringsizeof(string), "Vocк deu admin level %s para o %s"GetLevelAdmin(level), ganhou);
    
SendClientMessage(playerid0x00F6F6AAstring);
    
format(string2sizeof(string2), "O admin %s deu admin level %s para vocк."deu GetLevelAdmin(level));
    
SendClientMessage(idVERDEstring2);
    
pAdmin[id][Level] =  level;
    
save_player(id);
    return 
1;
}
CMD:lockadmin(playeridparams[])
{
    new 
idplayer[MAX_PLAYER_NAME], tirou[MAX_PLAYER_NAME], string[256], string2[256];
    if (
pAdmin[playerid][Level] != 5) return SendClientMessage(playerid0xAD0000AA"Vocк nгo estб autorizado.");
    if (
sscanf(params"u"id)) return SendClientMessage(playerid0xAD0000AA"Use /tiraradmin [ID] ");
    if (
pAdmin[id][Level] < 1) return SendClientMessage(playeridVERMELHO"Este player nгo й admin ! ");
    
GetPlayerName(idplayersizeof(player));
    
GetPlayerName(playeridtirousizeof(tirou));
    
format(stringsizeof(string), "Vocк tirou o admin do %s"player);
    
SendClientMessage(playerid0x00F6F6AAstring);
    
format(string2sizeof(string2), "O admin %s tirou seu admin."tirou);
    
SendClientMessage(idVERDEstring2);
    
pAdmin[playerid][Level] = 0;
    return 
1;
 }
 
CMD:get(playeridparams[])
{
    if(
pAdmin[playerid][Level] < 1) return SendClientMessage(playeridVERMELHO,"Vocк nгo estб autorizado.");
    new 
idFloatxFloatyFloatzstring[256], string2[256], namep[MAX_PLAYER_NAME], namead[MAX_PLAYER_NAME];
    if(
sscanf(params"u"id)) return SendClientMessage(playeridVERMELHO,"Use /trazer [ID]");
    if(!
IsPlayerConnected(id)) return SendClientMessage(playeridVERMELHO,"Este jogador nгo estб online.");
    
GetPlayerName(playeridnameadsizeof(namead));
    
GetPlayerName(idnamepsizeof(namep));
    
format(stringsizeof(string), "Trouxe o player %s atй vocк."namep);
    
format(string2sizeof(string2), "The Administrator %s  trouxe vocк atй ele."namead);
    
SendClientMessage(playeridAzul_Cstring);
    
SendClientMessage(idVERDEstring2);
    
GetPlayerPos(playeridxyz);
    
SetPlayerPos(idx+1y+1z);
    return 
1;
}
CMD:killp(playeridparams[])
{
    new 
vida;
    new 
playerydstr[128], reason[128];
    if(
pAdmin[playerid][Level] < 1) return SendClientMessage(playeridVERMELHO,"Vocк nгo estб autorizado.");
    if(
sscanf(params"ds"vida)) return SendClientMessage(playeridAzul_C" /killp [ID] [REASON]");
     if(!
IsPlayerConnected(playeryd)) return SendClientMessage(playerid, -1"[ERROR]: Player not found");
     
//fomart(str, sizeof(str), "SERVER: Administrator: {FFFFFF}%s(%d) {d42525}has slapped you. (Reason: {FFFFFF}%s{d42525} )",
      
format(strsizeof(str), "SERVER: Administrator: {FFFFFF}%s(%d) {d42525}has killed you. (Reason: {FFFFFF}%s{d42525} )"p_name(playerid), playeridreason);
      
SendClientMessage(playeryd,COR_ERRO,str);
    return 
1;
}
CMD:ride(playeridparams[])
{
    new 
id strval(params);
    new 
plid;
    new 
numero;
    new 
playeryd;
    new 
VehicleID;
    if(
pAdmin[playerid][Level] < 1) return SendClientMessage(playeridVERMELHO,"Vocк nгo estб autorizado.");
     if(
sscanf(params"d"playerydnumero)) return SendClientMessage(playerid, -1"[ERROR]: Incorrect: /ride [ID].");
    if(
id == playerid) return SendClientMessage(playerid0xFF0000AA"You can not go yourself !!!");
    if(!
IsPlayerConnected(playeryd)) return SendClientMessage(playerid, -1"[ERROR]: Player not found");
    
VehicleID GetPlayerVehicleID(playerid);
    
PutPlayerInVehicle(playerid,VehicleID,1);
    
SendClientMessage(plid, -1" | INFO | successfully performed command");
    return 
1;
}
/////////////////////////////////////COMANDOS/////////////////////////////////////////////
/***************************** *************************************************/
forward Kicka(p); public Kicka(p) {
    
#undef Kick
    
Kick(p);
    
#define Kick(%0) SetTimerEx("Kicka", 100, false, "i", %0)
    
return 1;
}
Nome(playerid){
    new 
name[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,name,24);
    return 
name;
}
/******************************************************************************/
stock GetLevelAdmin(levelid)
{
    new 
str[50];
    if(
levelid == 1)
    {
        
str "1";
    }
    else if (
levelid == 2)
    {
        
str "2";
    }
    else if (
levelid == 3)
    {
        
str "3";
    }
    else if (
levelid == 4)
    {
        
str "4";
    }
    else if (
levelid == 6)
    {
        
str "5";
    }
        else if (
levelid == 5)
    {
        
str "6";
    }
    return 
str;
}
stock p_nameplayerid )
{
    new 
p_namev[MAX_PLAYER_NAME];
    
GetPlayerName(playeridp_namevMAX_PLAYER_NAME);
    return 
p_namev;
}
function::
save_player(playerid)
{
    new 
nome_player[MAX_PLAYER_NAME];
    new 
arquivo[34];
    
GetPlayerName(playeridnome_playersizeof(nome_player));
    
format(arquivosizeof(arquivo), "Admins/%s.ini"nome_player);
    if(!
DOF2_FileExists(arquivo))
    
DOF2_CreateFile(arquivo);
    if(
DOF2_FileExists(arquivo))
    
DOF2_SetInt(arquivo"Level"pAdmin[playerid][Level]);
    
DOF2_SaveFile();
    return 
1;

Reply
#10

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Tente assim:
PHP код:
#include <a_samp>
#include <DOF2>
#include <sscanf>
#define function::%0(%1) forward %0(%1);public %0(%1)
function::save_player(playerid
{
    new
        
nome_player[MAX_PLAYER_NAME]
        
arquivo[34]
    ;
    
GetPlayerName(playeridnome_playersizeof(nome_player));
    
format(arquivosizeof(arquivo), "Admins/%s.ini"nome_player);
    if(!
DOF2_FileExists(arquivo)) 
        
DOF2_CreateFile(arquivo);
    if(
DOF2_FileExists(arquivo))
        
DOF2_SetInt(arquivo"Level"pAdmin[playerid][Level]); 
        
DOF2_SaveFile();
    return 
1;
}
CMD:setadmin(playeridparams[]) 

    new 
idlevelstring[256], string2[256], ganhou[MAX_PLAYER_NAME], deu[MAX_PLAYER_NAME]; 
    if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid0xAD0000AA"{00E5FF}Vocк nгo estб autorizado."); 
    if(
sscanf(params"ud"idlevel)) return SendClientMessage(playerid0xAD0000AA"Use /daradmin [ID] [LEVEL]"); 
    if (
level || level 6) return SendClientMessage(playerid0xFF0000FF"Level invбlido. Use de 1 б 6 ."); 
    if(!
IsPlayerConnected(id)) return SendClientMessage(playerid0xAD0000AA"Este jogador nгo estб online."); 
    
GetPlayerName(idganhousizeof(ganhou)); 
    
GetPlayerName(playeriddeusizeof(deu)); 
    
format(stringsizeof(string), "Vocк deu admin level %s para o %s"GetLevelAdmin(level), ganhou); 
    
SendClientMessage(playerid0x00F6F6AAstring); 
    
format(string2sizeof(string2), "O admin %s deu admin level %s para vocк."deu GetLevelAdmin(level)); 
    
SendClientMessage(idVERDEstring2); 
    
pAdmin[id][Level] =  level;
    
save_player(id); 
    return 
1

Up up
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)