Jcvag44800

Système AFK par Jcvag44800 V2.1

Mar 17th, 2012
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.07 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[MAX_PLAYERS],Float:y[MAX_PLAYERS],Float:z[MAX_PLAYERS];
  9. new timer;
  10. new timer2;
  11. new etape;
  12.  
  13. forward afkkick(playerid);
  14. forward afkrandom(playerid);
  15.  
  16. public OnFilterScriptInit()
  17. {
  18.     print("\n--------------------------------------");
  19.     print(" Système AFK par Jcvag44800");
  20.     print("--------------------------------------\n");
  21.     return 1;
  22. }
  23.  
  24.  
  25. public OnPlayerCommandText(playerid, cmdtext[])
  26. {
  27.     if (strcmp("/afk", cmdtext, true, 10) == 0)
  28.     {
  29.         new name[MAX_PLAYER_NAME], string[24+MAX_PLAYER_NAME];
  30.         GetPlayerName(playerid, name, sizeof(name));
  31.         if(jAFK[playerid] == 0)
  32.         {
  33.            SendClientMessage(playerid,COLOR_WHITE,"Vous êtes AFK, pour vous enlever AFK, taper la commande /afk de nouveau.");
  34.            jAFK[playerid] = 1;
  35.            GetPlayerPos(playerid,x[playerid],y[playerid],z[playerid]);
  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 = SetTimerEx("afkkick", 1800000,true, "i", playerid);
  41.            timer2 = SetTimerEx("afkrandom", 3000,true, "i", playerid);
  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.            SetPlayerPos(playerid,x[playerid],y[playerid],z[playerid]);
  55.            SetCameraBehindPlayer(playerid);
  56.            return 1;
  57.         }
  58.     }
  59.     if(strcmp("/test", cmdtext, true, 10) == 0)
  60.     {
  61.           new string[256];
  62.           GetPlayerPos(playerid,x[playerid],y[playerid],z[playerid]);
  63.           format(string,sizeof string,"Ancienne position: %4.1f %4.1f %4.1f",x,y,z);
  64.           SendClientMessageToAll(COLOR_WHITE,string);
  65.           return 1;
  66.     }
  67.     return 0;
  68. }
  69.  
  70. public afkkick(playerid)
  71. {
  72.          SendClientMessage(playerid,COLOR_WHITE,"Vous avez été kické car vous êtes resté AFK pendant 30 minutes.");
  73.          Kick(playerid);
  74.          return 1;
  75. }
  76.  
  77. public afkrandom(playerid)
  78. {
  79.      if(etape == 0)
  80.      {
  81.         SetPlayerPos(playerid,1424.1802,-948.6891,75.9765);
  82.         SetPlayerCameraPos(playerid, 1416.4631,-926.6797,80.9006);
  83.         SetPlayerCameraLookAt(playerid, 1414.4585,-863.2814,80.0632);
  84.         etape ++;
  85.      }
  86.      else if(etape == 1)
  87.      {
  88.         SetPlayerPos(playerid,1424.1802,-948.6891,75.9765);
  89.         SetPlayerCameraPos(playerid, 1415.4370,-988.5178,104.9126);
  90.         SetPlayerCameraLookAt(playerid, 1299.1265,-1087.5731,106.6301);
  91.         etape ++;
  92.      }
  93.      else if(etape == 2)
  94.      {
  95.         SetPlayerPos(playerid,691.0711,-1312.2938,103.4302);
  96.         SetPlayerCameraPos(playerid, 637.2645,-1288.3374,128.4490);
  97.         SetPlayerCameraLookAt(playerid, 702.7493,-1319.6592,126.6574);
  98.         etape = 0;
  99.      }
  100.      return 1;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment