[AJUDA] Comandos de Admin -
FLeEX - 03.02.2012
Eu queria fazer um comando cmdlist pra mim poder ver todos os meus comandos de admin ou entгo descobrir qual o comando pra ver. Sou novato no extremo.
Re: [AJUDA] Comandos de Admin -
humildadeforever - 03.02.2012
Vocк quer em Dialog ou mensagens no chat mesmo ?
Re: [AJUDA] Comandos de Admin -
Kuddy - 03.02.2012
Pra descobrir vocк pode usar o search do pawn, eh CTRL + F ou CTRL + H, eu nгo uso o pawno por isso nгo sei, rs.
Dai vai abrir uma janelinha com o nome de search, tu procura por /ban ou outro comando padrгo e vai avanзando atй encontrar o comando de ver os comandos.
Mas fazer o comando de ver os comandos nгo й difнcil... Se nгo encontrar o comando fala ae pq alguem do forum te ajuda ae pq agr to saindo =/
Re: [AJUDA] Comandos de Admin -
humildadeforever - 03.02.2012
Olha sу, primeiramente vai na public OnPlayerCommandText, lб й a public dos comandos, aн vocк vк os comandos que sгo de admins e faz um comando aparecendo todos eles, exemplo de comando:
pawn Код:
if(strcmp(cmdtext, "/comandosadm", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Vocк nгo й Admin, nгo interessa pra vocк!");//AHUAHUAHA
SendClientMessage(playerid,-1,"|------------------Comandos de admin-----------------|");
SendClientMessage(playerid,-1,"/comando1 /comando2 /comando3 /comando4 ");
SendClientMessage(playerid,-1,"/comando5 /comando6 /comando7 /comando8");
SendClientMessage(playerid,-1,|-------------------------------------------------------|");
return 1;
}
Re: [AJUDA] Comandos de Admin -
FLeEX - 03.02.2012
Й isso aн mesmo humildadeforever. Brigadгo
Bom... Para nгo criar outro tуpico eu queria aproveitar e perguntar como que eu faзo comando para um grupo expecifico. Exemplo:
/cmdmod
/cmdmaster
/cmddono
Ai como eu faзo pros Moderadores sу poderem acessar o /cmdmod ??
Re: [AJUDA] Comandos de Admin -
humildadeforever - 03.02.2012
Bom, vocк usa PlayerInfo[playerid][pAdmin] pra verificar se й admin ? Se sim, qual й o nнvel do moderador ?
Re: [AJUDA] Comandos de Admin -
FLeEX - 03.02.2012
Nнvel 1
Re: [AJUDA] Comandos de Admin -
[Pawno] - 03.02.2012
Exemplo:
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 1)
{
//Funзгo
}
Re: [AJUDA] Comandos de Admin -
dPlaYer_ - 03.02.2012
Vocк pode criar um sistema de admin bбsico:
pawn Код:
#include <a_samp>
#include <dini>
new pAdmin[MAX_PLAYERS];
new admin[MAX_PLAYERS]= 0;
public OnPlayerConnect(playerid)
{
pAdmin[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), DIRETORIO, aname);
dini_IntSet(file, "LevelAdm", pAdmin[playerid]);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(pAdmin[playerid]> 0) admin[playerid] = 1;
dini_IntSet(file, "LevelAdm", pAdmin[playerid]);
}
return 1;
}
public OnPlayerCommandText(playerid,cmdtext[])
{
if(strcmp(cmd,"/setadmin", true)==0)
{
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
if(IsPlayerAdmin(playerid))
{
new plid, leveladm;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, Vermelho, "(INFO) Digite: /setadmin [id] [Level]");
return 1;
}
plid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, Vermelho, "(INFO) Digite: /setadmin [id] [Level]");
return 1;
}
leveladm = strval(tmp);
if(leveladm>=7)
{
SendClientMessage(playerid, Vermelho, "(INFO) Niveis permitidos: 0 a 6.");
return 1;
}
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
if(IsPlayerConnected(plid))
{
if(leveladm>=1)
{
pAdmin[plid] = leveladm;
dini_IntSet(file, "LevelAdm",leveladm);
format(string, sizeof(string), "(INFO) Vocк foi promovido a Admin Level %d por : %s!", leveladm,aname);
SendClientMessage(plid,vbadm, string);
if(leveladm>1)
{
}
}
if(leveladm == 0)
{
pAdmin[plid] = 0;
dini_IntSet(file, "LevelAdm",0);
format(string, sizeof(string), "(INFO) %s , retirou seu admin!",aname);
SendClientMessage(plid,vbadm, string);
if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1);
}
return 1;
}
else {
SendClientMessage(playerid, Vermelho, "(INFO) Jogador nгo conectado.");
return 1;
}
}
}
if(!strcmp(cmdtext,"/admins", true))
{
SendClientMessage(playerid,vbadm, "- Adminstradores Conetados -");
static bool: result;
for(new i; i < MAX_PLAYERS; ++i)
{
new pname[24];
GetPlayerName(i,pname,24);
if(IsPlayerConnected(i) && pAdmin[i] > 0)
{
if(pAdmin[i] == 1)
{
format(string,sizeof(string),"[%s] (%d) ~ [Sub-Moderador]", pname,i);
}
if(pAdmin[i] == 2)
{
format(string,sizeof(string),"[%s] (%d) ~ [Moderador]", pname,i);
}
if(pAdmin[i] == 3)
{
format(string,sizeof(string),"[%s] (%d) ~ [Adminstrador]", pname,i);
}
if(pAdmin[i] == 4)
{
format(string,sizeof(string),"[%s] (%d) ~ [Admin Master]", pname,i);
}
if(pAdmin[i] == 5)
{
format(string,sizeof(string),"[%s] (%d) ~ [Sub-Dono]", pname,i);
}
if(pAdmin[i] == 6)
{
format(string,sizeof(string),"[%s] (%d) ~ [Adminstrador Dono]", pname,i);
}
SendClientMessage(playerid, COLOR_WHITE, string);
result = true;
}
}
if(!result)
return SendClientMessage(playerid, -1,"(x) Nгo tem nenhum administrador online no momento!");
return true;
}
return 0;
}
Vocк pode adicionar um comando pra admistrador assim:
para os 6 leveis
pawn Код:
if(strcmp(cmd, "/teste",true) == 0)
{
if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5 || pAdmin[playerid] == 6)
{
SendClientMessage(playerid, 0x008000AA, "SUCK MY EGGS '-'");
return 1;
}
}
Para 3 leveis
pawn Код:
if(strcmp(cmd, "/teste",true) == 0)
{
if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3)
{
SendClientMessage(playerid, 0x008000AA, "SUCK MY DICK off' '-'");
return 1;
}
}
Na Variavel de login vc coloca:
pawn Код:
pAdmin[playerid] = dini_Int(file, "LevelAdm");
Re: [AJUDA] Comandos de Admin -
[Pawno] - 03.02.2012
Quote:
Originally Posted by [LF]PlaYer
Vocк pode criar um sistema de admin bбsico:
pawn Код:
#include <a_samp> #include <dini>
new pAdmin[MAX_PLAYERS]; new admin[MAX_PLAYERS]= 0;
public OnPlayerConnect(playerid) { pAdmin[playerid] = 0; return 1; }
public OnPlayerDisconnect(playerid, reason) { new aname[MAX_PLAYER_NAME]; GetPlayerName(playerid, aname, MAX_PLAYER_NAME); format(file, sizeof(file), DIRETORIO, aname); dini_IntSet(file, "LevelAdm", pAdmin[playerid]); return 1; }
public OnPlayerSpawn(playerid) { if(pAdmin[playerid] == 0) { admin[playerid] = 0; dini_IntSet(file, "LevelAdm", 0); } if(pAdmin[playerid] == 1) { admin[playerid] = 1; dini_IntSet(file, "LevelAdm", 1); } if(pAdmin[playerid] == 2) { admin[playerid] = 1; dini_IntSet(file, "LevelAdm", 2); } if(pAdmin[playerid] == 3) { admin[playerid] = 1; dini_IntSet(file, "LevelAdm", 3); } if(pAdmin[playerid] == 4) { admin[playerid] = 1; dini_IntSet(file, "LevelAdm", 4); } if(pAdmin[playerid] == 5) { admin[playerid] = 1; dini_IntSet(file, "LevelAdm", 5); } if(pAdmin[playerid] == 6) { admin[playerid] = 1; dini_IntSet(file, "LevelAdm", 6); }
public OnPlayerCommandText(playerid,cmdtext[]) { if(strcmp(cmd,"/setadmin", true)==0) { new aname[MAX_PLAYER_NAME]; GetPlayerName(playerid, aname, MAX_PLAYER_NAME); if(IsPlayerAdmin(playerid)) { new plid, leveladm; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, Vermelho, "(INFO) Digite: /setadmin [id] [Level]"); return 1; } plid = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, Vermelho, "(INFO) Digite: /setadmin [id] [Level]"); return 1; } leveladm = strval(tmp); if(leveladm>=7) { SendClientMessage(playerid, Vermelho, "(INFO) Niveis permitidos: 0 a 6."); return 1; } new pname[MAX_PLAYER_NAME]; GetPlayerName(plid, pname, MAX_PLAYER_NAME); if(IsPlayerConnected(plid)) { if(leveladm>=1) { pAdmin[plid] = leveladm; dini_IntSet(file, "LevelAdm",leveladm); format(string, sizeof(string), "(INFO) Vocк foi promovido a Admin Level %d por : %s!", leveladm,aname); SendClientMessage(plid,vbadm, string); if(leveladm>1) { } } if(leveladm == 0) { pAdmin[plid] = 0; dini_IntSet(file, "LevelAdm",0); format(string, sizeof(string), "(INFO) %s , retirou seu admin!",aname); SendClientMessage(plid,vbadm, string); if(IsPlayerAttachedObjectSlotUsed(playerid,1)) RemovePlayerAttachedObject(playerid,1); } return 1; } else { SendClientMessage(playerid, Vermelho, "(INFO) Jogador nгo conectado."); return 1; } } }
if(!strcmp(cmdtext,"/admins", true)) { SendClientMessage(playerid,vbadm, "- Adminstradores Conetados -"); static bool: result; for(new i; i < MAX_PLAYERS; ++i) { new pname[24]; GetPlayerName(i,pname,24); if(IsPlayerConnected(i) && pAdmin[i] > 0) { if(pAdmin[i] == 1) { format(string,sizeof(string),"[%s] (%d) ~ [Sub-Moderador]", pname,i); } if(pAdmin[i] == 2) { format(string,sizeof(string),"[%s] (%d) ~ [Moderador]", pname,i); } if(pAdmin[i] == 3) { format(string,sizeof(string),"[%s] (%d) ~ [Adminstrador]", pname,i); } if(pAdmin[i] == 4) { format(string,sizeof(string),"[%s] (%d) ~ [Admin Master]", pname,i); } if(pAdmin[i] == 5) { format(string,sizeof(string),"[%s] (%d) ~ [Sub-Dono]", pname,i); } if(pAdmin[i] == 6) { format(string,sizeof(string),"[%s] (%d) ~ [Adminstrador Dono]", pname,i); } SendClientMessage(playerid, COLOR_WHITE, string); result = true; } } if(!result) return SendClientMessage(playerid, -1,"(x) Nгo tem nenhum administrador online no momento!"); return true; } return 0; }
Vocк pode adicionar um comando pra admistrador assim:
para os 6 leveis
pawn Код:
if(strcmp(cmd, "/teste",true) == 0) { if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5 || pAdmin[playerid] == 6) { SendClientMessage(playerid, 0x008000AA, "SUCK MY EGGS '-'"); return 1; } }
Para 3 leveis
pawn Код:
if(strcmp(cmd, "/teste",true) == 0) { if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3) { SendClientMessage(playerid, 0x008000AA, "SUCK MY DICK off' '-'"); return 1; } }
Na Variavel de login vc coloca:
pawn Код:
pAdmin[playerid] = dini_Int(file, "LevelAdm");
|
Quase bom, ao invez de usar variavel, usa-se uma 'enum'.
pawn Код:
enum pInfo
{
Admin,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
Ficando:
pawn Код:
PlayerInfo[playerid][Admin]