new Admin[MAX_PLAYERS];
if(Admin[playerid] == 1)
public OnPlayerCommandText(playerid, cmdtext[])
{
new tmp[256], cmd[256], idx;
if(strcmp(cmd, "/setar", true) == 0)
{
if(Admin[playerid] == 1)
{
new gstring[256];
new Recebeu[256];
new id = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, -1, "| ERRO | Digite: /Setar [Id da Pessoa]");
return 1;
}
Admin[id] = 1;
format(gstring, sizeof(gstring), "| SETAR | Vocк setou ao jogador %s Admin!", id);
SendClientMessage(playerid, -1, gstring);
format(Recebeu, sizeof(Recebeu), "| MEGASENA | Vocк ganhou admin do Ademir %s", playerid);
SendClientMessage(id, -1, Recebeu);
}
else
{
SendClientMessage(playerid, -1, "| ERRO | Tu nгo й admin Nгo Safado KKK");
return 1;
}
}
return 0;
}
#include <a_samp>
#include <gl_common.inc> new Admin[MAX_PLAYERS]; PHP Code:
|
#include <a_samp>
#include <zcmd>
#include <sscanf2>
//#include <Pawn.CMD>
enum pew{
Admin
}
new PlayerInfo[MAX_PLAYERS][pew];
cmd:daradmin(playerid, params[])
{
new OutroJogador, Level, adm[MAX_PLAYER_NAME], nome[MAX_PLAYER_NAME], msg[86];
if(IsPlayerAdmin(playerid))
{
if (sscanf(params, "ui", OutroJogador, Level)) SendClientMessage(playerid, -1, "Use: /daradmin [ID] [Level]");
{
if (IsPlayerConnected(OutroJogador))
{
if(Level == 0) return SendClientMessage(playerid, 0xFF0000AA, "O jogador nгo pode ter seu level igual a zero!");
PlayerInfo[OutroJogador][Admin] = 1;
GetPlayerName(playerid, adm, sizeof(adm));
GetPlayerName(OutroJogador, nome, sizeof(nome));
format(msg, 86, "O administrador %s promoveu o jogador %s para o level 1!", adm, nome);
SendClientMessageToAll(-1, msg);
}
else SendClientMessage(playerid, 0xFF0000FF, "O jogador nгo estб online!");
}
}
else SendClientMessage(playerid, 0xFF0000FF, "Vocк precisa estб logado na RCON para usar esse comando!");
return 1;
}
cmd:tiraradm(playerid, params[])
{
new OutroJogador, Level, adm[MAX_PLAYER_NAME], nome[MAX_PLAYER_NAME], msg[86];
if(IsPlayerAdmin(playerid))
{
if (sscanf(params, "ui", OutroJogador, Level)) SendClientMessage(playerid, -1, "Use: /tiraradm [ID] [Level]");
{
if (IsPlayerConnected(OutroJogador))
{
PlayerInfo[OutroJogador][Admin] = 0;
GetPlayerName(playerid, adm, sizeof(adm));
GetPlayerName(OutroJogador, nome, sizeof(nome));
format(msg, 86, "O administrador %s rebaixou o jogador %s para o level 0!", adm, nome);
SendClientMessageToAll(-1, msg);
}
else SendClientMessage(playerid, 0xFF0000FF, "O jogador nгo estб online!");
}
}
else SendClientMessage(playerid, 0xFF0000FF, "Vocк precisa estб logado na RCON para usar esse comando!");
return 1;
}
if (strcmp("/DarAdmin", cmdtext, true, 8) == 0) { new id, nivel; if(sscanf(params, "ud", id, nivel)) return SendClientMessage(playerid, -1, "Digite: '/setadmin' [ID] [NIVEL]"); Admin[id] = nivel; return 1; }
C:\Users\PC\Desktop\Cidade Vida Social RPG [v0.5]\gamemodes\CVSR.pwn(449) : error 001: expected token: "-string end-", but found "-identifier-" C:\Users\PC\Desktop\Cidade Vida Social RPG [v0.5]\gamemodes\CVSR.pwn(449) : warning 215: expression has no effect C:\Users\PC\Desktop\Cidade Vida Social RPG [v0.5]\gamemodes\CVSR.pwn(449) : warning 215: expression has no effect C:\Users\PC\Desktop\Cidade Vida Social RPG [v0.5]\gamemodes\CVSR.pwn(449) : error 001: expected token: ";", but found ")" C:\Users\PC\Desktop\Cidade Vida Social RPG [v0.5]\gamemodes\CVSR.pwn(449) : error 029: invalid expression, assumed zero C:\Users\PC\Desktop\Cidade Vida Social RPG [v0.5]\gamemodes\CVSR.pwn(449) : fatal error 107: too many error messages on one line
if(Admin[playerid] == 0) 2 3 tenho 3 leveis
if (strcmp("/DarAdmin", cmdtext, true, 8) == 0) { if(IsPlayerAdmin(playerid)) { new id, nivel; if(sscanf(cmdtext, "ud", id, nivel)) return SendClientMessage(playerid, -1, "Use: /DarAdmin [ID] [Level]"); } return 1; }
A funзгo jб estб setada normalmente, apenas sem nenhuma mensagem para ser enviada ao cliente(remetente).
Caso queira restringir a quantidade de niveis, insira a condicional.: PHP Code:
|
if(0 <= nivel <= 3) return SendClientMessage(...);
new Admin[MAX_PLAYERS]; CMD:setadmin(playerid, params[]) { new id, nivel; if(sscanf(params, "ud", id, nivel)) return SendClientMessage(playerid, -1, "Digite: '/setadmin' [ID] [NIVEL]"); Admin[id] = nivel; return true; }
#include <a_samp>
#include <sscanf2>
#include <zcmd>
CMD:dararma(playerid, params[])
{
if(!IsPlayerAdmin(playerid)
return SendClientMessage(playerid, 0xFF0000FF, "|ERRO| » Vocк nгo й Admin RCON!");
new player1, ArmaNome[32], IdArma, Quantia, ArmaNome2[32], string[128];
if(sscanf(params, "us[32]D(500)", player1, ArmaNome, Quantia))
return SendClientMessage(playerid, 0xFF0000FF, "|USE| » /dararma [playerid] [arma id/arma nome] [muniзгo]");
if(player1 == INVALID_PLAYER_ID)
return SendClientMessage(playerid, 0xFF0000FF, "|ERRO| » O jogador nгo estб conectado.");
if(!IsNumeric(ArmaNome)) IdArma = GetWeaponIDFromName(ArmaNome); else IdArma = strval(ArmaNome);
GetWeaponName(IdArma, ArmaNome2, 32);
format(string, sizeof(string), "Vocк deu a arma %s (%d) com %d de muniзгo para o jogador: \"%s\"", ArmaNome2, IdArma, Quantia, pName(player1));
SendClientMessage(playerid, 0x00FF00FF, string);
if(player1 != playerid)
{
format(string,sizeof(string),"O Admin \"%s\" te deu a arma %s (%d) com %d de muniзгo", pName(playerid), ArmaNome2, IdArma, Quantia);
SendClientMessage(player1, 0xFFFF00FF, string);
}
GivePlayerWeapon(player1, IdArma, Quantia);
return 1;
}
stock GetWeaponIDFromName(WeaponName[])
{
if(strfind("molotov",WeaponName,true)!=-1) return 18;
for(new i = 0; i <= 46; i++)
{
switch(i)
{
case 0,19,20,21,44,45: continue;
default:
{
new name[32]; GetWeaponName(i,name,32);
if(strfind(name,WeaponName,true) != -1) return i;
}
}
}
return -1;
}
stock IsNumeric(string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}