Sistema de administraзгo -
DwScript - 13.01.2015
Olб а todos!
Seguindo alguns tutoriais da board consegui um conhecimento bбsico, atй porque sei javascript e a sintaxe й bem igual.
Estou desenvolvendo um GameMode do 0, sei vбrias coisas jб, mas estou meio confuso, ao ver este cуdigo:
http://forum.sa-mp.com/showpost.php?...67&postcount=3
achei bem interessante, e estou fazendo um sistema de administraзгo, mas nгo sei como implementar este sisteminha, meu Filterscript:
OBS: o cуdigo estб como dAdmin by neur0n, neur0n й o nome que eu ia colocar na conta, mas sу pensei no nome depois de ter criado

nгo pensem que copiei um sistema nгo!
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
#include <a_samp>
//#include YSI\y_commands
#include <sscanf>
#include <bINi>
#include <zcmd>
#define GetNick(%0) (GetPlayerName(playerid, dPlayerData[%0][dNome], 24), dPlayerData[%0][dNome])
#define IsPlayerLogged(%0) dPlayerData[%0][dLogged]
//Cores
#define COR_RED 0xFF0000FF
#define COR_ADMIN 0x21C9EDFF
#define COR_GREEN 0x00D500FF
#define COR_TRUCKER 0x804040FF
#define COR_POLICIA 0x004080FF
//FIM CORES
enum dAdmin{
bool: dLogged,
dNome[24],
dPlayer,
dNivel,
dValor,
dLevel,
};
new dPlayerData [ MAX_PLAYERS ] [ dAdmin ], dString [128];
CMD:setlevel(playerid, params[])
{
if(!IsPlayerAdmin(playerid)){ // verificar se й administrador RCON.
if(!IsPlayerLogged(playerid)) // Verificar se estб logado no sistema
return SendClientMessage(playerid, COR_RED, "[ERRO]: Vocк nгo estб logado para usar este comando");
if(dPlayerData[playerid][dNivel] < 5) // Verificar se estб com autorizaзгo
return SendClientMessage(playerid, COR_RED, "[ERRO]: Vocк nгo tem nнvel suficiente para usar este comando!");
}
if(sscanf(params, "ii", dPlayerData[playerid][dPlayer], dPlayerData[playerid][dValor]))
return SendClientMessage(playerid, COR_RED, "[CMD]: Uso: /Setlevel <id> <level>");
if(!IsPlayerConnected(dPlayerData[playerid][dPlayer]))
return SendClientMessage(playerid, COR_RED, "[ERRO]: Player nгo conectado!");
if(dPlayerData[playerid][dValor] < 0 || dPlayerData[playerid][dValor] > 5)
return SendClientMessage(playerid, COR_RED, "[ERRO]: Nнvel invбlido!, escolha de 0(retirar moderaзгo) atй 5(admin master)");
static tempID;
tempID = dPlayerData[playerid][dPlayer];
if(!dPlayerData[tempID][dLogged])
return SendClientMessage(playerid, COR_RED, "[ERRO]: Player nгo logado!");
dPlayerData[tempID][dNivel] = dPlayerData[playerid][dValor];
format(dString, 128, "[ADMIN] O Administrador %s deu ao player %s o nнvel de administraзгo #%i", GetNick(playerid), GetNick(tempID), dPlayerData[playerid][dValor]);
SendClientMessageToAll(COR_ADMIN, dString);
return true;
}
//Profissхes
#define PROF_DESEMPREGADO 1
#define PROF_CAMINHONEIRO 2
#define PROF_POLICIAL 3
new Profissao[MAX_PLAYERS];
CMD:caminhoneiro(playerid, params[])
{
if(Profissao[playerid] != PROF_CAMINHONEIRO)
{
Profissao[playerid] = PROF_CAMINHONEIRO;
SendClientMessage(playerid, COR_GREEN,"[SYS] Vocк agora й caminhoneiro!");
SetPlayerColor(playerid,COR_TRUCKER);
SetPlayerSkin(playerid,241);
}
else
{
SendClientMessage(playerid, COR_RED,"[SYS] Vocк jб й caminhoneiro");
}
return 1;
}
forward CarregarProfissao(playerid);
public CarregarProfissao(playerid)
{
if(Profissao[playerid] == PROF_DESEMPREGADO)
{
SetPlayerColor(playerid, -1);
SendClientMessage(playerid, COR_RED,"[SYS] Vocк estб atualmente desempregado, arrume um emprego.");
}
else if(Profissao[playerid] == PROF_CAMINHONEIRO)
{
SetPlayerColor(playerid, COR_TRUCKER);
SendClientMessage(playerid, COR_TRUCKER,"[SYS] Vocк spawnou como caminhoneiro.");
}
}
//Fim profissхes
//Sistema de level e exp
new Respeito[MAX_PLAYERS], Level[MAX_PLAYERS];
forward Resp(playerid);
public Resp(playerid)
{
Respeito[playerid]++;
if(Respeito[playerid] == 1){SendClientMessage(playerid,COR_GREEN,"[SYS] Vocк ganhou 1/5 EXP");}
else if(Respeito[playerid] == 2){SendClientMessage(playerid,COR_GREEN,"[SYS] Vocк ganhou 2/5 EXP");}
else if(Respeito[playerid] == 3){SendClientMessage(playerid,COR_GREEN,"[SYS] Vocк ganhou 3/5 EXP");}
else if(Respeito[playerid] == 4){SendClientMessage(playerid,COR_GREEN,"[SYS] Vocк ganhou 4/5 EXP");}
else if(Respeito[playerid] == 5){SendClientMessage(playerid,COR_GREEN,"[SYS] Vocк ganhou 5/5 EXP e subiu um level");}
if(Respeito[playerid] == 5)
{
Level[playerid]++;
SendClientMessage(playerid,COR_GREEN,"[SYS]Vocк evoluiu um level!");
Respeito[playerid] = 0;
SetPlayerScore(playerid,Level[playerid]);
GivePlayerMoney(playerid, 500);
}
return 1;
}
//Fim Sistema de level
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("|---------| dAdmin by neur0n |---------");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
#endif
public OnPlayerConnect(playerid)
{
for(new i, e = _:dAdmin; i != e; ++i){
dPlayerData[playerid][dAdmin: i] = 0;
}
SetTimerEx("Resp", 1000, true, "i", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
CarregarProfissao(playerid);
Resp(playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
O cуdigo tб comentado, entгo nгo vai ser difнcil de achar o local do cуdigo.
Grato а quem ajudar.
Re: Sistema de administraзгo -
ipsLuan - 13.01.2015
Vai pegando o conteъdo de cada callback (public) e passando pro seu GameMode/FilterScript.
Re: Sistema de administraзгo -
DwScript - 13.01.2015
Й que estou fazendo o filterscript separado para nгo encher de linhas no GM...
Re: Sistema de administraзгo -
JonathanFeitosa - 13.01.2015
Utilize pVar caso queria usar vбriaveis GM+FS.
Recomendo que leia esse tutorial:
https://sampforum.blast.hk/showthread.php?tid=557107