Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] Timer

 
  • 0 Vote(s) - 0 Average
Pawn Timer
Slade
Offline

Burgershot Member
Posts: 4
Threads: 1
Joined: Dec 2020
Reputation: 0
Location: Bosnia & Herzegovina
#7
2022-01-21, 10:17 PM
(2021-07-31, 12:48 AM)Pinch Wrote:
(2021-07-30, 10:19 PM)Radical Wrote: Set a timer with 1 second interval on OnGameModeInit() then decrease player mute time.

Code:
public OneSecondPlayerTimer() {
    foreach(new i: Player) {
        PlayerMuteCheck(i);
    }
}

PlayerMuteCheck(playerid) {
    if(PlayerInfo [playerid] [pMuted] == 1) {
        PlayerInfo [playerid] [pMuted]--;
        SendClientMessage(playerid, -1, "Mute time expired.");
    }

    if(PlayerInfo [playerid] [pMuted] > 1) PlayerInfo [playerid] [pMuted]--;
}

Also if you want check player is muted you just need check the PlayerInfo[playerid][pMuted] is not 0.
Code:
IsPlayerMuted(playerid) {
    if(PlayerInfo[playerid][pMuted] == 0) return 0;

    return 1;
}
One simple question: why.

Here's the solution:
https://ideone.com/N0ciwe

Using gettime() Mute may expire while user is simply offline. Maybe to get full potential of punishment he wants for user to be online to serve his punishment.
Still it is definetly possible and better way to do with gettime(), you just need 1 more variable to save distance on disconnect.
« Next Oldest | Next Newest »



Messages In This Thread
Timer - by njoBe_ - 2021-07-30, 08:49 PM
RE: Timer - by Radical - 2021-07-30, 10:19 PM
RE: Timer - by Pinch - 2021-07-31, 12:48 AM
RE: Timer - by Radical - 2021-07-31, 05:50 AM
RE: Timer - by njoBe_ - 2021-07-31, 09:56 AM
RE: Timer - by Pinch - 2021-07-31, 12:34 PM
RE: Timer - by Slade - 2022-01-21, 10:17 PM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode