Flashlight Pointer
#1

pawn Код:
#include <a_samp>


//----------------------------------------------------------------------------//

public OnFilterScriptInit()
{
        print("\n-- FlashLight Pointer --\n");
        new p = GetMaxPlayers();
        for (new i=0; i < p; i++)
        {
                SetPVarInt(i, "FlashLight", 0);
                SetPVarInt(i, "color", 18641);
        }
        return 1;
}

public OnFilterScriptExit()
{
        new p = GetMaxPlayers();
        for (new i=0; i < p; i++)
        {
                SetPVarInt(i, "FlashLight", 0);
                RemovePlayerAttachedObject(i, 0);
        }
        return 1;
}

//----------------------------------------------------------------------------//

public OnPlayerSpawn(playerid) {
        SetPVarInt(playerid, "FlashLight", 1);
        return 1;
}

public OnPlayerDisconnect(playerid) {
        SetPVarInt(playerid, "FlashLight", 0);
        RemovePlayerAttachedObject(playerid, 0);
        return 1;
}

//----------------------------------------------------------------------------//

public OnPlayerCommandText(playerid, cmdtext[]) {

        new cmd[256];
        new idx;
        cmd = strtok(cmdtext, idx);

        if (!strcmp("/FlashLighton", cmdtext, true)) {
                SetPVarInt(playerid, "FlashLight", 1);
                return 1;
        }

        if (!strcmp("/FlashLightoff", cmdtext, true)) {
                SetPVarInt(playerid, "FlashLight", 0);
                RemovePlayerAttachedObject(playerid, 0);
                return 1;
        }
        return 0;
}

