[Ajuda] /pm Erro ajuda. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] /pm Erro ajuda. (
/showthread.php?tid=290074)
[Ajuda] /pm Erro ajuda. -
Oakley_TwOPaCk - 14.10.2011
Olб galera
Bom eu estava, colocano um comando chamado /pm (mensagem particular) e deu uns erro e nгo consigo arrumar, vcs podem me ajudar ? Vou postar Os erro, as linha e o Comando inteiro ok ?
Erros :
pawn Код:
C:\Documents and Settings\FAMILIA_\Desktop\Iniciante\gamemodes\testing.pwn(309) : error 017: undefined symbol "strtok"
C:\Documents and Settings\FAMILIA_\Desktop\Iniciante\gamemodes\testing.pwn(309) : error 033: array must be indexed (variable "cmd")
C:\Documents and Settings\FAMILIA_\Desktop\Iniciante\gamemodes\testing.pwn(314) : error 017: undefined symbol "strtok"
C:\Documents and Settings\FAMILIA_\Desktop\Iniciante\gamemodes\testing.pwn(314) : error 033: array must be indexed (variable "tmp")
C:\Documents and Settings\FAMILIA_\Desktop\Iniciante\gamemodes\testing.pwn(322) : error 017: undefined symbol "strrest"
C:\Documents and Settings\FAMILIA_\Desktop\Iniciante\gamemodes\testing.pwn(322) : error 033: array must be indexed (variable "gMessage")
C:\Documents and Settings\FAMILIA_\Desktop\Iniciante\gamemodes\testing.pwn(307) : warning 203: symbol is never used: "idx"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
6 Errors.
Linhas :
pawn Код:
/*Erro 309*/
cmd = strtok(cmdtext, idx);
/*Erro 314*/
tmp = strtok(cmdtext,idx);
/*Erro 322*/
gMessage = strrest(cmdtext,idx);
/*Erro 307*/
new idx;
Comando inteiro :
pawn Код:
new cmd[256];
new tmp[256];
new Message[256];
new gMessage[256];
new pName[MAX_PLAYER_NAME+1];
new iName[MAX_PLAYER_NAME+1];
new idx;
cmd = strtok(cmdtext, idx);
// PM Command
if(strcmp("/pm", cmd, true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp) || strlen(tmp) > 5) {
SendClientMessage(playerid,0xFFFF00FF,"Usage: /pm (id) (message)");
return 1;
}
new id = strval(tmp);
gMessage = strrest(cmdtext,idx);
if(!strlen(gMessage)) {
SendClientMessage(playerid,0xFFFF00FF,"Usage: /pm (id) (message)");
return 1;
}
if(!IsPlayerConnected(id)) {
SendClientMessage(playerid,0xFFFF00FF,"/pm : Bad player ID");
return 1;
}
if(playerid != id) {
GetPlayerName(id,iName,sizeof(iName));
GetPlayerName(playerid,pName,sizeof(pName));
format(Message,sizeof(Message),">> %s(%d): %s",iName,id,gMessage);
SendClientMessage(playerid,0xFFFF00FF,Message);
format(Message,sizeof(Message),"** %s(%d): %s",pName,playerid,gMessage);
SendClientMessage(id,0xFFFF00FF,Message);
PlayerPlaySound(id,1085,0.0,0.0,0.0);
printf("PM: %s",Message);
}
else {
SendClientMessage(playerid,0xFFFF00FF,"You cannot PM yourself");
}
return 1;
}
Re: [ERRO] /pm Erro ajuda. -
Lуs - 14.10.2011
pawn Код:
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;
}
Adiciona no fim do gamemode
Re: [ERRO] /pm Erro ajuda. -
Oakley_TwOPaCk - 14.10.2011
Vlw Lуs ^^