SA-MP Forums Archive
Kick gun help! :D - 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: Kick gun help! :D (/showthread.php?tid=380098)



Kick gun help! :D - MrSnapp - 24.09.2012

Hey there. I need a kick gun for fun but I do not know how to script the command to give yourself one but that's not the question. The question is when ANYONE fires a shotgun with this public variable in, it kicks them, not the person they fired it at. If you can help me create a command and or fix the variable it will be appreciated with a rep. Thanks!

Public Variable:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(GetPlayerWeapon(issuerid) == 25) return Kick(issuerid);
    return 1;
}



Re: Kick gun help! :D - clarencecuzz - 24.09.2012

pawn Код:
#define PRESSED(%0) \
    (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(PRESSED(KEY_FIRE))
    {
        if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
        {
            if(GetPlayerWeapon(playerid) == 25)
            {
                Kick(playerid);
            }
        }
    }
    return 1;
}
This should work. If you only want it to kick them when they hit someone, then use this:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid == INVALID_PLAYER_ID) return 1;
    if(weaponid == 25) return Kick(issuerid);
    return 1;
}



Re: Kick gun help! :D - [FAT]Klabauter[LST] - 24.09.2012

issuerid is the person shooting, if you wanna kick the person getting shot,

change Kick(issuerid);
to Kick(playerid);


Re: Kick gun help! :D - denNorske - 24.09.2012

Quote:
Originally Posted by [FAT]Klabauter[LST]
Посмотреть сообщение
issuerid is the person shooting, if you wanna kick the person getting shot,

change Kick(issuerid);
to Kick(playerid);
Do you mind me asking why someone should kick a player who get shot? That would be unnecessary.