Wanted level timers
#1

Код:
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.
Reply
#2

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!
Reply
#3

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  
}
Reply
#4

Код:
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)