criando comando reportar -
CanTLoGin - 30.08.2011
Eu sei que para alguns vai ser facil. mais pra mim e mto dificil.
jб tentei criar. pegar de um fs de admin , gm etc.
e nada funciona.
entгo vim aqui pedir ajuda de vses no forum. jб usei o Search mas oque encontrei nгo me ajudou.
Gostaria de saber como faзo o comando /reportar [ID] [MOTIVO]
Quando o play usa esse cmd. ele vai reportar um cheat ( obvio ) e aparece pro admin logado na rcon
O Player: FULANO Reportou: FULANINHO MOTIVO: POLKAN
Obrigado desde jб a todos que me ajudar.
Re: criando comando reportar -
[AF]Junior - 30.08.2011
pawn Код:
if(strcmp(cmd, "/reportar", true) == 0)
{
new string[256];
tmp = strtok(cmdtext, idx);
new otherplayer = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USE: /reportar [id] [motivo]");
new length = strlen(cmdtext);
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)) return SendClientMessage(playerid, COLOR_RED, "USE: /reportar [id] [motivo]");
if(!IsPlayerConnected(otherplayer)) return SendClientMessage(playerid, COLOR_WHITE, "[ERRO] Jogador indisponнvel.");
GetPlayerName(playerid, playrname, sizeof(playrname));
{
SendClientMessage(playerid, COLOR_RED, "[AVISO] Seu report foi enviado para a Administraзгo.");
}
format(string,sizeof(string),"Report de {FFFFFF}%s{FFFF00}: [{FFFFFF}ID:%d {FFFF00}Razгo pelo Report: {FFFFFF}%s.{FFFF00}]", playrname, otherplayer, result);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i) && PlayerInfo[i][Admin] >= 1)
{
SendClientMessage(i,COLOR_YELLOW,string);
}
}
return 1;
}
Mude a variбvel
PlayerInfo[i][Admin] >= 1 para a que vocк tem no seu sistema, ou use IsPlayerAdmin.
Re: criando comando reportar -
CanTLoGin - 30.08.2011
pawn Код:
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(870) : error 017: undefined symbol "cmd"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(873) : error 017: undefined symbol "tmp"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(873) : error 017: undefined symbol "strtok"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(874) : error 017: undefined symbol "tmp"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(875) : error 017: undefined symbol "tmp"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(877) : error 017: undefined symbol "idx"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(879) : error 017: undefined symbol "idx"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(879) : warning 215: expression has no effect
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(881) : error 017: undefined symbol "idx"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(883) : error 017: undefined symbol "idx"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(885) : error 017: undefined symbol "idx"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(886) : error 017: undefined symbol "idx"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(886) : warning 215: expression has no effect
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(888) : error 017: undefined symbol "idx"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(891) : error 017: undefined symbol "playrname"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(891) : error 017: undefined symbol "playrname"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(891) : error 029: invalid expression, assumed zero
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(891) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
16 Errors.
=S
Re: criando comando reportar -
WLSF - 30.08.2011
pawn Код:
// no public OnPlayerCommandText(playerid,cmdtext[])
{
new cmd[128];
new tmp[128];
new playrname[MAX_PLAYER_NAME], idx;
cmd = strtok(cmdtext, idx);
Re: criando comando reportar -
CanTLoGin - 30.08.2011
Bom fiz oque o Willian passou ali. Ficou 8 erros agora
pawn Код:
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(852) : error 017: undefined symbol "strtok"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(852) : error 033: array must be indexed (variable "cmd")
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(877) : error 017: undefined symbol "strtok"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(877) : error 033: array must be indexed (variable "tmp")
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(902) : error 017: undefined symbol "PlayerInfo"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(902) : warning 215: expression has no effect
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(902) : error 001: expected token: ";", but found "]"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(902) : error 029: invalid expression, assumed zero
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(902) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
8 Errors.
#NгoEntendoMuitoBemStrok
Re: criando comando reportar -
WLSF - 30.08.2011
undefined PlayerInfo? nossa qual GM vocк tб usando?
Re: criando comando reportar -
WLSF - 30.08.2011
Tente assim
pawn Код:
if(strcmp(cmd,"/reportar",true) == 0) /*|| strcmp(cmd,"/reportar",true) == 0)*///Opcional caso queira adicionar outro call para o comando
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
msg(playerid,RED,"Use corretamente: /reportar");
return 1;
}
new outrofudido;
outrofudido = strval(tmp);
if(!IsPlayerConnected(outrofudido)) return SendClientMessage(playerid,RED,"Player Inativo.");
new willian[MAX_PLAYER_NAME];
GetPlayerName(playerid, willian, sizeof(willian));
{
SendClientMessage(playerid,YELLOW,"Vocк enviou um report para os admins online.");
}
new length = strlen(cmdtext);
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;
format(string,sizeof(string),"-> Report de: %s contra o id[%d] Motivo do report: %s ",nome,outrofudido,result);
for(new i;i<MAX_PLAYERS;i++)
{
if(IsPlayerAdmin(i))
{
SendClientMessage(i,-1,string);
return 1;
}
}
}
}
@edit desculpe-me o Double...
Re: criando comando reportar -
CanTLoGin - 30.08.2011
AFF
pawn Код:
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(853) : error 017: undefined symbol "strtok"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(853) : error 033: array must be indexed (variable "cmd")
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(879) : error 017: undefined symbol "strtok"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(879) : error 033: array must be indexed (variable "tmp")
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(882) : error 017: undefined symbol "msg"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(906) : error 017: undefined symbol "string"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(906) : error 017: undefined symbol "string"
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(906) : error 029: invalid expression, assumed zero
C:\Users\YaanMatheus\Desktop\VaGaPlaY Server\Servidor\gamemodes\VPGM2011.pwn(906) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
9 Errors.
Re: criando comando reportar -
WLSF - 30.08.2011
troque msg por SendClientMessage й porque no meu zerado eu defini assim...
e adicione um
emcima do format(string,size.....
e crie um stock no inicio do GM com o seguinte cуdigo
pawn Код:
stock strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
creio que vб concertar os erros...se for me dб um rep (:
Re: criando comando reportar -
CanTLoGin - 30.08.2011
Haha. deu 21 erros agora.
Xa keto esse negocio ai.
Valeu mesmo assim.
Repu pra vse ^^ '