am I doing that right? - 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: am I doing that right? (
/showthread.php?tid=382841)
am I doing that right? -
_Khaled_ - 05.10.2012
I want to do a timer for wanted level decreasing.
pawn Код:
forward WantedLevelColor(playerid);
public WantedLevelColor(playerid)
{
new wanted = GetPlayerWantedLevel(playerid);
if(wanted ==6)
{
SetPlayerColor(playerid, COLOR_RED);
HasWantedTime[playerid]=300;
}
if(wanted ==3)
{
SetPlayerColor(playerid, COLOR_YELLOW);
HasTicketTime[playerid]=150;
}
if(wanted == 0)
{
SetPlayerToTeamColour(playerid);
}
return true;
}
public OnPlayerUpdate(playerid)
{
WantedLevelColor(playerid);
return true;
}
//==================================//
//Public OneSecondTimer.
public OneSecondTimer()
{
new pname[MAX_PLAYER_NAME];
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(HasWantedTime[i] >= 2)
{
HasWantedTime[i] --;
}
if(HasTicketTime[i] >= 2)
{
HasTicketTime[i] --;
}
if(HasWantedTime[i] == 1)
{
SendClientMessage(i,COLOR_YELLOW,"Your wanted level has been decreased, you're now a suspect.");
SetPlayerWantedLevel(i,3);
SetPlayerColor(i, COLOR_YELLOW);
}
if(HasTicketTime[i] == 1)
{
SendClientMessage(i,COLOR_YELLOW,"You are no-longer a suspect.");
SetPlayerWantedLevel(i,0);
SetPlayerColor(i, COLOR_WHITE);
TimeToPayTicket[i] =0;
HasTicket[i] =0;
}
}
}
}
Is it right?
Re: am I doing that right? -
Roel - 05.10.2012
Did you test it?
Did it work?
if it not, What didn't work?
Re: am I doing that right? -
_Khaled_ - 05.10.2012
IT takes too long for the time interval I done..
Re: am I doing that right? -
Roel - 05.10.2012
Show us your settimer line.
Re: am I doing that right? -
JaKe Elite - 05.10.2012
Use your brain,
Set the time interval to 1 minute so you can check it if it's working.
Don't spam such like this.