PDA

View Full Version : WantedLevel Variable Changing..(?)


vassilis
04/11/2016, 04:11 PM
I am trying to server-side my server systems like WantedLevel etc..
So i restricted my systems to variables only.
I have some functions:

WHAT HAPPENS
http://imgur.com/5PV5dhZ.png]
WHAT SHOULD HAPPEN
Your new wanted level is 3
You have now lost a wanted level..!
You have now lost a wanted level..!
You have not any wantedlevel now..!


EDIT: Solved .. had problem at another timer with reset of my variable.

Ner0x96
04/11/2016, 05:22 PM
What I can understand is that you want to edit these texts (?)
Explain more what is the problem lol

vassilis
04/11/2016, 05:28 PM
What I can understand is that you want to edit these texts (?)
Explain more what is the problem lol

The problem is that my variable in-script changes to 0.

What should happen:
If my player has 5 wanted level stars - LoseWanted Timer starts.
Every 5 seconds timer reduce one wanted level star until it reach 0 wanted level stars.

But now no matter how many wanted level stars it has it just reduce immediately stars to 0.

Desaint
04/11/2016, 06:28 PM
At SendClientMessage add information about current fuction, please. It'll be easier to follow the script. (example "Lose Wanted was called. You have not any wantedlevel now...")
Could you upload a screenshot with /timestamp?

Sanady
04/11/2016, 07:47 PM
May I ask you, why are you using Timer there?

SickAttack
04/11/2016, 08:06 PM
After "losewanted[playerid] = SetTimerEx("LoseWanted", 5000,1,"i",playerid);" executes (in all instances) kill the timer first.

vassilis
04/11/2016, 09:17 PM
After "losewanted[playerid] = SetTimerEx("LoseWanted", 5000,1,"i",playerid);" executes (in all instances) kill the timer first.

KillTimer then execute it?

SickAttack
04/11/2016, 09:35 PM
KillTimer then execute it?

KillTimer(losewanted[playerid]);
losewanted[playerid] = SetTimerEx("LoseWanted", 5000,1,"i",playerid);

Timer IDs start at 1 and are never used twice. So it's totally safe, and it's most likely the most appropriate approach to prevent timers from calling the same function twice or more times (considering the time they were started at) for the same player.

vassilis
04/11/2016, 10:08 PM
KillTimer(losewanted[playerid]);
losewanted[playerid] = SetTimerEx("LoseWanted", 5000,1,"i",playerid);

Timer IDs start at 1 and are never used twice. So it's totally safe, and it's most likely the most appropriate approach to prevent timers from calling the same function twice or more times (considering the time they were started at) for the same player.

Ok i changed this but still that's not the problem since my problem didn't get a solution yet..
My problem is that after some seconds my pinfo[playerid][Wantedlevel] variable is resetted to 0 even if it should be reduced to 5(if wanted level was 6) to 4(if wantedlevel was 5) etc..

SickAttack
04/11/2016, 10:11 PM
Ok i changed this but still that's not the problem since my problem didn't get a solution yet..
My problem is that after some seconds my pinfo[playerid][Wantedlevel] variable is resetted to 0 even if it should be reduced to 5(if wanted level was 6) to 4(if wantedlevel was 5) etc..

Debug.