Pickup with keys
#1

Hello guys, i want to know how to make pickup work by key "Alt" i have found there some keys will help me https://sampwiki.blast.hk/wiki/Keys

Okay so for example i wanna add armour
pawn Код:
new pickup;
In the top of script And
pawn Код:
pickup = CreatePickup(1242, 2, Float:x, Float:y, Float:z, -1);
I want the player only get his armour if he press alt on the pickup
Thanks!,sorry for my bad english.
Reply
#2

You don't need to create a Pickup to give armour to the player, the Alt key corresponds to the Walk key by default so here is the code put this somewhere in your script :

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if (newkeys & KEY_WALK) // If the player presses the Walk key (by default Alt)
	{
		SetPlayerArmour(playerid,100);
	}
	return 1;
}
Reply
#3

Thank you for reply but i mean something else , i mean to add pickup in game but when
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    return 1;
}
He will automatically refund his armour i don't want this i want to add by Key "alt" to refund his armour
Thanks.
Reply
#4

Thanks guys , i already created |admins can delete my topic
Reply
#5

pawn Код:
new PickedArmour[MAX_PLAYERS]; // At the top of your GM

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & KEY_WALK) // If the player presses the Walk key (by default Alt)
    {
        if(PickedArmour[playerid] == 1){
            SetPlayerArmour(playerid,100);
            PickedArmour[playerid] = 0;
        }
    }
    return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
    if (pickupid == pickup){
        PickedArmour[playerid] = 1;
    }
    return 1;
}
Reply
#6

Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)