03.02.2009, 21:15
hi, i wanted that my timer works but it doesnt.
My idea was that if someone pick up the pickup and get some cash it takes a while till the next one spawns?
I tried it again and again but without success i hope some of u can help me
I changed everything but it had any effect. First it runs but after 30sec two moneybags respawn why? i dont know please help me
My idea was that if someone pick up the pickup and get some cash it takes a while till the next one spawns?
I tried it again and again but without success i hope some of u can help me
pawn Код:
forward PickupRandomSpawn();
forward TEST();
pawn Код:
new pick1;
new pick2;
new pick3;
new Float:RandomSpawn[][3] =
{
{1945.9650,152.9478,37.0099},
{1880.4320,247.6804,27.2093},
{2019.9969,274.9753,28.5537}
};
pawn Код:
public OnGameModeInit()
{
PickupRandomSpawn();
TEST();
}
pawn Код:
public PickupRandomSpawn()
{
new iRandom = random(sizeof(RandomSpawn));
if(iRandom == 0)
{
pick1=CreatePickup(1550,3,RandomSpawn[iRandom][0],RandomSpawn[iRandom][1],RandomSpawn[iRandom][2]);
}
else if(iRandom == 1)
{
pick2=CreatePickup(1550,3,RandomSpawn[iRandom][0],RandomSpawn[iRandom][1],RandomSpawn[iRandom][2]);
}
else if(iRandom == 2)
{
pick3=CreatePickup(1550,3,RandomSpawn[iRandom][0],RandomSpawn[iRandom][1],RandomSpawn[iRandom][2]);
}
return 1;
}
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pick1 || pickupid == pick2 || pickupid == pick3)
{
GivePlayerMoney(playerid,12500);
SetTimer("PickupRandomSpawn",30000,true); // 30sec. PickupRandomSpawn();
}
return 1;
}
pawn Код:
public TEST()
{
SetTimer("PickupRandomSpawn",30000,true); // 30sec.
return 1;
}