SA-MP Forums Archive
My commands is kind bugged[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: My commands is kind bugged[SOLVED] (/showthread.php?tid=111294)



My commands is kind bugged[SOLVED] - kamilbam - 30.11.2009

Well uhm i've made repair command:

Код:
dcmd_repair(const playerid, const cmdtext[])
{
	#pragma unused cmdtext
	
	if(IsPlayerInAnyVehicle(playerid) == 1)
	if(Tanker[playerid] == 1)

		{

		if(repair[playerid] == 0)

			  {
					GameTextForPlayer(playerid,"~y~You are Repairing vehicle ~n~~n~wait 10 seconds!",10000, 3);
					TogglePlayerControllable(playerid, false);
					repair[playerid] = 1;
					
					SetTimer("Repair", 60000, 0);
					
					SetTimer("opoznienier", 10000, 0);
				}
				else
				{
				  SendClientMessage(playerid,0xE2C063FF, "You have to wait 1 minute before you can use this command again!");
				}
			}
	return 1;
}
And those are publics for the timers:

Код:
public opoznienier(playerid)
{
      TogglePlayerControllable(playerid, 1);
	  RepairVehicle(GetPlayerVehicleID(playerid));
	  GameTextForPlayer(playerid,"~y~ You repaired the vehicle!",1000, 1);

     return 1;
}
Код:
public Repair(playerid)
{
	repair[playerid] = 0;
 	return 0;
}
Now the problem is that this command works PERFECT for me! but if somebody else tries to use it, it dosent unfreeze him after 10seconds, and it sends:

Код:
GameTextForPlayer(playerid,"~y~ You repaired the vehicle!",1000, 1);
to me not to the player that is using this command at the moment. I tried many things to solve this
but it still dosent work. Please help!

Regards.



Re: My commands is kind bugged. - miokie - 30.11.2009

I think its because You used SetTimer Instead of SetTimerEx

SetTimerEx of both would be:

pawn Код:
SetTimerEx("Repair",60000,0,"i",playerid);
SetTimerEx("opoznienier",10000,0,"i",playerid);



Re: My commands is kind bugged. - kamilbam - 30.11.2009

Quote:
Originally Posted by Miokie*
I think its because You used SetTimer Instead of SetTimerEx

SetTimerEx of both would be:

pawn Код:
SetTimerEx("Repair",60000,0,"i",playerid);
SetTimerEx("opoznienier",10000,0,"i",playerid);
Haha it was that easy xD its working now thank you for Help!