open.mp forum
[Pawn] Help with command - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] Help with command (/showthread.php?tid=2155)



Help with command - Pedxz - 2021-07-05

Welll, I update my command's permission to !IsPlayerAdmin, but now it doesn't want to work correctly, when i run the command it doesn't do anything.

***I changed the permission because the other one was having problems

Could you help me solve this??


Command:
Code:
CMD:setar(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_ERRO, "[ x ] Voc? n?o tem permiss?o!");

new id, sSetar[15];

if(sscanf(params, "ds[15]", id, sSetar)) return SendClientMessage(playerid, COLOR_ERRO, "[ x ] Uso correto: /Setar [ ID ] [ Administrador / Moderador / Ajudante ]");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_ERRO, "[ x ] Ningu?m online com esse ID!");

if(!strcmp(sSetar, "administrador", true))
{
if(GetPlayerCargo(id) != C_ADMIN)
{
format(gStr, sizeof(gStr), "[BPL Staff] Voc? tornou o(a) jogador(a) %s um(a) administrador(a).", pNome(id));
SendClientMessage(playerid, COLOR_VERDECMD, gStr);

format(gStr, sizeof(gStr), "[BPL Staff] %s tornou voc? um(a) administrador(a).", GetCargoMsg(playerid));
SendClientMessage(id, COLOR_VERDECMD, gStr);

SetPVarInt(id, "pCargo", C_ADMIN), aInfo[id][Cargo] = C_ADMIN;
}
else
{
format(gStr, sizeof(gStr), "[BPL Staff] Voc? removeu os privil?gios de administrador(a) do(a) jogador(a) %s", pNome(id));
SendClientMessage(playerid, COLOR_VERDECMD, gStr);

format(gStr, sizeof(gStr), "[BPL Staff] %s removeu seus privil?gios de administrador(a).", GetCargoMsg(playerid));
SendClientMessage(id, COLOR_VERDECMD, gStr);

SetPVarInt(id, "pCargo", C_JOGADOR), aInfo[id][Cargo] = C_JOGADOR;
}
}
else if(!strcmp(sSetar, "moderador", true))
{
if(GetPlayerCargo(playerid) != C_MODERADOR)
{
format(gStr, sizeof(gStr), "[BPL Staff] Voc? tornou o(a) jogador(a) %s um(a) moderador(a).", pNome(id));
SendClientMessage(playerid, COLOR_VERDECMD, gStr);

format(gStr, sizeof(gStr), "[BPL Staff] %s tornou voc? um(a) moderador(a).", GetCargoMsg(playerid));
SendClientMessage(id, COLOR_VERDECMD, gStr);

SetPVarInt(id, "pCargo", C_MODERADOR), aInfo[id][Cargo] = C_MODERADOR;
}
else
{
format(gStr, sizeof(gStr), "[BPL Staff] Voc? removeu os privil?gios de moderador(a) do(a) jogador(a) %s", pNome(id));
SendClientMessage(playerid, COLOR_VERDECMD, gStr);

format(gStr, sizeof(gStr), "[BPL Staff] %s removeu seus privil?gios de moderador(a).", GetCargoMsg(playerid));
SendClientMessage(id, COLOR_VERDECMD, gStr);

SetPVarInt(id, "pCargo", C_JOGADOR), aInfo[id][Cargo] = C_JOGADOR;
}
}
else if(!strcmp(sSetar, "ajudante", true))
{
if(GetPlayerCargo(playerid) != C_AJUDANTE)
{
format(gStr, sizeof(gStr), "[BPL Staff] Voc? tornou o(a) jogador(a) %s um(a) ajudante.", pNome(id));
SendClientMessage(playerid, COLOR_VERDECMD, gStr);

format(gStr, sizeof(gStr), "[BPL Staff] %s tornou voc? um(a) ajudante.", GetCargoMsg(playerid));
SendClientMessage(id, COLOR_VERDECMD, gStr);

SetPVarInt(id, "pCargo", C_AJUDANTE), aInfo[id][Cargo] = C_AJUDANTE;
}
else
{
format(gStr, sizeof(gStr), "[BPL Staff] Voc? removeu os privil?gios de ajudante do(a) jogador(a) %s", pNome(id));
SendClientMessage(playerid, COLOR_VERDECMD, gStr);

format(gStr, sizeof(gStr), "[BPL Staff] %s removeu seus privil?gios de ajudante.", GetCargoMsg(playerid));
SendClientMessage(id, COLOR_VERDECMD, gStr);

SetPVarInt(id, "pCargo", C_JOGADOR), aInfo[id][Cargo] = C_JOGADOR;
}
}
return 1;
}



RE: Help with command - Radical - 2021-07-06

IsPlayerAdmin() is for RCON?admin. (/rcon)

Not your custom admin system.



So, you have to logged-in to RCON?and then you can use this command.