SA-MP Forums Archive
Got problem using custom public... [SOLVED] - 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: Got problem using custom public... [SOLVED] (/showthread.php?tid=111037)



Got problem using custom public... [SOLVED] - woaha - 29.11.2009

Код:
#define PAY_TIME 20000
#define CAR_TOWNING_PAY 20

forward StartPayingToCarTowning(playerid);
I have timer for public StartPayingToCarTowning...
Код:
SetTimer("StartPayingToCarTowning", PAY_TIME, 1);
and public
Код:
public StartPayingToCarTowning(playerid)
{
  new string[48];
  GivePlayerMoney(playerid, CAR_TOWNING_PAY);
  format(string, sizeof(string), "PAYDAY: You have been gained %s", CAR_TOWNING_PAY);
  SendClientMessage(playerid, COLOR_WHITE, string);
  print("20 second has passed and pay has been awarded for asfasg");
  return 0;
}
The problem is: Person who should get pay, just don't get it... it just start spamming to console
"20 second has passed and pay has been awarded for asfasg"


What's the problem? :S

This is solved now.


Re: Got problem using custom public... - DeathOnaStick - 29.11.2009

Try using "return 1;" instead of "return 0;".

Cheers.


Re: Got problem using custom public... - dice7 - 29.11.2009

The return has absolutely no effect on timers. On SetTimer change the third parameter to false


Re: Got problem using custom public... - woaha - 29.11.2009

Quote:
Originally Posted by dice7
The return has absolutely no effect on timers. On SetTimer change the third parameter to false
It just stop repeating it...
Still no effect when money should be added.
It doesn't not even print "PAYDAY: You have been gained %s" message to client... when it should.
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
	{
	if	(newstate==PLAYER_STATE_DRIVER)
	  {
		if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 525)
		{
 		  print("Starting timer for PayCheckTowing...");
 		  SetTimer("StartPayingToCarTowning", PAY_TIME, false);
 		  print("Timer started...");
 		}
		if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 416)
 		{
 		  print("Starting timer for PayCheckAmbulance...");
 		  SetTimer("PayCheckAmbulance", PAY_TIME, false);
 		  print("Timer started...");
 		}
  }
 return 1;
}