Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == gift1)
{
if(gift1 == 0)
{
gift1=1;
SendClientMessage(playerid,0x912334,"got it");
}
else if(gift1 == 1)
{
SendClientMessage(playerid,0x912334,"Lool");
}
}
return 1;
}
first, you have to move it from
static to
dynamic. whether you need to use
streamer plugin, who can be found on the internet.
Now, let's start:
Code:
gift1 = CreatePickup(19055, 2, 1976.1938,-2380.4646,13.5469, -1);
Code:
gift1 = CreateDynamicPickup(19055, 2, 1976.1938,-2380.4646,13.5469, -1);
Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == gift1)
{
if(gift1 == 0)
{
gift1=1;
SendClientMessage(playerid,0x912334,"got it");
}
else if(gift1 == 1)
{
SendClientMessage(playerid,0x912334,"Lool");
}
}
return 1;
}
Code:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
if(pickupid == gift1)
{
if(gift1 == 0)
{
gift1=1;
SendClientMessage(playerid,0x912334,"got it");
}
else if(gift1 == 1)
{
SendClientMessage(playerid,0x912334,"Lool");
}
}
return 1;
}
now, what do you want to mean from 'if(gift1 == 0)' ?
make a variable in enum pInfo(or how do you have) with name pGiftTaken for example
Code:
enum pInfo {
pGiftTaken
}
the step two, go on OnPlayerPickUpDynamicPickup:
Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == gift1)
{
if(PlayerInfo[playerid][pGiftTaken] == 0)
{
PlayerInfo[playerid][pGiftTaken] = 1;
SendClientMessage(playerid,0x912334,"got it");
}
else if(PlayerInfo[playerid][pGiftTaken] == 1)
{
SendClientMessage(playerid,0x912334,"Lool");
}
}
return 1;
}
and now you can make this variable saveable(mysql or what you want)
this may fix your problem