como bloquear o cmd contra o admin dono? -
SonicFreeStyle - 14.10.2013
eae galera tipo vcs conhecem o famoso /darvida nй? de servidores rpg...intгo...eu queria fazer um code pra que tipo se o valor da vida for 0 e o ID da vitima for um admin dono ( if(PlayerInfo[playerid][pAdmin] == 3001) ) o comando bloqueace e setace o valor 0 para quem digitou o cmd...eu estou muito perdido com os If...olhem o code:
pawn Код:
if(strcmp(cmd, "/darvida", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 4)
{
SafadaTesudaDlc;
return 1;
}
if(admtrampando[playerid] < 1)
{
SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo estб em modo Admin USE: /profadmin");
return true;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvida [id] [quantia]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvida [id] [quantia]");
return 1;
}
level = strval(tmp);
GetPlayerName(para1, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
SetPlayerHealth(para1, level);
format(string, 128, "AdmCmd: %s deu %d de saъde para %s",sendername, level, giveplayer);
ABroadCast(0xC2CA7FFF,string,1);
comandosadminlog(string);
}
}
}
return 1;
}
entenderam? tipo se o meu id й 4 e ele digita /darvida 4 0 ele morre e aparece a frase "Vocк nгo pode matar um admin dono" saca? como eu faзo isso? :c
2° duvida,eu fiz um comando de /avo (/avisoorg) que ele й tipo o /aviso comum sabe quando o player leva 3 aviso ele й banido automatico? intгo pra evitar transtornos com membros das orgs eu fiz o /avo assim que o membro tiver 3 avisos ele й demitido automбticamente,porйm ta dando o erro "error 035: argument type mismatch (argument 1)" em uma linha ai porйm a linha estб normal entгo creio que o erro deve estar por perto...veja o comando:
pawn Код:
if(strcmp(cmd, "/avo", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /avo [id] [motivo]");
return true;
}
giveplayerid = ReturnUser(tmp);
new lolz = GetPlayerOrg(playerid);
if(PlayerInfo[giveplayerid][pMembro] != lolz)
{
SendClientMessage(playerid, COLOR_GREY, "Vocк nгo pode avisar quem nгo й da sua org.");
return 1;
}
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
if(strcmp(giveplayer,"Sonic_FreeStyle",true)==0)
{
SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo pode avisar o criador do server '-' !!!");
format(string, sizeof(string), "[Aviso] %s [ID: %d] tentou usar o comando /aviso em vocк!",PlayerName(playerid), playerid);
SendClientMessage(giveplayerid, COLOR_YELLOW, string);
return true;
}
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /avo [id] [motivo]");
return true;
}
PlayerInfo[giveplayerid][pWorg] += 1;
if(PlayerInfo[giveplayerid][pWorg] >= 3)
{
format(string, sizeof(string), "Lider: %s foi automaticamente demitido, Motivo: Passou de 3 avisos (%d-%d-%d)", giveplayer);
DemLog(string);
format(string, sizeof(string), "Lider: %s foi demitido automaticamente! pois passou de 3 avisos!", giveplayer);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "Lider: 1 nova vaga foi aberta pelo lider %s", sendername);
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
OnPlayerCommandText(giveplayer,"/avdemitidoporra");
}
format(string, sizeof(string), "LiderCmD: %s foi avisado por %s, Motivo: %s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_LIGHTBLUE, string);
return true;
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Esse nгo й um jogador ativo.");
}
}
return true;
}
a linha que estб dando erro й essa:
pawn Код:
OnPlayerCommandText(giveplayer,"/avdemitidoporra");
:S
Re: como bloquear o cmd contra o admin dono? -
Zivo - 14.10.2013
Fiz um novo para vocк bem parecido com o seu
pawn Код:
if(strcmp(cmd, "/DarVida", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] < 4)
{
SafadaTesudaDlc;
return 1;
}
if(admtrampando[playerid] < 1)
{
SendClientMessage(playerid, COLOR_GRAD1, " Vocк nгo estб em modo Admin USE: /profadmin");
return 1;
}
new
tmp[256],
tmp2[256]
id,
vida,
pName[MAX_PLAYER_NAME],
iName[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);
tmp2 = strtok(cmdtext, idx);
id = strval(tmp);
vida = strval(tmp2);
GetPlayerName(playerid, pName, sizeof(pName));
if(!strlen(tmp) || !strlen(tmp2))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /darvida [id] [vida]");
return 1;
}
if(id == INVALID_PLAYER_ID)
{
SendClientMessage(playerid, COLOR_GRAD2, "ID Invбlido!");
return 1;
}
if(!IsPlayerConnected(id))
{
SendClientMessage(playerid, COLOR_GRAD2, "Nгo hб jogadores com este id online no momento");
return 1;
}
GetPlayerName(id, iName, sizeof(iName));
if(PlayerInfo[id][pAdmin] == 3001 && vida == 0)
{
SetPlayerHealth(playerid, 0);
return 1;
}
SetPlayerHealth(id, vida);
format(string, 128, "AdmCmd: %s deu %d de saъde para %s", pName, vida, iName);
ABroadCast(0xC2CA7FFF,string,1);
comandosadminlog(string);
return 1;
}
O seu segundo problema й que vocк colocou:
pawn Код:
OnPlayerCommandText(giveplayer, "/avdemitidoporra");
Mas й assim:
pawn Код:
OnPlayerCommandText(giveplayerid, "/avdemitidoporra");
vocк colocou " giveplayer " em vez de " giveplayerid "
Respuesta: como bloquear o cmd contra o admin dono? -
DanDRT - 14.10.2013
Creio que o post do Zivo te ajudarб :*
Re: como bloquear o cmd contra o admin dono? -
Schocc - 14.10.2013
Vocк precisa verificar o lvl, de administrador que o player tem salvo na variбvel de admin.
e.g:
pawn Код:
new pAdmin[MAX_PLAYERS];
#define ADMIN_DONO (5)
#define ADMIN_MODERADOR (4)
#define ADMIN_AJUDANTE (3)
#define ADMIN_TEMP (2)
CMD:makeadmin(p,pr[])
{
if(pAdmin[p] != ADMIN_DONO)
return SendClientMessage(p,-1,#Vocк nгo tem permissгo para usar este comando!.);
pAdmin[strval(pr[0])] = strval(pr[1]);
SendClientMessage(strval(pr[1]),-1,#Vocк ganhou um cargo de administrador!.);
return 1;
}
Aproveitando quero pedir se vai funcionar isso que fiz acima, voltei a programar PAWN, e nгo lembro de nada. 50% eu esqueci.