SA-MP Forums Archive
OnPlayerDeath /grapple - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerDeath /grapple (/showthread.php?tid=451102)



OnPlayerDeath /grapple - JimmyCh - 15.07.2013

Hi guys, so I got this feature where you /grapple and you get weapon ID 23, and you can grapple hook etc.
What I want is, that if /grapple is enabled and you die, it disables it.
Currently, if you /grapple(enable it) and die, after death you need to /grapple twice to re-enable it.
So I want to make it disabled OnPlayerDeath but I don't know how, I hope you guys can help.
My code:
pawn Код:
CMD:grapple(playerid, params[])
{
if(gPlayerClass[playerid] == SNIPER)
{
            SetPVarInt(playerid, "pv_GrappleEnabled", !GetPVarInt(playerid, "pv_GrappleEnabled"));

            switch(GetPVarInt(playerid, "pv_GrappleEnabled"))
            {
            case false:
            {
            SendClientMessage(playerid, -1, "» Grapple Hooking has been disabled.");
            SetPlayerAmmo(playerid, 23, 0);
            return 1;
            }
            case true:
            {
            SendClientMessage(playerid, -1, "» Grapple Hooking has been enabled.");
            GivePlayerWeapon(playerid, 23, 0x7F800000);
            return 1;
            }
            }
    }
    else
    {
    SendClientMessage(playerid, COLOR_RED, "Only snipers can use this!");
    return 1;
    }
return 0;
}
Thanks for all the up-coming helpers!


Re: OnPlayerDeath /grapple - JimmyCh - 16.07.2013

Bump.


Re: OnPlayerDeath /grapple - dominik523 - 16.07.2013

maybe this?
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
       SetPlayerAmmo(playerid, 23, 0);
        SetPVarInt(playerid, "pv_GrappleEnabled", 0( or your value for disabled Grapple));

}



Re: OnPlayerDeath /grapple - JimmyCh - 16.07.2013

Didnt work :/ I tried it before though..
Anyone?


Re: OnPlayerDeath /grapple - JimmyCh - 16.07.2013

Bump, need to fix this..


Re: OnPlayerDeath /grapple - JimmyCh - 16.07.2013

Anyone out there that can help? :/


Re: OnPlayerDeath /grapple - BigGroter - 16.07.2013

pawn Код:
SetPVarInt(playerid, "pv_GrappleEnabled", 0);
under OnPlayerDeath?


Re: OnPlayerDeath /grapple - JimmyCh - 16.07.2013

I did, didn't work..


Re: OnPlayerDeath /grapple - BigGroter - 16.07.2013

Meh, try using variables instead, make 'em booleans.
pawn Код:
new bool:pv_GrappleEnabled[MAX_PLAYERS];
It's easier to work with imo.