!!Need fast help!! Pickups!! PLS!! -
BlackWolf120 - 26.12.2010
hi,
i run a minigame server and ive got a problem thats killing me

Sometime theres a moneyrush mission and after a player has started the moneyrush (enter a certain checkpoint)
a moneybag pickup will appear somewhere.
I also create some info sign pickups u cant pickup but i also wrote them under //OnPlayerPickUpPickUp because as soon as a player touches it a dialog appearas where u can buy weapons.
But my problem is, that the 2 different actions the 2 pickups shall do mixes up!!
If i enter the info sign pickup, the weapons buy dialog shows up but i also get the 2000$ from the moneyrush pickup.
But i dont know why cause this are 2 different pickups!!

?
Pls help me, this is very important and i need to fix this fast!
pawn Код:
//OnGameModeInit
CreateDynamicPickup(1239,1,-2280.8867,-1659.8271,483.0706);//i use incognitos streamer btw.
//OnPlayerEnterCheckpoint
moneybag = CreatePickup(1550,2,x,y,z,0);
//OnPlayerPickUpPickUp
//info buy pickup
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(i,2,-617.0662,1970.6304,2.6061))
{
ShowPlayerDialog(i, Weaponsdialogue, DIALOG_STYLE_LIST, "Weapon", "Body Armour - 500$\nKatana - 5500$\nChainsaw - 2500$\n9mm Pistol - 2000$\nDesert Eagle - 4000$\nShotgun - 4500$\nCombat Shotgun - 8000$\nShawn off Shotgun - 12000$\nTec9 - 15000$\nMicro SMG - 15000$\nMP5 - 15000$\nAK47 - 15500$\nM4 - 15500$\nCountry Rifle - 16500$\nSniper Rifle - 20000$\nGrenade - 25000$\nMolotov Cocktail - 25000$\nRocket Launcher - 40000$\nMinigun - 40000$\nFlamethrower - 35000$", "Buy", "Cancel");
}
}
//moneybag pickup
if(pickupid == moneybag)
GivePlayerMoney(playerid,2000);
//and also a code that ends the currrent round and changes the map
pls help me
Re: !!Need fast help!! Pickups!! PLS!! -
Babul - 26.12.2010
mixing up both SAMP-native and the streamer version of creatie-pickup could be one reason. one other issue here could be that one pickup is assigned to a variable, the other not:
Код:
CreateDynamicPickup(1239,1,-2280.8867,-1659.8271,483.0706);
right: streamer command. wrong: no variable assigned.
Код:
moneybag = CreatePickup(1550,2,x,y,z,0);
right: variable assigned. wrong: native create-pickup.
try to:
define an array for holding all pickups (only their ID to compare them later)
Код:
new DynPickup[1000];
in your FilterScript / OnGameMode Init():
Код:
DynPickup[0]=CreateDynamicPickup(...);
DynPickup[1]=CreateDynamicPickup(...);
ah, dont forget to use the OnPlayerPickUpDynamicPickup() and copmpare it like
Код:
for(new pid=0;pid<1000;pid++]
{
if(pickupid==DynPickup[pid])
{
//action
}
}
gl ^^
Re: !!Need fast help!! Pickups!! PLS!! -
BlackWolf120 - 27.12.2010
thx so much this works.
But theres still a little issue.
It executes the action 1000 times.
pawn Код:
for(new pid=0;pid<1000;pid++]
{
if(pickupid==DynPickup[pid])
{
GivePlayerMoney(playerid,2000);
}
}
Here it gives me the 2000$ 1000 times so i get 2000000 instead of just 2000.
would be very happy about help.
regards.
Re: !!Need fast help!! Pickups!! PLS!! -
BlackWolf120 - 28.12.2010
could someone tell me why this is executed 1000 times.
And how to change it?
I want the functions be executed only once, after ive picked up the moneybag pickup
pls help
Re: !!Need fast help!! Pickups!! PLS!! -
_rAped - 28.12.2010
-- Missunderstood, nvm --
Re: !!Need fast help!! Pickups!! PLS!! -
Hal - 28.12.2010
Quote:
Originally Posted by BlackWolf120
thx so much this works.
But theres still a little issue.
It executes the action 1000 times.
pawn Код:
for(new pid=0;pid<1000;pid++] // this is a loop, it executes the code below the amount of times that you show it. { if(pickupid==DynPickup[pid]) { GivePlayerMoney(playerid,2000); } }
Here it gives me the 2000$ 1000 times so i get 2000000 instead of just 2000.
would be very happy about help.
regards.
|
Read my comment there
And then reduce the 1000 to the desired size of your loop
EDIT: You are probably just going to up removing the loop in total
Re: !!Need fast help!! Pickups!! PLS!! -
BlackWolf120 - 28.12.2010
thx, it works for me.

I have to try it out tomorrow with some other players though
regards.