//----------------------------------------------------------------------------//
public OnPlayerUpdate(playerid)
{
        if (GetPVarInt(playerid, "FlashLight"))
        {
                RemovePlayerAttachedObject(playerid, 0);
                if ((IsPlayerInAnyVehicle(playerid)) || (IsPlayerInWater(playerid)))
                return 1;
                switch (GetPlayerWeapon(playerid))
                {
                        case 23:
                        {
                                if (IsPlayerAiming(playerid))
                                {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing aiming
                                                0.108249, 0.030232, 0.118051, 1.468254, 350.512573, 364.284240, 1.0, 1.0, 1.0);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched aiming
                                                0.108249, 0.030232, 0.118051, 1.468254, 349.862579, 364.784240, 1.0, 1.0, 1.0);
                                        }
                                } else {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP standing not aiming
                                                0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216, 1.0, 1.0, 1.0);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SP crouched not aiming
                                                0.078248, 0.027239, 0.113051, -11.131746, 350.602722, 362.384216, 1.0, 1.0, 1.0);
                        }       }       }
                        case 27: {
                                if (IsPlayerAiming(playerid)) {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing aiming
                                                0.588246, -0.022766, 0.138052, -11.531745, 347.712585, 352.784271, 1.0, 1.0, 1.0);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched aiming
                                                0.588246, -0.022766, 0.138052, 1.468254, 350.712585, 352.784271, 1.0, 1.0, 1.0);
                                        }
                                } else {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS standing not aiming
                                                0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216, 1.0, 1.0, 1.0);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // SPAS crouched not aiming
                                                0.563249, -0.01976, 0.134051, -11.131746, 351.602722, 351.384216, 1.0, 1.0, 1.0);
                        }       }       }
                        case 30: {
                                if (IsPlayerAiming(playerid)) {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing aiming
                                                0.628249, -0.027766, 0.078052, -6.621746, 352.552642, 355.084289, 1.0, 1.0, 1.0);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched aiming
                                                0.628249, -0.027766, 0.078052, -1.621746, 356.202667, 355.084289, 1.0, 1.0, 1.0);
                                        }
                                } else {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK standing not aiming
                                                0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216, 1.0, 1.0, 1.0);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // AK crouched not aiming
                                                0.663249, -0.02976, 0.080051, -11.131746, 358.302734, 353.384216, 1.0, 1.0, 1.0);
                        }       }       }
                        case 31: {
                                if (IsPlayerAiming(playerid)) {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing aiming
                                                0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289, 1.0, 1.0, 1.0);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched aiming
                                                0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289, 1.0, 1.0, 1.0);
                                        }
                                } else {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 standing not aiming
                                                0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222, 1.0, 1.0, 1.0);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // M4 crouched not aiming
                                                0.503249, -0.02376, 0.065051, -11.131746, 357.302734, 354.484222, 1.0, 1.0, 1.0);
                        }       }       }
            case 34: {
                if (IsPlayerAiming(playerid))
                {
                    /*if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                    {
                        SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing aiming
                        0.528249, -0.020266, 0.068052, -6.621746, 352.552642, 355.084289, 1.0, 1.0, 1.0);
                    } else {
                        SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched aiming
                        0.528249, -0.020266, 0.068052, -1.621746, 356.202667, 355.084289, 1.0, 1.0, 1.0);
                    }*/

                    return 1;
                } else {
                    if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                    {
                        SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper standing not aiming
                        0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259, 1.0, 1.0, 1.0);
                    } else {
                        SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // Sniper crouched not aiming
                        0.658248, -0.03276, 0.133051, -11.631746, 355.302673, 353.584259, 1.0, 1.0, 1.0);
            }   }   }
                        case 29:
                        {
                                if (IsPlayerAiming(playerid))
                                {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing aiming
                                                0.298249, -0.02776, 0.158052, -11.631746, 359.302673, 357.584259, 1.0, 1.0, 1.0);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched aiming
                                                0.298249, -0.02776, 0.158052, 8.368253, 358.302673, 352.584259, 1.0, 1.0, 1.0);
                                        }
                                } else {
                                        if (GetPlayerSpecialAction(playerid) != SPECIAL_ACTION_DUCK)
                                        {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 standing not aiming
                                                0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222, 1.0, 1.0, 1.0);
                                        } else {
                                                SetPlayerAttachedObject(playerid, 0, GetPVarInt(playerid, "color"), 6, // MP5 crouched not aiming
                                                0.293249, -0.027759, 0.195051, -12.131746, 354.302734, 352.484222, 1.0, 1.0, 1.0);
        }       }       }       }       }
        return 1;
}

stock IsPlayerInWater(playerid)
{
        new anim = GetPlayerSpecialAction(playerid);
        if (((anim >=  1538) && (anim <= 1542)) || (anim == 1544) || (anim == 1250) || (anim == 1062)) return 1;
        return 0;
}

stock IsPlayerAiming(playerid)
{
    new anim = GetPlayerSpecialAction(playerid);
    if (((anim >= 1160) && (anim <= 1163)) || (anim == 1167) || (anim == 1365) ||
    (anim == 1643) || (anim == 1453) || (anim == 220)) return 1;
    return 0;
}

//----------------------------------------------------------------------------//

strtok(const string[], &index)
{
        new length = strlen(string);
        while ((index < length) && (string[index] <= ' '))
        {
                index++;
        }

        new offset = index;
        new result[20];
        while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
        {
                result[index - offset] = string[index];
                index++;
        }
        result[index - offset] = EOS;
        return result;
}

//----------------------------------------------------------------------------//
Could you set the correct coordinates for me? Put the flashlight on the m4 at the side of the m4 Maybe not at the same side as where the laser is.. So with M4 I can use the laser AND the flashlight!! A real SWAT M4 Pleaseee.. could you do this for me?? If you don't want to do it all, then only do the m4
Reply
#2

Bump
Reply
#3

Re-Bump. Some Coordinate Expert please help this guy
Reply
#4

Quote:
Originally Posted by [RaZ]Hal_Moore
Посмотреть сообщение
Re-Bump. Some Coordinate Expert please help this guy
Thanks for the effort. And yea, I still need help with this one!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)