[Ajuda] /duvida
#7

Segue o cуdigo...

Quote:

public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/relatorio", true) == 0)
{
new string[256];
new mensagem[256];
new sendername[MAX_PLAYER_NAME];

mensagem = strtok(cmdtext, idx);
if(!strlen(mensagem))
{
SendClientMessage(playerid,-1,"Erro digite: /relatorio [texto]");
return 1;
}
GetPlayerName(playerid,sendername,sizeof(sendernam e));
format(string,sizeof(string),"Relatуrio de %s: %s",sendername,mensagem);
AvisoAdmin(-1,string);
return 1;
}
return 1;
}

Quote:

forward AvisoAdmin(COLOR,const string[]);
public AvisoAdmin(COLOR,const string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if (IsPlayerAdmin(i))
{
SendClientMessage(i, COLOR, string);
}
}
}
return 1;
}

Caso nгo tenha a funзгo strtok

Quote:

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;
}

Eu testei e funcionou.
Reply


Messages In This Thread
/duvida - by VF46 - 24.01.2018, 21:26
Re: /duvida - by Marllun - 24.01.2018, 21:42
Re: /duvida - by humildadeforever - 24.01.2018, 22:03
Re: /duvida - by VF46 - 24.01.2018, 23:00
Re: /duvida - by Marllun - 24.01.2018, 23:06
Re: /duvida - by VF46 - 24.01.2018, 23:33
Re: /duvida - by FerrariL - 25.01.2018, 01:28
Re: /duvida - by VF46 - 25.01.2018, 01:51
Re: /duvida - by Luiiiz - 25.01.2018, 14:33
Re: /duvida - by FerrariL - 25.01.2018, 18:06

Forum Jump:


Users browsing this thread: 3 Guest(s)