Wrong? -
DarkB0y - 24.06.2013
pawn Код:
dcmd_bug(playerid,params[])
{
new string[128],bug,pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
if(sscanf(params,"s[128]",bug)) return SendClientMessage(playerid, COLOR_RED,"USAGE: /bug [what's the bug ?]");
format(string,sizeof string,"[BUG REPORT] - %s has reported this bug: %s.",pName,bug);
SaveInFile("Bugs.txt",string);
format(string,sizeof string,"[BUG REPORT] - You've reported this bug: %s ; succesfully.",bug);
SendClientMessage(playerid,COLOR_GREEN,string);
return 1;
}
dcmd_sug(playerid,params[])
{
new string[128],pName[MAX_PLAYER_NAME],sug;
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
if(sscanf(params,"s[128]",sug)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /sug [suggestion for the server]");
format(string,sizeof string,"[NEW SUGGESTION] - %s has suggested: %s.",pName,sug);
SaveInFile("Suggestions.txt",string);
format(string,sizeof string,"[NEW SUGGESTION] - Your suggestion has been saved in a file; You have succesfully suggested: %s",sug);
SendClientMessage(playerid,COLOR_GREEN,string);
return 1;
}
Re: Wrong? -
[MG]Dimi - 24.06.2013
And the problem is?
Re: Wrong? -
DarkB0y - 24.06.2013
Код:
C:\Users\habib\Desktop\Untitled.pwn(6) : error 031: unknown directive
C:\Users\habib\Desktop\Untitled.pwn(102) : error 017: undefined symbol "sscanf"
C:\Users\habib\Desktop\Untitled.pwn(102) : error 017: undefined symbol "COLOR_RED"
C:\Users\habib\Desktop\Untitled.pwn(104) : error 017: undefined symbol "SaveInFile"
C:\Users\habib\Desktop\Untitled.pwn(113) : error 017: undefined symbol "sscanf"
C:\Users\habib\Desktop\Untitled.pwn(115) : error 017: undefined symbol "SaveInFile"
Like 101
Код:
if(sscanf(params,"s[128]",bug)) return SendClientMessage(playerid, COLOR_RED,"USAGE: /bug [what's the bug ?]");
Line 103
Код:
SaveInFile("Bugs.txt",string);
Line 112
Код:
if(sscanf(params,"s[128]",sug)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /sug [suggestion for the server]");
Re: Wrong? -
adithegman - 24.06.2013
try this and be shure that sscanf is included and in server.cfg that is on the plugins line:
Код:
if(sscanf(params,"s",bug)) return SendClientMessage(playerid, COLOR_RED,"USAGE: /bug [what's the bug ?]");
Re: Wrong? -
DarkB0y - 24.06.2013
Sscanf errors gone but how to define SaveInFile ?
Re: Wrong? -
adithegman - 24.06.2013
try to do it with y_ini or file functions: fopen, fclose, fwrite etc. they should be in the list of functions in te right, but if they don't try #include <file>
Re: Wrong? -
adithegman - 24.06.2013
so you use the file functions, you first need to create the Bug.txt file in scriptfiles then you replace SaveInFile with:
Код:
new File:Bug = fopen("/Bugs.txt", mode = io_readwrite)
if(Bug)
{
fwrite(Bug, bug)
fclose(Bug)
}
and you do the same with the sugestion, create Suggestions.txt and replace SaveInFile:
Код:
new File:Suggestion = fopen("/Suggestions.txt", mode = io_readwrite)
if(Suggestion)
{
fwrite(Suggestion, sug)
fclose(Suggestion)
}
hope it helps, i never used these functions, i use Y_Ini for this...
Re: Wrong? -
DarkB0y - 24.06.2013
Код:
C:\Users\habib\Desktop\Untitled.pwn(106) : error 017: undefined symbol "mode"
C:\Users\habib\Desktop\Untitled.pwn(106) : warning 215: expression has no effect
C:\Users\habib\Desktop\Untitled.pwn(106) : error 001: expected token: ";", but found ")"
C:\Users\habib\Desktop\Untitled.pwn(106) : error 029: invalid expression, assumed zero
C:\Users\habib\Desktop\Untitled.pwn(106) : fatal error 107: too many error messages on one line
?
Re: Wrong? -
adithegman - 24.06.2013
please show the code now after the modifications
Re: Wrong? -
DarkB0y - 24.06.2013
pawn Код:
dcmd_bug(playerid,params[])
{
new string[128],bug,pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
if(sscanf(params,"s[128]",bug)) return SendClientMessage(playerid, COLOR_RED,"USAGE: /bug [what's the bug ?]");
format(string,sizeof string,"[BUG REPORT] - %s has reported this bug: %s.",pName,bug);
format(string,sizeof string,"[BUG REPORT] - You've reported this bug: %s ; succesfully.",bug);
SendClientMessage(playerid,COLOR_GREEN,string);
new File:Bug = fopen("/Bugs.txt", mode = io_readwrite)
if(Bug)
{
fwrite(Bug, bug)
fclose(Bug)
}
return 1;
}
dcmd_sug(playerid,params[])
{
new string[128],pName[MAX_PLAYER_NAME],sug;
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
if(sscanf(params,"s[128]",sug)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /sug [suggestion for the server]");
format(string,sizeof string,"[NEW SUGGESTION] - %s has suggested: %s.",pName,sug);
new File:Suggestion = fopen("/Suggestions.txt", mode = io_readwrite)
format(string,sizeof string,"[NEW SUGGESTION] - Your suggestion has been saved in a file; You have succesfully suggested: %s",sug);
SendClientMessage(playerid,COLOR_GREEN,string);
if(Suggestion)
{
fwrite(Suggestion, sug)
fclose(Suggestion)
}
return 1;
}