Advertisement
SHOROOP

SFFS (Simple Flashlight Filterscript)

Nov 6th, 2013
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.47 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. new bool:HasAFlashlight[MAX_PLAYERS];
  6. new IsFlashlightOn[MAX_PLAYERS];
  7.  
  8. public OnPlayerConnect(playerid)
  9. {
  10.     HasAFlashlight[playerid] = false;
  11.     IsFlashlightOn[playerid] = 0;
  12.     return 1;
  13. }
  14.  
  15. public OnPlayerDisconnect(playerid)
  16. {
  17.     HasAFlashlight[playerid] = false;
  18.     IsFlashlightOn[playerid] = 0;
  19.     return 1;
  20. }
  21.  
  22. public OnPlayerCommandText (playerid, cmdtext[])
  23. {
  24.     if (!strcmp(cmdtext, "/flon", true))
  25.     {
  26.         if(!IsPlayerAttachedObjectSlotUsed(playerid,8)) SetPlayerAttachedObject(playerid, 8,18641, 5, 0.1, 0.02, -0.05, 0, 0, 0, 1, 1, 1);
  27.         RemovePlayerAttachedObject (playerid, 9);
  28.         switch (IsFlashlightOn[playerid])
  29.         {
  30.             case 0, 2:
  31.             {
  32.                 SetPlayerAttachedObject(playerid, 9,18656, 5, 0.1, 0.038, -0.1, -90, 180, 0, 0.03, 0.03, 0.03);
  33.                 IsFlashlightOn[playerid] = 1;
  34.             }
  35.             case 1:
  36.             {
  37.                 SetPlayerAttachedObject(playerid, 9,18656, 5, 0.1, 0.038, -0.01, -90, 180, 0, 0.03, 0.1, 0.03);
  38.                 IsFlashlightOn[playerid] = 2;
  39.             }
  40.         }
  41.         HasAFlashlight[playerid] = true;
  42.         return 1;
  43.     }
  44.     if (!strcmp(cmdtext, "/floff", true))
  45.     {
  46.         if (!HasAFlashlight[playerid]) return SendClientMessage (playerid, -1, "Your Flashlight is already turned off.");
  47.         if(IsPlayerAttachedObjectSlotUsed(playerid,8)) RemovePlayerAttachedObject(playerid,8);
  48.         if(IsPlayerAttachedObjectSlotUsed(playerid,9)) RemovePlayerAttachedObject(playerid,9);
  49.         IsFlashlightOn[playerid] = 0;
  50.         HasAFlashlight[playerid] = false;
  51.         return 1;
  52.     }
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement