SA-MP Forums Archive
public - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: public (/showthread.php?tid=103760)



public - thuron - 21.10.2009

Is there a public like OnPlayerUpdate, but then one that can handle a lot of code??


Re: public - BloodyEric - 21.10.2009

No, but you can use a timer.


Re: public - thuron - 21.10.2009

and then just in the public onplayerupdate?


Re: public - pagie1111 - 21.10.2009

Just dont save anything with OnPlayerUpdate.


Re: public - thuron - 21.10.2009

well, i gota read somethin with it..


Re: public - Hiitch - 21.10.2009

Just do what the previous post said..

Create a timer by forwarding a public..

e.g.

pawn Код:
forward ThisTimer()
You can put stuff in the brackets like, playerid, etc.

then anywhere on the script

pawn Код:
public ThisTimer()
{
   //enter code here
}
and anywhere else in the script, I guess OnGameModeInit

pawn Код:
SetTimer("ThisTimer", //Time amount(remove this comment and put the time here), //True or false? Does it rerun or not? make sure to put code here);



Re: public - thuron - 21.10.2009

i try to read from a file: i made the public but it wont show the variable out of the file. here i read out of the file:

Код:
CurrentVal = dini_Int(file, "Val");
and here is the code out of the public:

Код:
  valCalc = (CurrentVal/5);

		if(Valcalc == 100)
		{
		  TextDrawSetString(ValBar[playerid],"..........");
		  return 1;
		}
why doesnt it -read the file/-shows the right val?


Re: public - dice7 - 21.10.2009

And how do you call that code ?


Re: public - thuron - 21.10.2009

the code i just shown is in the public Valtimer.on top of my script i have
Код:
forward ValTimer(playerid);
in my ongamemodeinit i have:
Код:
SetTimer("ValTimer", 1000, true);



Re: public - dice7 - 21.10.2009

If you want to make a timer with parameters, use SetTimerEx
https://sampwiki.blast.hk/wiki/SetTimerEx

And do you have the file created and does it have "Val=500" it it ?