[HELP] Pickup problem.
#1

So im tryng to create and destroy random pickups that respawn after some time with timers.

public OnGameModeInit()
{
SetTimer("officeobj1timer",1000,false);
SetTimer("offceobj2timer",1000,false);
SetTimer("officeobj3timer",1000,false);
SetTimer("officeobj4timer",1000,false);
}

public officeobj1timer()
{
new RandomOficinaObj1 = random( 19 );
switch( RandomOficinaObj1 )
{
case 0:
{
oficinaobj1 = CreatePickup(3027, 19, -279.4040,2602.6125,5.4469, -1); //Cigarettes
Eoficinaobj1 = 0;
}
case 1:
{
oficinaobj1 = CreatePickup(1212, 19, -279.4040,2602.6125,5.4469, -1); //Money
Eoficinaobj1 = 1;
}
case 2:
{
oficinaobj1 = CreatePickup(1951, 19, -279.4040,2602.6125,5.4469, -1); //Health
Eoficinaobj1 = 2;

}
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
new string[256];
new jname[MAX_PLAYERS];
GetPlayerName(playerid, jname, sizeof (jname));

if(pickupid == oficinaobj1)
{
if(gTeam[playerid] == TEAM_ZOMBIES) return 0;

if(Eoficinaobj1 == 99)
{
return 0;
}
else if(Eoficinaobj1 == 1)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SMO KE_CIGGY);
}
if(Eoficinaobj1 == 2)
{
GivePlayerMoney(playerid, 5000);
}
if(Eoficinaobj1 == 3)
{
SetPlayerHealth(playerid, 100);
}
Eoficinaobj1 = 99;
SetTimer("oficinaobj1timer",RANDOM_TIME,false); //random time defined as 1 minute (60000ms)
return 0;
}

Everything works fine but when i pickup all the pickups in a short time, it gets bugged and sometimes the pickups doesnt works, and in example, the money pickup doesnt give me anything, but then i pickup the health icon and it gives me the money. It seems like the pickups mixes when they respawn in diferent order.

Is this a SAMP problem or my script is wrong? Any ideas?

Thanks.
Reply


Messages In This Thread
[HELP] Pickup problem. - by Daaviid - 16.07.2013, 13:03
Re: [HELP] Pickup problem. - by MP2 - 16.07.2013, 13:13
Respuesta: [HELP] Pickup problem. - by Daaviid - 16.07.2013, 13:36

Forum Jump:


Users browsing this thread: 1 Guest(s)