OnPlayerPickupPickup
#1

Hello everyone,I'm here with a new little problem! I want to add some pickups on my script that gives some shit to the players that picking them.So... the problem is,what I could do if I want the player to pickup it once,not twice or much more times?
pawn Код:
new tiki
pawn Код:
tiki = CreatePickup(1276, 23, 1583.34, -1640.16, 13.18, -1);
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == tiki)
    {
        PlayerInfo[playerid][pExp]++;
    }
    return 1;
}
Reply
#2

Destroy the pickup when they pick it up so that they can't continue to pick it up.

DestroyPick(pickupid)
Reply
#3

pawn Код:
new Picked[MAX_PLAYERS];
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == tiki)
    {
        if(!Picked[playerid])
        {
                PlayerInfo[playerid][pExp]++;
                Picked[playerid] ++;
        }
    }
    return 1;
}
// or you can do this
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == tiki)
    {
        PlayerInfo[playerid][pExp]++;
        DestroyPickup(tiki);
    }
    return 1;
}
Reply
#4

My question is,if I destroy the pickup,another players could pickup it?
Reply
#5

No the pickup would be gone so other players would not be able to pick it up. You can also do as dominik said and create a variable which tells whether they have picked up a pickup or not.
Reply
#6

Ok,I'll try it!
Reply
#7

One more question,how could I put in my gamemode to give to player an amount of something,like not to give one exp point...to give to that player like 2,3,4 etc. I just can't figure it out how to do that,I'm newbie!
Reply
#8

Increase exp variable:
PlayerInfo[playerid][pExp] += amount;
For example
PlayerInfo[playerid][pExp] += 5;

Or decrease it:
PlayerInfo[playerid][pExp] -= amount;

Fir example
PlayerInfo[playerid][pExp] -= 5;
Reply
#9

By doing like this:
pawn Код:
PlayerInfo[playerid][pExp] = PlayerInfo[playerid][pExp] + 4;
Or this:
pawn Код:
PlayerInfo[playerid][pExp] += 4; // much easier and faster way
Reply
#10

Yes,I tried it,but the problem is giving me error! W8 a bit,I'll show you
EDIT: LOL,I'm newbie like I say,and I was puting like this:
pawn Код:
PlayerInfo[playerid][pExp] =+ 4;
Thank you guys,I really apreciate your quick answer!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)