23.04.2010, 22:43
I have a /suggest command that works perfectly. I'm trying to change it into dialog form, but I have no idea what I'm doing wrong?
PROBLEM: When i type /suggest dialog pops up, i type in my suggestion in the input line, but when i go to suggestions.txt all it says is "Killdahobo99 has suggested: ." Literally a period sign.
Here's my /suggest command
Here is my attempt on putting it into dialog form.
PROBLEM: When i type /suggest dialog pops up, i type in my suggestion in the input line, but when i go to suggestions.txt all it says is "Killdahobo99 has suggested: ." Literally a period sign.
Here's my /suggest command
Код:
if(strcmp(cmd, "/suggest", true) == 0) { if(IsPlayerConnected(playerid)) { new sendername[MAX_PLAYER_NAME]; 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 [text]"); return 1; } new ip[16]; GetPlayerIp(playerid, ip, sizeof(ip)); format(szstring, sizeof(szstring), "name: %s, IP: %s, Suggestion: %s.",sendername,ip,(result)); SendClientMessage(playerid, COLOR_YELLOW, szstring); Suggestions(szstring); } return 1; }
Here is my attempt on putting it into dialog form.
Код:
if(strcmp(cmd, "/suggest", true) == 0) { ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login","Type Your Suggestion Below:","Suggest","Cancel"); return 1; }
Код:
if(dialogid == 1) { if(IsPlayerConnected(playerid)) { new sendername[MAX_PLAYER_NAME]; new cmdtext[256]; new idx; 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; new ip[16]; GetPlayerIp(playerid, ip, sizeof(ip)); format(string, sizeof(string), "name: %s, IP: %s, Suggestion: %s.",sendername,ip,(result)); SendClientMessage(playerid, COLOR_YELLOW, string); Suggestions(string); } return 1; }