09.07.2009, 17:25
Quote:
Originally Posted by Kevon
Alright guys, tell me if this is right?
Код:
public OnPlayerCommandText(playerid, cmdtext[]) 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; } public OnPlayerCommandText(playerid,cmdtext[]){ if(!strcmp("/b ",cmdtext,true,3)){ if(cmdtext[3]){ OnPlayerText(playerid,cmdtext[3]); }else SendClientMessage(playerid,COLOR_YOUWANT,"Usage:/b [text]"); return true; } return false; } |
Код:
public OnPlayerCommandText(playerid,cmdtext[]){ if(!strcmp("/b ",cmdtext,true,3)){ if(cmdtext[3]){ OnPlayerText(playerid,cmdtext[3]); }else SendClientMessage(playerid,COLOR_YOUWANT,"Usage:/b [text]"); return true; } return false; } 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; }