Using Filterscript Functions in Gamemode script
#1

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.
Reply
#2

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

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

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;
}
Reply
#5

You understood Wrong.
Anyone else?
Reply
#6

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

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");
Reply
#8

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.
Reply
#9

OK, Thanks. i will try it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)