T4125Gamer

Untitled

Jun 4th, 2021
875
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Oben im Script für den Timer
  2. new CheckPlayerDutyTimer[MAX_PLAYERS];
  3.  
  4. //Player Info anpassen
  5. enum playerData{
  6.     pJobEnde[5]
  7. }
  8. new sInfo[MAX_PLAYERS][playerData];
  9.  
  10. //Timer für Public Aufruf in OnPlayerConnect
  11. public OnPlayerConnect(playerid){
  12.     CheckPlayerDutyTimer[playerid] = SetTimerEx("CheckPlayerDutyTime", 60000, true, "i", playerid); //Jede Minute
  13. }
  14.  
  15. //Timer Killen wenn Spieler Server verlässt
  16. public OnPlayerDisconnect(playerid){
  17.     KillTimer(CheckPlayerDutyTimer[playerid]);
  18. }
  19.  
  20. //Spieler Daten anpassen, damit das Script weiß, wann der Spieler aus hat
  21. //Das kannst du einfügen, wo es am besten passt
  22. format(sInfo[playerid][pJobEnde], 5, "18:00");
  23.  
  24. //Funktion erstellen
  25. stock OnPlayerEndJob(playerid, time[]){
  26.     new train_departure[5];
  27.     if(!strcmp(time, "16:30")){
  28.         format(train_departure, 6, "15:24");
  29.     }else if(!strcmp(time, "17:00")){
  30.         format(train_departure, 6, "16:14");
  31.     }else if(!strcmp(time, "18:00")){
  32.         format(train_departure, 6, "17:17");
  33.     }
  34.     return train_departure;
  35. }
  36.  
  37. //Einen Check einfügen
  38. forward CheckPlayerDutyTime(playerid)
  39. public CheckPlayerDutyTime(playerid){
  40.     if(sInfo[playerid][pDuty]){
  41.         new timeString[6], string[128];
  42.         new Hour,Minute,Second;
  43.         gettime(Hour, Minute, Second);
  44.         format(timeString,sizeof(timeString), "%02d:%02d", Hour, Minute);
  45.         if(!strcmp(timeString, OnPlayerEndJob(playerid, sInfo[playerid][pJobEnde])){
  46.             SendClientMessage(playerid, -1, "Dein Job ist Zuende!");
  47.         }
  48.     }
  49.     return 1;
  50. }
RAW Paste Data