SA-MP Forums Archive
Special actions - 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: Special actions (/showthread.php?tid=476710)



Special actions - AstonDA-G - 19.11.2013

I have tried to code something so that when you walk up to a point (table with beer) and hit a button, it sets the drinking action.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if((newkeys & KEY_SECONDARY_ATTACK) && !(oldkeys & KEY_SECONDARY_ATTACK))
    {
        if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_NONE) {
        SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
        SendMsg(playerid, "Press ~b~~k~~VEHICLE_ENTER_EXIT~ ~w~to drop.");
        }
    }
    return 1;
}
But instead of applying the special action, it just creates a bottle infront of Carl's hand, and if I press 'fire' he punches instead of drinking. I have nothing elsewhere in my script creating an object, what have I done?

PS. If anyone knows the ID of a crack pipe Sweet uses or the bong Tenpenny uses in some cutscenes, or if they're not available in SAMP, please let me know.

Thanks
-Aston


Re: Special actions - DarkLored - 19.11.2013

add this in your code
pawn Код:
ApplyAnimation(playerid,"VENDING","VEND_Drink_P",4.1,1,1,1,1,1,1);



Re: Special actions - AstonDA-G - 19.11.2013

Doesn't make any difference, but thanks for the reply:>
I tried the original code in a command and it worked fine, it's just when I trigger it with keys, if that makes any difference.