Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define FILTERSCRIPT
- new bool:HasAFlashlight[MAX_PLAYERS];
- new IsFlashlightOn[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- HasAFlashlight[playerid] = false;
- IsFlashlightOn[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- HasAFlashlight[playerid] = false;
- IsFlashlightOn[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText (playerid, cmdtext[])
- {
- if (!strcmp(cmdtext, "/flon", true))
- {
- if(!IsPlayerAttachedObjectSlotUsed(playerid,8)) SetPlayerAttachedObject(playerid, 8,18641, 5, 0.1, 0.02, -0.05, 0, 0, 0, 1, 1, 1);
- RemovePlayerAttachedObject (playerid, 9);
- switch (IsFlashlightOn[playerid])
- {
- case 0, 2:
- {
- SetPlayerAttachedObject(playerid, 9,18656, 5, 0.1, 0.038, -0.1, -90, 180, 0, 0.03, 0.03, 0.03);
- IsFlashlightOn[playerid] = 1;
- }
- case 1:
- {
- SetPlayerAttachedObject(playerid, 9,18656, 5, 0.1, 0.038, -0.01, -90, 180, 0, 0.03, 0.1, 0.03);
- IsFlashlightOn[playerid] = 2;
- }
- }
- HasAFlashlight[playerid] = true;
- return 1;
- }
- if (!strcmp(cmdtext, "/floff", true))
- {
- if (!HasAFlashlight[playerid]) return SendClientMessage (playerid, -1, "Your Flashlight is already turned off.");
- if(IsPlayerAttachedObjectSlotUsed(playerid,8)) RemovePlayerAttachedObject(playerid,8);
- if(IsPlayerAttachedObjectSlotUsed(playerid,9)) RemovePlayerAttachedObject(playerid,9);
- IsFlashlightOn[playerid] = 0;
- HasAFlashlight[playerid] = false;
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement