OnPlayerPickupPickup -
VikThor - 16.12.2014
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 Код:
tiki = CreatePickup(1276, 23, 1583.34, -1640.16, 13.18, -1);
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == tiki)
{
PlayerInfo[playerid][pExp]++;
}
return 1;
}
Re: OnPlayerPickupPickup -
Divergent - 16.12.2014
Destroy the pickup when they pick it up so that they can't continue to pick it up.
DestroyPick(pickupid)
Re: OnPlayerPickupPickup -
dominik523 - 16.12.2014
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;
}
Re: OnPlayerPickupPickup -
VikThor - 16.12.2014
My question is,if I destroy the pickup,another players could pickup it?
Re: OnPlayerPickupPickup -
Divergent - 16.12.2014
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.
Re: OnPlayerPickupPickup -
VikThor - 16.12.2014
Ok,I'll try it!
Re: OnPlayerPickupPickup -
VikThor - 16.12.2014
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!
Re: OnPlayerPickupPickup -
M4D - 16.12.2014
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;
Re: OnPlayerPickupPickup -
dominik523 - 16.12.2014
By doing like this:
pawn Код:
PlayerInfo[playerid][pExp] = PlayerInfo[playerid][pExp] + 4;
Or this:
pawn Код:
PlayerInfo[playerid][pExp] += 4; // much easier and faster way
Re: OnPlayerPickupPickup -
VikThor - 16.12.2014
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!