communicating variabels(gm/fs)
#1

Hey, Ive got this part:

Код:
public afterstop()
{
	if(TimeM == 0 && TimeS == 0)
	{
    	        number1k = 0;
		number1 = 0;
		number2 = 0;
		number3 = 0;
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
	    	        if(IsPlayerConnected(i))
	    	        {
				SetPlayerScoreEx(i);
				GivePVarInt(i, "ikills",0);
				GivePVarInt(i, "ideaths",0);
			}
 		}
	}
	return 1;
}
This should happen when TimeM and TimeS are both 0. (Of my timer in my gm, a countdown). This is in my filterscript as you might already know. But how can I make the public start from my gamemode? Ive seen something like CallRemoteFunction, but I don't get it on wiki and there are no good tuts for it. Anyone help please.
Reply
#2

Ok, I'll explain. Using CallRemoteFunction you can call any public function from any filterscript or gamemode. The function must always be public. In your case, because you have no parameters, you only need this:
pawn Код:
//in gamemode
CallRemoteFunction("afterstop", "");
Below is an example if you had multiple parameters:
pawn Код:
//in gamemode
public OnPlayerConnect(playerid)
{
    CallRemoteFunction("MyFunc", "ds", playerid, "connected");
}

//in filterscript
public MyFunc(playerid, text[])
{
    printf("playerid %d has %s.", playerid, text);
}
If you had MyFunc in two filterscripts, it would print that message two times.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)