05.01.2011, 17:07
Final do GM:
Primeiras linhas da OnPlayerCommandText:
Comando:
pawn Code:
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;
}
pawn Code:
new string[256], cmd[256], new idx;
cmd = strtok(cmdtext, idx); idx = 0;
pawn Code:
if (strcmp(cmd, "/FnA", true) == 0)
{
cmd = strtok(cmdtext, idx);
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
while ((idx < length) && ((idx - offset) < (sizeof(string) - 1)))
{
string[idx - offset] = cmdtext[idx];
idx++;
}
string[idx - offset] = EOS;
if (!strlen(string)) return SendClientMessage(playerid, Azul, "Utilize: /FnA [Texto]");
new pNome[24];
GetPlayerName(playerid, pNome, 24);
new string2[256];
format(string2, 128, "[FnA] %s: %s", pNome, string);
SendClientMessageToAll(Azul, string2);
return 1;
}