13.07.2011, 19:44
(
Последний раз редактировалось spaty2; 13.07.2011 в 21:17.
)
Quote:
public OnPlayerCommandText(playerid, cmdtext[]) { new cmd[256], tmp[256], idx, p_name[MAX_PLAYER_NAME], o_name[MAX_PLAYER_NAME] ; cmd = strtok(cmdtext, idx); if(strcmp("/dlicense", cmd, true) == 0) { tmp = strtok(cmdtext,idx); if(!strlen(tmp)) return SendClientMessage(playerid, -1, "USAGE: /dlicense [ID]"); new ID = strval(tmp); if(ID == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "SERVER: playerid isn't connected!"); GetPlayerName(ID, o_name, sizeof(o_name)); GetPlayerName(playerid, p_name, sizeof(p_name)); //Do your code here, getting the playerid his INI file and checking if he owns a LICENSE! printf("LICENSE: [%d]%s showed [%d]%s his license.", playerid, p_name, ID, o_name); return 1; } return 0; } stock 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; } |
Please?