20.08.2018, 07:17
Hi, how do I make system only spawn 5 prize at one time? I'm in new mysql so my sql code kinda messed up. I know I haven't declare a but Irray don't understand how to do it with sql
PHP код:
function:OnLoadHiddenGift()
{
new rows = cache_num_rows();
if(rows)
{
new sttr[128];
for(new i = 0, l = rows; i != l; i++)
{
cache_get_field_content(i, "hobj_posx", sttr); HiddenGift[i][hobj_posx] = floatstr(sttr);
cache_get_field_content(i, "hobj_posy", sttr); HiddenGift[i][hobj_posy] = floatstr(sttr);
cache_get_field_content(i, "hobj_posz", sttr); HiddenGift[i][hobj_posz] = floatstr(sttr);
}
}
SpawnHiddenGift(5);
return 1;
}
PHP код:
stock SpawnHiddenGift(hiddengift)
{
for(new i = 0; i < hiddengift; i++)
{
new hobj = minrand(0, MAX_HGIFTS);
new hobj_i = minrand(1, 2);
new hobj_obj = 19054;
if(hobj_i == 1)
{
hobj_obj = 19054;
}
if(hobj_i == 2)
{
hobj_obj = 19055;
}
HiddenGift[hobj][hobj_spawn] = true;
HiddenGift[hobj][hobj_obj] = CreateDynamicObject(hobj_obj, HiddenGift[hobj][hobj_posx], HiddenGift[hobj][hobj_posy], HiddenGift[hobj][hobj_posz]-0.4, 0.0,0.0,0.0,-1,-1,-1,300.0);
}
return 1;
}