Wanted Level Cool Down Problem
#1

Hey Guys......................

I Made Here When Player Have Wanted Level A Timer Starts To Cool The Wanted Levels Down But When Timer Finishes It Starts Spamming The Player Chat+Wanted Levels Up And Down


Code:

pawn Код:
new WantedDown_Timer[MAX_PLAYERS];
MySetPlayerWantedLevel(playerid,lvl)
{
    if(GetPlayerWantedLevel(playerid)>=1)WantedDown_Timer[playerid]=SetTimer("WantedDown", 5000, true);
    else KillTimer(WantedDown_Timer[playerid]);
}
forward public WantedDown(playerid);
public WantedDown(playerid)
{
    SendClientMessage(playerid, COLOR_GOLD, "You WantedLevel Has Decreased.");
    MySetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)- 1);
    KillTimer(WantedDown_Timer[playerid]);
    return 1;
}
NOTE: I Made It 5 Sec To Test, So When Player Have Wanted Timer Starts, When 5 Min Pass, It Start Spamming
Reply
#2

Change the MySetPlayerWanted into a stock
Also show how you use the public, how u call the whole thing at first
edit
pawn Код:
new WantedDown_Timer[MAX_PLAYERS];
stock MySetPlayerWantedLevel(playerid,lvl)
{
    SetPlayerWantedLevel(playerid,lvl);//set the current minus level before you check it again becouse is going to be the same
    if(GetPlayerWantedLevel(playerid)>=1)WantedDown_Timer[playerid]=SetTimer("WantedDown", 5000, true);
    else KillTimer(WantedDown_Timer[playerid]);
    return1 1;
}
forward public WantedDown(playerid);
public WantedDown(playerid)
{
    SendClientMessage(playerid, COLOR_GOLD, "You WantedLevel Has Decreased.");
    MySetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid)- 1);
    KillTimer(WantedDown_Timer[playerid]);
    return 1;
}
Reply
#3

anyways.......

my friend has fixed it for me

thanks for all

Roko.............
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)