22.03.2012, 16:49
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
i need help with them texes
Example:
How to convert like this new length = strlen(cmdtext);
or this
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
HOW while ((idx < length) && (cmdtext[idx] <= ' '))
if(!strlen(tmp))
i need help with them texes
Example:
Код:
if(strcmp(cmd, "/givecookie", true) == 0) { if(IsPlayerConnected(playerid)) { if(PlayerInfo[playerid][pAdmin] < 4) { SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecookie [playerid/PartOfName] [reason]"); return 1; } giveplayerid = ReturnUser(tmp); if(IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecookie [playerid/PartOfName] [reason]"); return 1; } PlayerInfo[giveplayerid][pCookies] += 1; format(string, sizeof(string), "AdmCmd: %s has been given a cookie by %s, reason: %s", PlayerName(giveplayerid), PlayerName(playerid), (result)); SendClientMessageToAll(COLOR_LIGHTRED, string); } } else { SendClientMessage(playerid, COLOR_GREY, " That player is Offline !"); return 1; } } return 1; }
How to convert like this new length = strlen(cmdtext);
or this
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
HOW while ((idx < length) && (cmdtext[idx] <= ' '))