SA-MP Forums Archive
/Suggest Command - 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 Command (/showthread.php?tid=134147)



/Suggest Command - cozza123456 - 15.03.2010

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?



Re: /Suggest Command - ruckfules99 - 15.03.2010

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


Re: /Suggest Command - cozza123456 - 15.03.2010

Agreed!


Re: /Suggest Command - Razvann - 15.03.2010

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);
}



Re: /Suggest Command - cozza123456 - 15.03.2010

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



Re: /Suggest Command - MaykoX - 15.03.2010

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];


Re: /Suggest Command - cozza123456 - 15.03.2010

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)


Re: /Suggest Command - Razvann - 15.03.2010

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..


Re: /Suggest Command - cozza123456 - 15.03.2010

How? Can u quickly make it?


Re: /Suggest Command - Razvann - 15.03.2010

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..