SA-MP Forums Archive
How can i make the players addicted? - 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)
+--- Thread: How can i make the players addicted? (/showthread.php?tid=432544)



How can i make the players addicted? - Don_Cage - 23.04.2013

Hello, some time ago i made it so if you smoke more than the choosen ammount of cigarettes you get cancer wich will slowly drain your health.. Well now i want to make it so if you smoke over example 20 cigarettes you become addicted and after a while if you dont smoke the screen will be weird or something. But what im wondering is.. Can i use timers for that? And then kill the timer when i use /smoke again so the timer restarts or will the timer stop and nothing more will happen after that?


Re: How can i make the players addicted? - DaTa[X] - 23.04.2013

yes you can use timer to check if the player is addicted or not


Re: How can i make the players addicted? - Don_Cage - 23.04.2013

So i with the killtimer thing i will only restart it? I mean so it will work again after lets say 1 hour


Re: How can i make the players addicted? - DaTa[X] - 23.04.2013

SetTimer
SetTimerEx
for info


Respuesta: Re: How can i make the players addicted? - JustBored - 23.04.2013

You can make a timer of 1 hour. And when 1 hour had happened check if the player has X of a variable and then if for example the player has 100 of 'X' variable put some functions to the player and the timer must be in 'true'. And i don't know, if the player smokes a cigarette the variable will go down.


Re: How can i make the players addicted? - Don_Cage - 23.04.2013

would this work for example?
pawn Код:
if(strcmp(cmd, "/command", true) == 0)
    {
        KillTimer(addictedtimer[playerid]);
        SetTimerEx("addictedtimer", 1000, 1, "i", playerid);
cuz as i understood it the killtimer wont restart the timer but stop it compleatly so if i kill the timer and then start it again with the same command would that work?