Wanted level timers - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Wanted level timers (
/showthread.php?tid=275913)
Wanted level timers -
muhib777 - 11.08.2011
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerTeam(killerid) == TEAM_GANG)
{
SendClientMessage(killerid, -1, "You have killed someone you may get caught by the police");
}
return 1;
}
So I want to make a script so that when the TEAM_GANG kills someone a timer will start for 30 seconds and after that I can script what will happen to the person how do I make the timers im not used to them even though I tried wiki but it didn't help me with this.
Re: Wanted level timers -
Ruffles. - 11.08.2011
This is simple; a more advanced technique should be used if you want to get more heavily into scripting. I've basically written this on the spot, so it's untested, and "neanderthal-like".
pawn Код:
forward DeathMessage();
public OnGameModeInit()
{
// Your random crap goes here
SetTimer("DeathMessage", 30000, false); // Timer is set for 30 seconds; "false" means it won't repeat.
return 1;
}
Good luck with the other scripting!
Re: Wanted level timers -
Cypress - 11.08.2011
Here you go.
pawn Код:
forward Timer(playerid);
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerTeam(killerid) == TEAM_GANG)
{
SendClientMessage(killerid, -1, "You have killed someone you may get caught by the police");
SetTimerEx("Timer",30000,0,"d",killerid);
}
return 1;
}
public Timer(playerid)
{
//Do what you want to happen here
}
Re: Wanted level timers -
muhib777 - 11.08.2011
Код:
forward Timer(playerid);
public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerTeam(killerid) == TEAM_GANG)
{
SendClientMessage(killerid, -1, "You have killed someone you may get caught by the police");
SetTimerEx("Timer",30000,0,"d",killerid);
}
return 1;
}
public Timer(playerid)
{
switch(random(3))
{
SetPlayerWantedLevel(playerid, 0);
SetPlayerWantedLevel(playerid, 1);
SetPlayerWantedLevel(playerid, 2);
}
}
(86) : error 002: only a single statement (or expression) can follow each "case"
(86) : warning 215: expression has no effect
(90) : error 054: unmatched closing brace ("}")
What is wrong here?
Sorry fixed lol