[SOLVED]
#1

Hello, I included pickup streamer in my server and it look like this:

Код:
#define PICKUP_RANGE 50
Код:
forward CreateStreamPickup(model,type,Float:x,Float:y,Float:z,range);
forward StreamPickups();
forward Pickup_AnyPlayerToPoint(Float:radi, Float:x, Float:y, Float:z);
forward DestroyStreamPickup(ID);
forward CountStreamPickups();
forward ChangeStreamPickupModel(ID,newmodel);
forward ChangeStreamPickupType(ID,newtype);
forward MoveStreamPickup(ID,Float:x,Float:y,Float:z);
Код:
public OnGameModeInit()
{
for(new i = 0; i < sizeof(BurgerDriveIn); i++)
	{
	  BurgerPickUp[i] = CreateStreamPickup(1239, 23, BurgerDriveIn[i][0], BurgerDriveIn[i][1], BurgerDriveIn[i][2], PICKUP_RANGE);
		pickups++;
	}
 	for(new i = 0; i < sizeof(ChickenDriveIn); i++)
	{
	  ChickenPickUp[i] = CreateStreamPickup(1239, 23, ChickenDriveIn[i][0], ChickenDriveIn[i][1], ChickenDriveIn[i][2], PICKUP_RANGE);
		pickups++;
	}
return 1;
}
Код:
public CreateStreamPickup(model,type,Float:x,Float:y,Float:z,range)
{
	new FoundID = 0;
	new ID;

	for ( new i = 0; FoundID <= 0 ; i++)
	{
	  if( Pickup[i][pickupCreated] == 0 )
	  {
	    if( FoundID == 0 )
	    {
	   	  ID = i;
	   	  FoundID = 1;
	    }
	  }
	  if( i > MAX_PICKUPS )
	  {
		  FoundID = 2;
		}
	}
	if( FoundID == 2 )
	{
	  print("Pickup limit reached! Pickup not created!");
	  return -1;
	}
	Pickup[ID][pickupCreated] = 1;
	Pickup[ID][pickupVisible] = 0;
	Pickup[ID][pickupModel] = model;
	Pickup[ID][pickupType] = type;
	Pickup[ID][pickupX] = x;
	Pickup[ID][pickupY] = y;
	Pickup[ID][pickupZ] = z;
	Pickup[ID][pickupRange] = range;
	return ID;

}
public DestroyStreamPickup(ID)
{
	if(Pickup[ID][pickupCreated])
	{
		DestroyPickup(Pickup[ID][pickupID]);
		Pickup[ID][pickupCreated] = 0;
		return 1;
	}
	return 0;
}
public CountStreamPickups()
{
	new count = 0;
	for(new i = 0; i < MAX_PICKUPS; i++)
	{
	  if(Pickup[i][pickupCreated] == 1)
	  {
			count++;
	  }
	}
	return count;
}
public StreamPickups()
{
	for(new i = 0; i < MAX_PICKUPS; i++)
	{
	  if(Pickup[i][pickupCreated] == 1)
	  {
			if(Pickup_AnyPlayerToPoint(Pickup[i][pickupRange],Pickup[i][pickupX],Pickup[i][pickupY],Pickup[i][pickupZ]))
			{
			  if(Pickup[i][pickupVisible] == 0)
			  {
			    Pickup[i][pickupID] = CreatePickup(Pickup[i][pickupModel],Pickup[i][pickupType],Pickup[i][pickupX],Pickup[i][pickupY],Pickup[i][pickupZ]);
			    Pickup[i][pickupVisible] = 1;
				}
			}
			else
			{
			  if(Pickup[i][pickupVisible] == 1)
			  {
			    DestroyPickup(Pickup[i][pickupID]);
					Pickup[i][pickupVisible] = 0;
			  }
			}
	  }
	}
}
public MoveStreamPickup(ID,Float:x,Float:y,Float:z)
{
	if(Pickup[ID][pickupCreated])
	{
	  DestroyPickup(Pickup[ID][pickupID]);
	  Pickup[ID][pickupVisible] = 0;
		Pickup[ID][pickupX] = x;
		Pickup[ID][pickupY] = y;
		Pickup[ID][pickupZ] = z;
		return 1;
	}
	return 0;
}
public ChangeStreamPickupModel(ID,newmodel)
{
  if(Pickup[ID][pickupCreated])
	{
	  DestroyPickup(Pickup[ID][pickupID]);
	  Pickup[ID][pickupVisible] = 0;
		Pickup[ID][pickupModel] = newmodel;
		return 1;
	}
	return 0;
}
public ChangeStreamPickupType(ID,newtype)
{
  if(Pickup[ID][pickupCreated])
	{
	  DestroyPickup(Pickup[ID][pickupID]);
	  Pickup[ID][pickupVisible] = 0;
		Pickup[ID][pickupType] = newtype;
		return 1;
	}
	return 0;
}
public Pickup_AnyPlayerToPoint(Float:radi, Float:x, Float:y, Float:z)
{
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
	  if(IsPlayerConnected(i))
		{
			new Float:oldposx, Float:oldposy, Float:oldposz;
			new Float:tempposx, Float:tempposy, Float:tempposz;
			GetPlayerPos(i, oldposx, oldposy, oldposz);
			tempposx = (oldposx -x);
			tempposy = (oldposy -y);
			tempposz = (oldposz -z);
			if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
			{
				return 1;
			}
		}
	}
  return 0;
}
The thing is, I it dont show the pickups... I dont know what happened, but it just dont work.
Reply
#2

So anyone know whats wrong?
Reply
#3

Quote:
Originally Posted by kukars22
The thing is, I it dont show the pickups...
Wrong VirtualWorld-ID?
Reply
#4

SOLVED!
I forgot about Timer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)