Burgershot
[Pawn] Help with command - Printable Version

+- Burgershot (https://www.burgershot.gg)
+-- Forum: SA-MP (https://www.burgershot.gg/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://www.burgershot.gg/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.