/Suggest Command
#1

How do i make a /suggest command?

i want it in the strcmp format and i would like it to be something like this

/suggest [suggestion]

and it will save into a text doc in scriptfiles, then, i want a command such as /suggestions that will show what people have suggested.

How would i do this?
Reply
#2

Omg, i was going to post the exact same thing today.



Plus, It should display the user name, and IP so if people abuse it, they could get a warning/banned
Reply
#3

Agreed!
Reply
#4

Like this?
pawn Код:
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_GRAD2, "USAGE: /(sugesst)ion [text]");
                return 1;
            }
new ip[16]; GetPlayerIp(playerid, ip, sizeof(ip));
            format(string, sizeof(string), "Your sugesstion: %s, your IP: %s and your name: %s.",(result),ip,sendername);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            Suggestions(string);
}
return 1;
    }
pawn Код:
forward Suggestions(string[]);
pawn Код:
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);
}
Reply
#5

Thanks, just 4 errors:


Код:
C:\Users\Corran\Desktop\Samp Server Latest\gamemodes\CJfreeroam.pwn(1924) : error 017: undefined symbol "sendername"
C:\Users\Corran\Desktop\Samp Server Latest\gamemodes\CJfreeroam.pwn(1924) : error 017: undefined symbol "sendername"
C:\Users\Corran\Desktop\Samp Server Latest\gamemodes\CJfreeroam.pwn(1924) : error 029: invalid expression, assumed zero
C:\Users\Corran\Desktop\Samp Server Latest\gamemodes\CJfreeroam.pwn(1924) : fatal error 107: too many error messages on one line
Reply
#6

Quote:
Originally Posted by XxCozzaxX
Thanks, just 4 errors:


Код:
C:\Users\Corran\Desktop\Samp Server Latest\gamemodes\CJfreeroam.pwn(1924) : error 017: undefined symbol "sendername"
C:\Users\Corran\Desktop\Samp Server Latest\gamemodes\CJfreeroam.pwn(1924) : error 017: undefined symbol "sendername"
C:\Users\Corran\Desktop\Samp Server Latest\gamemodes\CJfreeroam.pwn(1924) : error 029: invalid expression, assumed zero
C:\Users\Corran\Desktop\Samp Server Latest\gamemodes\CJfreeroam.pwn(1924) : fatal error 107: too many error messages on one line
Just add this : new sendername[MAX_PLAYER_NAME];
Reply
#7

Ok, works but doesnt add ip or name, it gives this into suggestions.log :

Код:
Your sugesstion: Add More Classes.
(i will fix spelling on words)
Reply
#8

Yeah, because it's very simple, try putting: Your suggestion: any sugg., your IP: the ip, your name: the name.. I will make it later..
Reply
#9

How? Can u quickly make it?
Reply
#10

Quote:
Originally Posted by XxCozzaxX
How? Can u quickly make it?
Yeah, I'm making it right now, just wait 2 minutes .

See my first post and try it..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)