[HELP]Briefcase pickup help
#1

I'm trying to come up with a "game" thing for my GM that has random briefcases set at certain locations on the map. They are not meant to be shown but found randomly as players drive around.


I need help with it though, this is what i thought of so far.


The spawn points for the briefcases:

pawn Код:
new Float:SpawnPoints[6][4] =
{
{2095.3445,-1806.3239,13.5515,91.7440},
{944.7471,-1807.6704,13.7675,356.9638},
{330.3860,-1515.8201,35.8672,236.2950},
{1029.5502,-1333.8390,13.5479,357.2249},
{995.1905,-1299.2383,13.3899,178.7079},
{1697.6488,1456.3223,10.7665,275.0996}
};
Код:
mypickup = CreatePickup(1210, 2, 2491.7900, -1668.1653, 13.3438, -1);
Код:
new mypickup;
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
  if(pickupid == mypickup)
  {
   
    SendClientMessage(playerid, 0xFFFFFFFF, "You received 100 dollers!");
    GivePlayerMoney(playerid, 100);
  }
  return 1;
}


But i have no idea how to create a pickup for the briefcase at one of these random locations. Can someone help me edit the code so it works.
Reply
#2

mypickup = CreatePickup(1210, 2, RandomSpawnPoint[rand][0], RandomSpawnPoint[rand][1],RandomSpawnPoint[rand][2],RandomSpawnPoint[rand][3], RandomSpawnPoint[rand][4],RandomSpawnPoint[rand][5],RandomSpawnPoint[rand][6], -1);


try that
Reply
#3

Still having problems


This is what i have so far:

pawn Код:
new Float:BriefcasePoints[5][4] =
{
{1572.5178,-1702.7361,5.8906,294.9816},
{1558.4468,-1704.4238,5.8906,98.0614},
{1562.3147,-1695.3313,5.8906,335.0887},
{1575.8077,-1693.9064,6.2188,274.6147},
{1591.9590,-1701.3010,5.8906,309.8335}
};
pawn Код:
new rnd;
new mypickup;
mypickup = CreatePickup(1210, 2, BriefcasePoints[rnd][0], BriefcasePoints[rnd][1],BriefcasePoints[rnd][2],-1);

I'm having problems....The briefcase spawns at 1 spot only. and it takes quite a bit of time for it to spawn. Help please
Reply
#4

This should work:

pawn Код:
#define MAX_BRIEFCASE 5

new Float:BriefcasePoints[MAX_BRIEFCASE][4] = {
{1572.5178,-1702.7361,5.8906,294.9816},
{1558.4468,-1704.4238,5.8906,98.0614},
{1562.3147,-1695.3313,5.8906,335.0887},
{1575.8077,-1693.9064,6.2188,274.6147},
{1591.9590,-1701.3010,5.8906,309.8335}
};

new mypickup;
pawn Код:
for(new x=0; x<MAX_BRIEFCASE; x++)
{
    new rnd = random(x);
    mypickup = CreatePickup(1210, 2, BriefcasePoints[rnd][0], BriefcasePoints[rnd][1],BriefcasePoints[rnd][2],-1);
}
Reply
#5

I will test and respond thanks
Reply
#6

That messed up my script! It screwed up the skins selection and everything.



This is what i came up with:

Код:
#define MAX_BRIEFCASE 5
Код:
new Float:BriefcasePoints[MAX_BRIEFCASE][4] = {
{1572.5178,-1702.7361,5.8906,294.9816},
{1558.4468,-1704.4238,5.8906,98.0614},
{1562.3147,-1695.3313,5.8906,335.0887},
{1575.8077,-1693.9064,6.2188,274.6147},
{1591.9590,-1701.3010,5.8906,309.8335}
};
Код:
new rnd;
  rnd = random(sizeof (BriefcasePoints));
	mypickup = CreatePickup(1210, 2, BriefcasePoints[rnd][0], BriefcasePoints[rnd][1],BriefcasePoints[rnd][2],-1);
Can someone please help me? right now its spawning at one spot and one spot only. I pickup the briefcase it dissapears and spawns at the same spot over and over....


Reply
#7

Ok, I tried editing it a bit....

This still has a problem, it spawns at the same spot. Instead of the random ones



This is what i got:

pawn Код:
new Float:BriefcasePoints[5][4] = {
{1572.5178,-1702.7361,5.8906,294.9816},
{1558.4468,-1704.4238,5.8906,98.0614},
{1562.3147,-1695.3313,5.8906,335.0887},
{1575.8077,-1693.9064,6.2188,274.6147},
{1591.9590,-1701.3010,5.8906,309.8335}
};
pawn Код:
new rand;
rand = random(sizeof(BriefcasePoints));
AddStaticPickup(1210, 2,BriefcasePoints[rand][0], BriefcasePoints[rand][1], BriefcasePoints[rand][2]);
Reply
#8

Can someone help me out?
Reply
#9

pawn Код:
#define MAX_BRIEFCASE 5

new Float:BriefcasePoints[MAX_BRIEFCASE][4] = {
{1572.5178,-1702.7361,5.8906,294.9816},
{1558.4468,-1704.4238,5.8906,98.0614},
{1562.3147,-1695.3313,5.8906,335.0887},
{1575.8077,-1693.9064,6.2188,274.6147},
{1591.9590,-1701.3010,5.8906,309.8335}
};
pawn Код:
new rand = random(MAX_BRIEFCASE+1);
AddStaticPickup(1210, 2,BriefcasePoints[rand][0], BriefcasePoints[rand][1], BriefcasePoints[rand][2]);
Reply
#10

Quote:
Originally Posted by Killa_
pawn Код:
#define MAX_BRIEFCASE 5

new Float:BriefcasePoints[MAX_BRIEFCASE][4] = {
{1572.5178,-1702.7361,5.8906,294.9816},
{1558.4468,-1704.4238,5.8906,98.0614},
{1562.3147,-1695.3313,5.8906,335.0887},
{1575.8077,-1693.9064,6.2188,274.6147},
{1591.9590,-1701.3010,5.8906,309.8335}
};
pawn Код:
new rand = random(MAX_BRIEFCASE+1);
AddStaticPickup(1210, 2,BriefcasePoints[rand][0], BriefcasePoints[rand][1], BriefcasePoints[rand][2]);

Same thing, I added the code exactly. I added the
Код:
 new rand = random(MAX_BRIEFCASE+1);
AddStaticPickup(1210, 2,BriefcasePoints[rand][0], BriefcasePoints[rand][1], BriefcasePoints[rand][2]);
Under ongamemodeint and still. The briefcases spawn at the SAME spot over and over.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)