SA-MP Forums Archive
Wanted Level Cool Down Problem - 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: Wanted Level Cool Down Problem (/showthread.php?tid=396003)



Wanted Level Cool Down Problem - GoldZoroGrab - 28.11.2012

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


Re: Wanted Level Cool Down Problem - park4bmx - 28.11.2012

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;
}



Re: Wanted Level Cool Down Problem - GoldZoroGrab - 28.11.2012

anyways.......

my friend has fixed it for me

thanks for all

Roko.............