Hiya. Little friendly 3 month bump here.
I am using Carlito's Roleplay in my server, which contains the pickup streamer released here. I'm having a bit of a complex problem. You see, I'd like to make certain pickups (in a dynamic house system) only appear in certain virtual worlds. While proven functional, I don't seem to catch the logic in this code.
pawn Код:
//===========================================[PICKUP STREAMER]==========================================================
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;
}
Can anyone help me out here?