public
#1

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

No, but you can use a timer.
Reply
#3

and then just in the public onplayerupdate?
Reply
#4

Just dont save anything with OnPlayerUpdate.
Reply
#5

well, i gota read somethin with it..
Reply
#6

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

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?
Reply
#8

And how do you call that code ?
Reply
#9

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

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 ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)