Spawn few objects / max - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Spawn few objects / max (
/showthread.php?tid=657619)
Spawn few objects / max -
AzaMx - 12.08.2018
How can I make this system only spawn 5 giftboxes / 100 at one time.
PHP код:
function:OnLoadGiftboxes()
{
new rows = cache_num_rows();
new iCount;
if(rows)
{
new iGet[128];
for(new i = 0, l = rows; i != l; i++)
{
cache_get_field_content(i, "gbox_x", iGet); Giftboxes[i][gbox_x] = floatstr(iGet);
cache_get_field_content(i, "gbox_y", iGet); Giftboxes[i][gbox_y] = floatstr(iGet);
cache_get_field_content(i, "gbox_z", iGet); Giftboxes[i][gbox_z] = floatstr(iGet);
Giftboxes[i][gbox_active]=false;
// ActivateGiftboxes(5); when I put here, all giftboxes spawned.
iCount++;
}
}
// ActivateGiftboxes(5); When I put here, it shows only 5 objects but spawned at 0,0,0, cords (blueberry).
printf("[Debug - Giftboxes] A total of %d/%d/%d giftboxes have been loaded from the database.", iCount, rows, MAX_GIFTBOXES);
return 1;
}
Re: Spawn few objects / max -
AzaMx - 12.08.2018
anyone?
Re: Spawn few objects / max -
Bigwebicek - 12.08.2018
show activategiftboxes()
Re: Spawn few objects / max -
TheBlackHand - 12.08.2018
Show this function
PHP код:
ActivateGiftboxes
Re: Spawn few objects / max -
Pottus - 12.08.2018
You shouldn't directly set array values try and call a creation function instead it makes it easier to isolate error checking in a function that might be called from multiple functions it's self.
Re: Spawn few objects / max -
AzaMx - 12.08.2018
my activategiftboxes.
PHP код:
stock ActivateGiftboxes(ggiftboxes)
{
for(new i = 0; i < ggiftboxes; i++)
{
new gbox = minrand(0, MAX_GIFTBOXES);
new gbox_i = minrand(1, 15);
new gboxe_obj = 19054;
if(gbox_i == 1)
{
gboxe_obj = 19054;
}
if(gbox_i == 2)
{
gboxe_obj = 19055;
}
if(gbox_i == 3)
{
gboxe_obj = 19056;
}
if(gbox_i == 4)
{
gboxe_obj = 19057;
}
if(gbox_i == 5)
{
gboxe_obj = 19058;
}
if(gbox_i == 6)
{
gboxe_obj = 19054;
}
if(gbox_i == 7)
{
gboxe_obj = 19058;
}
if(gbox_i == 8)
{
gboxe_obj = 19058;
}
if(gbox_i == 9)
{
gboxe_obj = 19058;
}
if(gbox_i == 10)
{
gboxe_obj = 19058;
}
if(gbox_i == 11)
{
gboxe_obj = 19058;
}
if(gbox_i == 12)
{
gboxe_obj = 19055;
}
if(gbox_i == 13)
{
gboxe_obj = 19056;
}
if(gbox_i == 14)
{
gboxe_obj = 19058;
}
if(gbox_i == 15)
{
gboxe_obj = 19058;
}
Giftboxes[gbox][gbox_active] = true;
Giftboxes[gbox][gbox_obj] = CreateDynamicObject(gboxe_obj, Giftboxes[gbox][gbox_x], Giftboxes[gbox][gbox_y], Giftboxes[gbox][gbox_z]-0.4, 0.0,0.0,0.0,-1,-1,-1,300.0);
}
return 1;
}
Re: Spawn few objects / max -
AzaMx - 14.08.2018
bump.