29.03.2010, 10:42
Hi, i have a /suggest command that goes like this:
Could somebody make me a /suggestions?
I want it to show a dialog (with just cancel button)
of what people have suggested and what their name was in a list (i dont want ip to be shown though.)
Код:
if(strcmp(cmdtext, "/suggest", true) == 0) { if(IsPlayerConnected(playerid)) { new sendername[MAX_PLAYER_NAME]; new string[128]; //needs to be big! GetPlayerName(playerid, sendername, sizeof(sendername)); 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_BLUE, "USAGE: /suggest [suggestion]"); return 1; } new ip[16]; GetPlayerIp(playerid, ip, sizeof(ip)); format(string, sizeof(string), "Suggestion: %s, IP: %s, name: %s.",(result),ip,sendername); SendClientMessage(playerid, COLOR_YELLOW, string); Suggestions(string); } return 1; }
Код:
forward Suggestions(string[]); public Suggestions(string[]) { new entry[256]; format(entry, sizeof(entry), "%s\r\n",string); new File:hFile; hFile = fopen("suggestions.log", io_append); fwrite(hFile, entry); fclose(hFile); }
I want it to show a dialog (with just cancel button)
of what people have suggested and what their name was in a list (i dont want ip to be shown though.)