13.04.2012, 21:00
@gcoder Aconselho a usar sscanf do q strtok sscanf й bem mais simples e nгo disperdissa Cйlulas agora o strtok Disperdissa mta Cйlulas
Coloque isto no final do gm. (sу se vc for usar strtok agora se for usar sscanf nao й necessбrio)
Tenta assim:
Coloque isto no final do gm. (sу se vc for usar strtok agora se for usar sscanf nao й necessбrio)
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;
}
pawn Код:
if(!strcmp(cmd, "/daroperador", true))
{
new tmp[30];
if(!IsPlayerAdmin(playerid)) return 1;
tmp = strtok(cmdtext, idx);
new id = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "/daroperador id operador");
tmp = strtok(cmdtext, idx);
new op = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, -1, "/daroperador id operador");
PlayerInfo[id][pOperador] = op;
SendClientMessage(id, -1, "Te deram operador ");
SendClientMessage(playerid, -1, "Vc deu operador pro cara rsrrrs vida loka dorgas");
return 1;
}