SA-MP Forums Archive
Using Filterscript Functions in Gamemode script - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Using Filterscript Functions in Gamemode script (/showthread.php?tid=582528)



Using Filterscript Functions in Gamemode script - SpikY_ - 21.07.2015

Hellu, I'm facing a problem. I have a race gamemode, and i have made a Saving system which will save how much races we have finished. And i want to show that thing in my /stats command but /stats command is in the filterscript. How can i add " Races Won: %d " in my stats which is in Filterscript.


Re: Using Filterscript Functions in Gamemode script - JaydenJason - 21.07.2015

Use PVars to save+load the racing count
https://sampwiki.blast.hk/wiki/SetPVarInt
https://sampwiki.blast.hk/wiki/GetPVarInt


Re: Using Filterscript Functions in Gamemode script - SpikY_ - 21.07.2015

I should add this in my Filterscript(/stats)?


Re: Using Filterscript Functions in Gamemode script - xPirate - 21.07.2015

I think you want to have (/stats) in your gamemode if i understood correctly.
So therefore, add this where you save races won.

Код:
SetPVarInt(playerid,"RacesWon",yourvariable);
Example of stats display with PVar.
Код:
CMD:stats(playerid, params[])
{
	new string[128];
	format(string,sizeof(string),"» Races won: %d",GetPVarInt(playerid, "RacesWon");
	SendClientMessage(playerid, 0xFFFFFFFF);
	return 1;
}



Re: Using Filterscript Functions in Gamemode script - SpikY_ - 21.07.2015

You understood Wrong.
Anyone else?


Re: Using Filterscript Functions in Gamemode script - SpikY_ - 21.07.2015

Sorry for the BUMP
just tell me
I should add PVars in my Filterscript(/stats)?


Re: Using Filterscript Functions in Gamemode script - xPirate - 21.07.2015

Quote:

have made a Saving system which will save how much races we have finished.

Where you have that, i don't know what you're variable is but add this:
Код:
SetPVarInt(playerid, "RacesWon",YOURVARIABLE);
Doesn't matter if its in FILTERSCRIPT or the GAMEMODE.

And where you want it to be shown use:
Код:
GetPVarInt(playerid, "RacesWon");



Re: Using Filterscript Functions in Gamemode script - ZBits - 21.07.2015

Yes.

If you are using functions from your filterscripts then use SetPVarInt(inside the FS) and use GetPVarInt in your game mode.

The examples given on the wiki page are pretty solid.


Re: Using Filterscript Functions in Gamemode script - SpikY_ - 21.07.2015

OK, Thanks. i will try it.