OnPlayerDeath /grapple
#1

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!
Reply
#2

Bump.
Reply
#3

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

}
Reply
#4

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

Bump, need to fix this..
Reply
#6

Anyone out there that can help? :/
Reply
#7

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

I did, didn't work..
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)