The open.mp logo
Home
FAQ
Forums
Servers
Partners
Docs
Blog

warning Not Translated

This page has not been translated into the language that your browser requested yet. The English content is being shown as a fallback.

If you want to contribute a translation for this page then please click here.

KillTimer

Description

Kills (stops) a running timer.

NameDescription
timeridThe ID of the timer to kill (returned by SetTimer or SetTimerEx).

Returns

This function always returns 0.

Examples

new
    gConnectTimer[MAX_PLAYERS] = {-1, ...};

public OnPlayerConnect(playerid)
{
    print("Starting timer...");
    gConnectTimer[playerid] = SetTimerEx("WelcomeTimer", 5000, true, "i", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    KillTimer(gConnectTimer[playerid]);
    gConnectTimer[playerid] = -1;
    return 1;
}

forward WelcomeTimer(playerid);
public WelcomeTimer(playerid)
{
    SendClientMessage(playerid, -1, "Welcome!");
}

Related Functions

  • SetTimer: Set a timer.
  • SetTimerEx: Set a timer with parameters.

Community

  • Discord
  • Instagram
  • Twitter
  • Twitch
  • YouTube
  • Facebook
  • VK

More

  • SA-MP
  • Blog
  • GitHub