\gamemodes\mortals.pwn(17479) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
format(string,sizeof(string),"[%d.%d.%d] [%d:%d:%d]: %s : %s\r\n",day,month,year,hour,minute,second,SName1,text);
stock SName1(playerid)
{
new SName1[MAX_PLAYER_NAME];
GetPlayerName(playerid,SName1,sizeof(SName1));
return SName1;
}
forward SaveToFile(filename[],text[]);
public SaveToFile(filename[],text[])
{
new File:File, filepath[256], string[256], year,month,day, hour,minute,second;
getdate(year,month,day); gettime(hour,minute,second);
format(filepath,sizeof(filepath),"/Suggestions/%s.txt",filename);
File = fopen(filepath,io_append);
format(string,sizeof(string),"[%d.%d.%d] [%d:%d:%d]: %s : %s\r\n",day,month,year,hour,minute,second,SName1,text);
fwrite(File,string);
fclose(File);
return 1;
}
// GetName function
stock GetName(playerid) {
new szName[MAX_PLAYER_NAME];
GetPlayerName(playerid, szName, MAX_PLAYER_NAME);
return szName;
}
// Format code
format(string,sizeof(string),"[%d.%d.%d] [%d:%d:%d]: %s : %s\r\n",day,month,year,hour,minute,second,GetName(playerid),text);
You forgot to parse a variable to the SName1 function. Also, it's a function so you have to call it suffixed with parenthesis. Also, SName1 is a terrible name for a function.
pawn Код:
|
C:\Users\Vyom\Desktop\SA-MP 3d\gamemodes\mortals.pwn(17479) : error 017: undefined symbol "playerid"
|
forward SaveToFile(playerid,filename[],text[]); // add playerid param in the forward
public SaveToFile(playerid,filename[],text[]) // and here too "this is the callback that you fowarded.
{
//code
}