Problem with a cmd - 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: Problem with a cmd (
/showthread.php?tid=199871)
Problem with a cmd -
Face9000 - 16.12.2010
Hi,i've done this cmd for server suggestions:
Код:
new cmd[35];
if(strcmp(cmd,"/sugg",true,12)==0)
{
if(strlen(cmdtext) < 13) return SendClientMessage(playerid,"Usage: /sugg [You suggestion to improve the server.]");
new name[30];
new sug[126];
GetPlayerName(playerid,name,30);
strmid(sug,cmdtext,13,strlen(cmdtext));
new string[256];
format(string,256,"Suggestion - Author: %s - Details: %s",name,sug);
SendClientMessage(playerid,COLOR_ORANGE,"Your suggestion said:");
SendClientMessage(playerid,COLOR_ORANGE,string);
SendClientMessage(playerid,COLOR_ORANGE,"Thank you for submitting the suggestion and making this server better.");
new File:sug;
sug = fopen("/LOGS/sugg.log",io_append);
format(string,256,"%s\r\n",string);
fwrite(sug,string);
fclose(sug);
return 1;
}
But i get this errors:
Код:
C:\Documents and Settings\k\Desktop\SFWAR.pwn(445) : error 035: argument type mismatch (argument 2)
C:\Documents and Settings\Symone\k\SFWAR.pwn(455) : error 021: symbol already defined: "sug"
C:\Documents and Settings\Symone\k\SFWAR.pwn(489) : error 021: symbol already defined: "cmd"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
What's wrong?
Re: Problem with a cmd -
Benjo - 16.12.2010
C:\Documents and Settings\k\Desktop\SFWAR.pwn(445) : error 035: argument type mismatch (argument 2)
Refers to this line:
pawn Код:
if(strlen(cmdtext) < 13) return SendClientMessage(playerid,"Usage: /sugg [You suggestion to improve the server.]");
Your SendClientMessage function is missing the color parameter. Either add it in yourself, or just use this:
pawn Код:
if(strlen(cmdtext) < 13) return SendClientMessage(playerid, 0xFF0000AA ,"Usage: /sugg [You suggestion to improve the server.]");
C:\Documents and Settings\Symone\k\SFWAR.pwn(455) : error 021: symbol already defined: "sug"
Refers to this line:
You have already created a variable called "sug". Change this one and any references to it to something else, "sugfile" for example.
C:\Documents and Settings\Symone\k\SFWAR.pwn(489) : error 021: symbol already defined: "cmd"
You have not shown us this piece of code, but it looks like the same problem as the error above.