[AJUDA] Problemas no OnPlayerCommandText -
Tomato_Atecubanos - 08.01.2011
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);//Linha 254
//=================== [ Comandos da administraзгo/staff ]
//------------------- * dar vida * ----------------------
if(strcmp(cmd,"/darvida", true)==0 && IsPlayerAdmin(playerid))
{
new string [256];
new tmp[256];
new plid, vida;
new nomeentregador[MAX_PLAYER_NAME];
new nomerecebedor[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);//Linha 264
if(!strlen(tmp))//Linha 265
{
SendClientMessage(playerid, COR_CINZA, "[ERRO DE SINTAXE] /darvida [id] [quantidade]");[COLOR="SeaGreen"]//Linha 267[/COLOR]
return 1;
}
plid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COR_CINZA, "[ERRO DE SINTAXE] /darvida [id] [quantidade]");
return 1;
}
vida = strval(tmp);
if(IsPlayerConnected(plid))
{
GetPlayerName(plid, nomerecebedor, sizeof(nomerecebedor));
GetPlayerName(playerid, nomeentregador, sizeof(nomeentregador));
format(string, sizeof(string), "O Admnistrador %s setou a vida de %s para %d.", nomeentregador,nomerecebedor,vida);
SendClientMessageToAll(COR_BRANCA, string);
SetPlayerHealth(plid,vida);
return 1;
}
else
{
SendClientMessage(playerid, COR_CINZA, "Jogador nгo estб conectado.");
return 1;
}
}
~
D:\Jogos e programas\SA-MP EM GERAL\SA-MP 0.3c\RPG e DM\gamemodes\Destroyers racing.pwn(254) : error 033: array must be indexed (variable "cmd")
D:\Jogos e programas\SA-MP EM GERAL\SA-MP 0.3c\RPG e DM\gamemodes\Destroyers racing.pwn(265) : warning 217: loose indentation
D:\Jogos e programas\SA-MP EM GERAL\SA-MP 0.3c\RPG e DM\gamemodes\Destroyers racing.pwn(267) : error 001: expected token: ",", but found "]"
D:\Jogos e programas\SA-MP EM GERAL\SA-MP 0.3c\RPG e DM\gamemodes\Destroyers racing.pwn(267) : error 029: invalid expression, assumed zero
D:\Jogos e programas\SA-MP EM GERAL\SA-MP 0.3c\RPG e DM\gamemodes\Destroyers racing.pwn(267) : error 029: invalid expression, assumed zero
D:\Jogos e programas\SA-MP EM GERAL\SA-MP 0.3c\RPG e DM\gamemodes\Destroyers racing.pwn(267) : fatal error 107: too many error messages on one line
~
Estou com esses erros, mas nгo entendo quais sгo os problemas e porque ocorreram, peguei tudo
desse tutorial, e nгo entendo o que aconteceu de errado, espero ajuda, abs.
Re: [AJUDA] Problemas no OnPlayerCommandText -
[Ips]Guh - 08.01.2011
esse comando ae e o unico do Onplayercommandtext?
se for falta um Return 0 no final :
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);//Linha 254
//=================== [ Comandos da administraзгo/staff ]
//------------------- * dar vida * ----------------------
if(strcmp(cmd,"/darvida", true)==0 && IsPlayerAdmin(playerid))
{
new string [256];
new tmp[256];
new plid, vida;
new nomeentregador[MAX_PLAYER_NAME];
new nomerecebedor[MAX_PLAYER_NAME];
tmp = strtok(cmdtext, idx);//Linha 264
if(!strlen(tmp))//Linha 265
{
SendClientMessage(playerid, COR_CINZA, "[ERRO DE SINTAXE] /darvida [id] [quantidade]");//Linha 267
return 1;
}
plid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COR_CINZA, "[ERRO DE SINTAXE] /darvida [id] [quantidade]");
return 1;
}
vida = strval(tmp);
if(IsPlayerConnected(plid))
{
GetPlayerName(plid, nomerecebedor, sizeof(nomerecebedor));
GetPlayerName(playerid, nomeentregador, sizeof(nomeentregador));
format(string, sizeof(string), "O Admnistrador %s setou a vida de %s para %d.", nomeentregador,nomerecebedor,vida);
SendClientMessageToAll(COR_BRANCA, string);
SetPlayerHealth(plid,vida);
return 1;
}
else
{
SendClientMessage(playerid, COR_CINZA, "Jogador nгo estб conectado.");
return 1;
}
return 0;
}
Re: [AJUDA] Problemas no OnPlayerCommandText -
Tomato_Atecubanos - 08.01.2011
Quote:
Originally Posted by badio12
esse comando ae e o unico do Onplayercommandtext?
se for falta um Return 0 no final :
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256]; new idx; cmd = strtok(cmdtext, idx);//Linha 254 //=================== [ Comandos da administraзгo/staff ] //------------------- * dar vida * ---------------------- if(strcmp(cmd,"/darvida", true)==0 && IsPlayerAdmin(playerid)) { new string [256]; new tmp[256]; new plid, vida; new nomeentregador[MAX_PLAYER_NAME]; new nomerecebedor[MAX_PLAYER_NAME]; tmp = strtok(cmdtext, idx);//Linha 264 if(!strlen(tmp))//Linha 265 { SendClientMessage(playerid, COR_CINZA, "[ERRO DE SINTAXE] /darvida [id] [quantidade]");//Linha 267 return 1; } plid = strval(tmp); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COR_CINZA, "[ERRO DE SINTAXE] /darvida [id] [quantidade]"); return 1; } vida = strval(tmp); if(IsPlayerConnected(plid)) { GetPlayerName(plid, nomerecebedor, sizeof(nomerecebedor)); GetPlayerName(playerid, nomeentregador, sizeof(nomeentregador)); format(string, sizeof(string), "O Admnistrador %s setou a vida de %s para %d.", nomeentregador,nomerecebedor,vida); SendClientMessageToAll(COR_BRANCA, string); SetPlayerHealth(plid,vida); return 1; } else { SendClientMessage(playerid, COR_CINZA, "Jogador nгo estб conectado."); return 1; } return 0; }
|
nгo, tem 5 alйm desse
Re: [AJUDA] Problemas no OnPlayerCommandText -
[Ips]Guh - 08.01.2011
mais ve se encerra a public com