25.12.2011, 13:49
Hello!
I am doing missions for APB with item pickups, but I have one problem!
So, basicaly, when player pickups "mpickup" (stands for "mission pickup"), it sets random delivery point! When player dies, new item pickup called "dropickup" (stands for "dropped pickup") creates on player death position! BUT, when I want to pickup dropped item, it "mixes" with mission pickup (created on start of a mission) and again it randomly generates new delivery point and deleting old one! Here is the code:
I dont know if this is script bug or SAMP bug!
I am doing missions for APB with item pickups, but I have one problem!
So, basicaly, when player pickups "mpickup" (stands for "mission pickup"), it sets random delivery point! When player dies, new item pickup called "dropickup" (stands for "dropped pickup") creates on player death position! BUT, when I want to pickup dropped item, it "mixes" with mission pickup (created on start of a mission) and again it randomly generates new delivery point and deleting old one! Here is the code:
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == mpickup)
{
PlayerPlaySound(playerid, 1056, 0.0, 0.0, 10.0);
HasItem[playerid] = 1;
SendClientMessage(playerid,GCOLOR_YELLOW,"MISSION: Item picked up! Now deliver it! (HELP: Delivery place is marked with checkpoint)");
DestroyPickup(mpickup);
MCP[playerid] = 1;
new rand = random(sizeof(RandomMissionEndPos));
SetPlayerCheckpoint(playerid, RandomMissionEndPos[rand][0], RandomMissionEndPos[rand][1], RandomMissionEndPos[rand][2],5);
RemovePlayerMapIcon(playerid,0);
return 1;
}
if(pickupid == dropickup)
{
PlayerPlaySound(playerid, 1056, 0.0, 0.0, 10.0);
HasItem[playerid] = 1;
SendClientMessage(playerid,GCOLOR_YELLOW,"MISSION: Item picked up!");
DestroyPickup(dropickup);
RemovePlayerMapIcon(playerid,0);
return 1;
}
return 1;
}
pawn Код:
if(inMission[playerid] == 1)
{
if(HasItem[playerid] == 1)
{
RemovePlayerMapIcon(playerid,0);
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(playerid,X,Y,Z);
dropickup = CreatePickup(1210,19,X,Y,Z,0);
SetPlayerMapIcon(playerid,0,X,Y,Z,52,-1,MAPICON_GLOBAL);
HasItem[playerid] = 0;
SendClientMessage(playerid,GCOLOR_YELLOW,"MISSION: Item dropped!");
return 1;
}
}