public not running
#1

(Sry for bad English ! )
Hi Guys,
i habe problem with my CMD.
Код:
forward TankZeit(playerid, insert);
Код:
if(strcmp(cmd,"/tanken",true)==0)
	{
	  if(!TankStation(playerid))return SendClientMessage(playerid,FARBE_WEIЯ,"Du bist nicht an einer Tank Station!");
   	if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,FARBE_WEIЯ,"Du bist nicht in einem Fahrzeug!");
   	if(GetPlayerMoney(playerid) < 100)return SendClientMessage(playerid,FARBE_WEIЯ,"Du hast nicht genug Geld!");
   	tmp = strtok(cmdtext, idx);
   	if(!strlen(tmp))return SendClientMessage(playerid,FARBE_WEIЯ,"Benutzung: Benutze /tanken [menge]");
   	new setin = strval(tmp);
		TogglePlayerControllable(playerid,0);
		SetTimerEx("TankZeit",2000,0, "d", setin);
		return 1;
	}
	return 1;
}
Код:
public TankZeit(playerid, insert)
{
  new Liter = GetPlayerVehicleID(playerid);
  new tString[64];
  Benzin[Liter] += insert;
	format(tString,sizeof(tString),"Du hast %s Liter getankt.",insert);
	SendClientMessage(playerid,FARBE_GELB,tString);
	TogglePlayerControllable(playerid,1);
	return 1;
}
So, my problem is the public TankZeit
If I run the cmd, so everything is still working, I hang and can not move me, as it also should be, but the timer is running and then trigger the public will not work correctly. I will not after 2000 milliseconds unfreezed and my petrol indicator does not rise to the entered number in /tanken [number], and as I get no message, my display tank does not rise and I stay freezed, so it looks like as if the public is not running, can someone help me?
Reply
#2

Replace this line:

pawn Код:
SetTimerEx("TankZeit",2000,0, "d", setin);
With:

pawn Код:
SetTimerEx("TankZeit",2000,0, "dd", playerid, setin);
Should fix it...
Reply
#3

Quote:
Originally Posted by PotH3Ad
Replace this line:

pawn Код:
SetTimerEx("TankZeit",2000,0, "d", setin);
With:

pawn Код:
SetTimerEx("TankZeit",2000,0, "dd", playerid, setin);
Should fix it...
Thank you very much, it works now, but there is still a problem,
if the public is running, and I get the text
"Du hast %s Liter getankt."
will insert a number not shown
http://s1.directupload.net/images/100605/xw9yb8cn.jpg
with %d it does not work unfortunately
I hope you can help me
Reply
#4

because the variable "insert" isnt a string

pawn Код:
format(tString,sizeof(tString),"Du hast %d Liter getankt.",insert);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)