How to make a decrease wanted
#1

Hi everyone,i would like to know how to make an decrease wanted,wich will decrease 1 star every 10 minutes,here it is what i tried,but it have a bug,it gives to all server after the timer it's finishing wanted 6..
Код:
new  myTimer[MAX_PLAYERS]; 
On Player Connect 

myTimer[playerid] = SetTimerEx("Wanted", 1000 * 60 * 10, true, "i", playerid); 

On Player Disonnect 
KillTimer(myTimer[playerid]); 


forward Wanted(playerid); 
public Wanted(playerid) { 

    SetPlayerWantedLevel(playerid,  GetPlayerWantedLevel(playerid) - 1); 
}
Reply
#2

When ever you do a ' + ' or ' - ' you must type = after it like ' += ' and ' -= '

SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) -= 1);
Reply
#3

I will try,and I will say you if it's working
Reply
#4

Nop it's not working i got some errors in pawno,and if I use simply SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) - 1); without = i don't got errors
Reply
#5

Say me the errors.. and your wanted system
Reply
#6

PHP код:
new  myTimer[MAX_PLAYERS]; // Top of your script

public OnPlayerConnect(playerid)
{
    
myTimer[playerid] = SetTimerEx("Wanted"1000 60 10true"i"playerid);
    return 
1;
}

public 
OnPlayerDisconnect(playerid)
{
    
KillTimer(myTimer[playerid]);
    return 
1;
}


forward Wanted(playerid);
public 
Wanted(playerid)
{
    if(
GetPlayerWantedLevel(playerid) > 0){
        
SetPlayerWantedLevel(playerid,  GetPlayerWantedLevel(playerid) - 1);
    }
    return 
1;

Reply
#7

It's working now,but it's a problem,it's dissapearing the wanted how i want,but in the next second it appear again..
Reply
#8

Quote:
Originally Posted by KiM0Ro
Посмотреть сообщение
It's working now,but it's a problem,it's dissapearing the wanted how i want,but in the next second it appear again..
Your server is saving the wanted level server sided then. Show us the player variable for wanted level.
Reply
#9

Here it's the code:
Код:
P_DATA [ playerid ] [ pWantedLevel ] = cache_get_field_content_int ( 0, "WantedLevel" );
Reply
#10

Hello!

Try this:
PHP код:
forward Wanted(playerid);
public 
Wanted(playerid)
{
    if(
GetPlayerWantedLevel(playerid) > 0){
        
SetPlayerWantedLevel(playerid,  GetPlayerWantedLevel(playerid) - 1);
        
P_DATA[playerid][pWantedLevel] -= 1;
    }
    return 
1;

Mencent
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)