PDA

View Full Version : Error when I try to create global void: function!


DuyDang2412
07/04/2017, 10:36 AM
Hello guys, I'm trying to use my gamemode functions in every filterscript, so follow Y_Master's instruction, I made an include and did it like he said and I got errors, here is my code:
In my gamemode:

global void:System_Scm(playerid, message[], type){
new string[128];
switch(type){
case TYPE_NOTICE:{
format(string, sizeof(string), "{f4d742}*{FFFFFF} %s", message);
}
case TYPE_ERROR:{
format(string, sizeof(string), "{c60000}*{FFFFFF} "COL_FADE"%s", message);
}
case TYPE_SUCCESS:{
format(string, sizeof(string), "{01aa0f}*{FFFFFF} %s", message);
}
}
SendClientMessage(playerid, -1, string);
return 1;
}


In my include:

#define MASTER 6
#include <YSI\y_master>

foreign void:System_Scm(playerid, message, type);

Errors:

In Gamemode:
./Functions.pwn(1832) : error 025: function heading differs from prototype
./Functions.pwn(1832) : error 025: function heading differs from prototype
./Functions.pwn(1832) : error 035: argument type mismatch (argument 2)
./Functions.pwn(1832) : fatal error 107: too many error messages on one line

Include:
error 079: inconsistent return types (array & non-array)

Hunud
07/04/2017, 10:42 AM
foreign void:System_Scm(playerid, message[], type);

DuyDang2412
07/04/2017, 10:45 AM
foreign void:System_Scm(playerid, message[], type);
Still not working. No errors reduced.

Hunud
07/04/2017, 10:48 AM
What is foreign ?

DuyDang2412
07/04/2017, 10:50 AM
Please read this: http://forum.sa-mp.com/showpost.php?p=3195266&postcount=8
****** said that this is an more effective way to use gamemode's function in Filterscript.

DuyDang2412
07/04/2017, 11:05 AM
Got more errors now:
Include: gFunctions.inc(10) : warning 208: function with tag result used before definition, forcing reparse
Gamemode: error 004: function "System_Scm" is not implemented
./Functions.pwn(1828) : error 010: invalid function or declaration


Code:
Gamemode:
global void:System_Scm(playerid, string:message[], type){
new string[128]; // ERROR 10 here.
switch(type){
case TYPE_NOTICE:{
format(string, sizeof(string), "{f4d742}*{FFFFFF} %s", message);
}
case TYPE_ERROR:{
format(string, sizeof(string), "{c60000}*{FFFFFF} "COL_FADE"%s", message);
}
case TYPE_SUCCESS:{
format(string, sizeof(string), "{01aa0f}*{FFFFFF} %s", message);
}
}
SendClientMessage(playerid, -1, string);
}

Include:
#if defined FILTERSCRIPT
#define YSI_IS_CLIENT
#else
#define YSI_IS_SERVER
#endif

#define MASTER 6
#include <YSI\y_master>

foreign void:System_Scm(playerid, string:message[], type);

DuyDang2412
07/04/2017, 12:13 PM
I have posted it above, or you want anything else?

DuyDang2412
07/04/2017, 12:43 PM
Okay, I finally understood. Please check the inbox, I'm sending you my gamemode.

DuyDang2412
07/04/2017, 01:37 PM
Finally, I solved it! Thank you so much, ******.