SA-MP Forums Archive
[Ajuda] Problema spawnar objetos RANDOM - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Problema spawnar objetos RANDOM (/showthread.php?tid=647793)



Problema spawnar objetos RANDOM - Revolts - 11.01.2018

O que estб errado neste code? o correto seria spawnar todos os objetos, mas spawna no mбximo 5.
Nгo estб apresentando nenhum erro de compilaзгo, porem nгo estб spawnando todos os objetos

No topo
PHP код:
#define MAX_LITTER                  (20) 
PHP код:
new LitterPlaced[MAX_LITTER];
new 
LitterObjects[9] = {283726702671267226732674267526762677};
[
b]Spawn[/b]
new 
Float:LitterSpawns[MAX_LITTER][3] = // -= 0.975
{
    
// MONTGOMERY
    
{1225.847534361.66253618.646},
    {
1236.861206358.27746518.646},
    {
1254.182495348.22854618.646},
    {
1260.515991347.99481218.646},
    {
1271.184204347.47222918.646},
    {
1270.432006358.40191618.646},
    {
1283.298095372.86492918.646},
    {
1286.481201385.21130318.646},
    {
1302.524169381.48056018.646},
    {
1315.692871376.58682218.646},
    {
1329.069946370.35748218.646},
    {
1334.440673371.28451518.646},
    {
1342.016479383.92102018.646},
    {
1346.587646396.52551218.646},
    {
1369.796752409.84774718.646},
    {
1365.009277391.82461518.646},
    {
1351.626708370.96148618.646},
    {
1341.249511349.47698918.646},
    {
1331.825927324.74566618.646},
    {
1316.262817330.53039518.646}

Code que faz spawnar - "ou pelo menos deveria"
PHP код:
    //Spawn lixos
    
if(gLitterCount MAX_LITTER)
    {
        new 
litter_idx random(sizeof(LitterSpawns));
        if(
LitterPlaced[litter_idx] > 0)
        {
            
litter_idx GetNextFreeLitterSpot();
        }
        if(
litter_idx != -1)
        {
            
LitterPlaced[litter_idx] = CreateDynamicObject(LitterObjects[random(sizeof(LitterObjects))], LitterSpawns[litter_idx][0], LitterSpawns[litter_idx][1], LitterSpawns[litter_idx][2], 0.00.0float(random(360)));
            
gLitterCount ++;
        }
    } 
Porque nгo estб spawnando os 20 objetos? o que hб de errado?


Re: Problema spawnar objetos RANDOM - IlanZ - 11.01.2018

Manda esse code que faz spawnar completo.

@edit

PHP код:
for(new zMAX_LITTERz++) 
{         
    
LitterPlaced[z] = CreateDynamicObject(LitterObjects[random(sizeof(LitterObjects))], LitterSpawns[z][0], LitterSpawns[z][1], LitterSpawns[z][2], 0.00.0float(random(360)));