Jcvag44800

Système AFK par Jcvag44800 V2

Mar 16th, 2012
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.85 KB | None | 0 0
  1. // Laisser les crédits pour le respect de l'auteur.
  2.  
  3. #include <a_samp>
  4.  
  5. #define COLOR_WHITE 0xFFFFFFFF
  6.  
  7. new jAFK[MAX_PLAYERS];
  8. new Float:x, Float:y, Float:z;
  9. new Float:x2, Float:y2, Float:z2;
  10. new timer;
  11. new timer2;
  12. new etape;
  13.  
  14. forward afkkick(playerid);
  15. forward afkrandom(playerid);
  16.  
  17. public OnFilterScriptInit()
  18. {
  19.     print("\n--------------------------------------");
  20.     print(" Système AFK par Jcvag44800");
  21.     print("--------------------------------------\n");
  22.     return 1;
  23. }
  24.  
  25.  
  26. public OnPlayerCommandText(playerid, cmdtext[])
  27. {
  28.     if (strcmp("/afk", cmdtext, true, 10) == 0)
  29.     {
  30.         new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  31.         GetPlayerName(playerid, name, sizeof(name));
  32.         if(jAFK[playerid] == 0)
  33.         {
  34.            SendClientMessage(playerid,COLOR_WHITE,"Vous êtes AFK, pour vous enlever AFK, taper la commande /afk de nouveau.");
  35.            jAFK[playerid] = 1;
  36.            TogglePlayerControllable(playerid,0);
  37.            format(string,sizeof string,"%s est maintenant AFK.",name);
  38.            SendClientMessageToAll(COLOR_WHITE,string);
  39.            PlayerPlaySound(playerid, 1068, 0.0, 0.0, 0.0);
  40.            timer = SetTimer("afkkick", 1800000, false);//1800000
  41.            timer2 = SetTimer("afkrandom", 0, false);
  42.            return 1;
  43.         }
  44.         else
  45.         {
  46.            jAFK[playerid] = 0;
  47.            TogglePlayerControllable(playerid,1);
  48.            format(string,sizeof string,"%s n'est plus AFK.",name);
  49.            SendClientMessageToAll(COLOR_WHITE,string);
  50.            PlayerPlaySound(playerid,1098,0.0,0.0,0.0);
  51.            KillTimer(timer);
  52.            KillTimer(timer2);
  53.            etape = 0;
  54.            return 1;
  55.         }
  56.     }
  57.     return 0;
  58. }
  59.  
  60. public afkkick(playerid)
  61. {
  62.          GetPlayerPos(playerid,x,y,z);
  63.          GetPlayerPos(playerid,x2,y2,z2);
  64.          if(x,y,z == x2,y2,z2)
  65.          {
  66.              SendClientMessage(playerid,COLOR_WHITE,"Vous avez été kické car vous êtes resté AFK pendant 30 minutes.");
  67.              Kick(playerid);
  68.              return 1;
  69.          }
  70.          return 1;
  71. }
  72.  
  73. public afkrandom(playerid)
  74. {
  75.      if(etape == 0)
  76.      {
  77.         SetPlayerPos(playerid,1424.1802,-948.6891,75.9765);
  78.         SetPlayerCameraPos(playerid, 1416.4631,-926.6797,80.9006);
  79.         SetPlayerCameraLookAt(playerid, 1414.4585,-863.2814,80.0632);
  80.         etape ++;
  81.         timer2 = SetTimer("afkrandom", 20000, false);
  82.      }
  83.      else if(etape == 1)
  84.      {
  85.         SetPlayerPos(playerid,1424.1802,-948.6891,75.9765);
  86.         SetPlayerCameraPos(playerid, 1415.4370,-988.5178,104.9126);
  87.         SetPlayerCameraLookAt(playerid, 1299.1265,-1087.5731,106.6301);
  88.         etape ++;
  89.         timer2 = SetTimer("afkrandom", 20000, false);
  90.      }
  91.      else if(etape == 2)
  92.      {
  93.         SetPlayerPos(playerid,691.0711,-1312.2938,103.4302);
  94.         SetPlayerCameraPos(playerid, 637.2645,-1288.3374,128.4490);
  95.         SetPlayerCameraLookAt(playerid, 702.7493,-1319.6592,126.6574);
  96.         etape = 0;
  97.         timer2 = SetTimer("afkrandom", 20000, false);
  98.      }
  99.      return 1;
  100. }
Advertisement
Add Comment
Please, Sign In to add comment