public not running - 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 not running (
/showthread.php?tid=152597)
public not running -
wofka13 - 04.06.2010
(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?
Re: public not running -
PotH3Ad - 05.06.2010
Replace this line:
pawn Код:
SetTimerEx("TankZeit",2000,0, "d", setin);
With:
pawn Код:
SetTimerEx("TankZeit",2000,0, "dd", playerid, setin);
Should fix it...
Re: public not running -
wofka13 - 05.06.2010
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
Re: public not running -
Nero_3D - 05.06.2010
because the variable "insert" isnt a string
pawn Код:
format(tString,sizeof(tString),"Du hast %d Liter getankt.",insert);