Error when I try to create global void: function!
#1

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:
PHP код:
global void:System_Scm(playeridmessage[], type){
    new 
string[128];
    switch(
type){
        case 
TYPE_NOTICE:{
            
format(stringsizeof(string), "{f4d742}*{FFFFFF} %s"message);
        }
        case 
TYPE_ERROR:{
            
format(stringsizeof(string), "{c60000}*{FFFFFF} "COL_FADE"%s"message);
        }
        case 
TYPE_SUCCESS:{
            
format(stringsizeof(string), "{01aa0f}*{FFFFFF} %s"message);
        }
    }
    
SendClientMessage(playerid, -1string);
    return 
1;

In my include:
PHP код:
#define MASTER 6
#include <YSI\y_master>
foreign void:System_Scm(playeridmessagetype); 
Errors:
Quote:

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)

Reply
#2

foreign void:System_Scm(playerid, message[], type);
Reply
#3

Quote:
Originally Posted by Hunud
Посмотреть сообщение
foreign void:System_Scm(playerid, message[], type);
Still not working. No errors reduced.
Reply
#4

What is foreign ?
Reply
#5

Please read this: http://forum.sa-mp.com/showpost.php?...66&postcount=8
****** said that this is an more effective way to use gamemode's function in Filterscript.
Reply
#6

Got more errors now:
Quote:

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(182 : error 010: invalid function or declaration

Code:
PHP код:
Gamemode:
global 
void:System_Scm(playeridstring:message[], type){
    new 
string[128]; // ERROR 10 here.
    
switch(type){
        case 
TYPE_NOTICE:{
            
format(stringsizeof(string), "{f4d742}*{FFFFFF} %s"message);
        }
        case 
TYPE_ERROR:{
            
format(stringsizeof(string), "{c60000}*{FFFFFF} "COL_FADE"%s"message);
        }
        case 
TYPE_SUCCESS:{
            
format(stringsizeof(string), "{01aa0f}*{FFFFFF} %s"message);
        }
    }
    
SendClientMessage(playerid, -1string);
}
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(playeridstring:message[], type); 
Reply
#7

I have posted it above, or you want anything else?
Reply
#8

Okay, I finally understood. Please check the inbox, I'm sending you my gamemode.
Reply
#9

Finally, I solved it! Thank you so much, ******.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)