/suggest and /suggestions - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /suggest and /suggestions (
/showthread.php?tid=137565)
/suggest and /suggestions -
cozza123456 - 29.03.2010
Hi, i have a /suggest command that goes like this:
Код:
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);
}
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.)
Re: /suggest and /suggestions -
Mikep. - 29.03.2010
Use fread.
www.wiki.sa-mp.com/fread
Re: /suggest and /suggestions -
dice7 - 29.03.2010
https://sampwiki.blast.hk/wiki/ShowPlayerDialog
https://sampwiki.blast.hk/wiki/OnDialogResponse