25.01.2018, 01:28
Segue o cуdigo...
Caso nгo tenha a funзгo strtok
Eu testei e funcionou.
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; } |
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; } |