SA-MP Forums Archive
[DUV] Variavel criar objetos - 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: [DUV] Variavel criar objetos (/showthread.php?tid=171524)



[DUV] Variavel criar objetos - BiieL - 26.08.2010

Sei que й possivel uma variavel ser usada pra criar objetos, como:
pawn Код:
Navio = CreateObject(10771,885.19287109,-2979.91235352,3.60642958,0.00000000,0.00000000,0.00000000); //object(carrier_hull_sfse) (1) navio
mas seria possivel essa mesma variavel criar muito mais objetos de uma vez ?
exemplo:

pawn Код:
Navio = CreateObject(10771,885.19287109,-2979.91235352,3.60642958,0.00000000,0.00000000,0.00000000); //object(carrier_hull_sfse) (1) navio
    Navio = CreateObject(11145,819.40930176,-2980.10034180,2.65397930,0.00000000,0.00000000,0.00000000); //object(carrier_lowdeck_sfs) (1) navio
    Navio = CreateObject(10770,888.35449219,-2987.49316406,36.78397369,0.00000000,0.00000000,0.00000000); //object(carrier_bridge_sfse) (1) navio
?


Re: [DUV] Variavel criar objetos - zSuYaNw - 26.08.2010

Assim й o correto.

pawn Код:
new Navio[4]; // no topo


public OnGameModeInit()
{
Navio[0] = CreateObject(10771,885.19287109,-2979.91235352,3.60642958,0.00000000,0.00000000,0.00000000); //object(carrier_hull_sfse) (1) navio
    Navio[1] = CreateObject(11145,819.40930176,-2980.10034180,2.65397930,0.00000000,0.00000000,0.00000000); //object(carrier_lowdeck_sfs) (1) navio
    Navio[2] = CreateObject(10770,888.35449219,-2987.49316406,36.78397369,0.00000000,0.00000000,0.00000000); //object(carrier_bridge_sfse) (1) navio
Navio[3] = CreateObject(10771,885.19287109,-2979.91235352,3.60642958,0.00000000,0.00000000,0.00000000); //object(carrier_hull_sfse) (1) navio
return 1;
}



Re: [DUV] Variavel criar objetos - BiieL - 26.08.2010

depois testo, tem outro jeito de fazer a mesma coisa mas usando apenas uma variavel tb ?


Re: [DUV] Variavel criar objetos - zSuYaNw - 26.08.2010

pawn Код:
new
      navio1,
      navio2,
      navio3,
      navio4
;
public public OnGameModeInit()
{
Navio1 = CreateObject(10771,885.19287109,-2979.91235352,3.60642958,0.00000000,0.00000000,0.00000000); //object(carrier_hull_sfse) (1) navio
    Navio2 = CreateObject(11145,819.40930176,-2980.10034180,2.65397930,0.00000000,0.00000000,0.00000000); //object(carrier_lowdeck_sfs) (1) navio
    Navio3 = CreateObject(10770,888.35449219,-2987.49316406,36.78397369,0.00000000,0.00000000,0.00000000); //object(carrier_bridge_sfse) (1) navio
Navio4 = CreateObject(10771,885.19287109,-2979.91235352,3.60642958,0.00000000,0.00000000,0.00000000); //object(carrier_hull_sfse) (1) navio
return 1;
}



Re: [DUV] Variavel criar objetos - BiieL - 26.08.2010

hehe, esse eu sabia, mas ok, ia dar muitas linhas, hein, mas quando vou usa-lo (primeira forma), por exemplo
pawn Код:
SetObjectPos(Navio[4], ...);
assim que uso ?


Re: [DUV] Variavel criar objetos - zSuYaNw - 26.08.2010

olha ali pow:

pawn Код:
Navio[4] = SetObjectPos(....)



Re: [DUV] Variavel criar objetos - BiieL - 26.08.2010

ta esquece, e se eu for usar DestroyObject


Re: [DUV] Variavel criar objetos - zSuYaNw - 26.08.2010

pawn Код:
DestroyObject(Navio[4])
rsrs...

me surpreendi agora [....]


Re: [DUV] Variavel criar objetos - BiieL - 26.08.2010

Код:
C:\Documents and Settings\Marxista\Meus documentos\Servers\Samp Server 7777 0.3a\gamemodes\B.A.S.E..pwn(815) : error 032: array index out of bounds (variable "Navio")
C:\Documents and Settings\Marxista\Meus documentos\Servers\Samp Server 7777 0.3a\gamemodes\B.A.S.E..pwn(962) : error 032: array index out of bounds (variable "Navio")
C:\Documents and Settings\Marxista\Meus documentos\Servers\Samp Server 7777 0.3a\gamemodes\B.A.S.E..pwn(1732) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Marxista\Meus documentos\Servers\Samp Server 7777 0.3a\gamemodes\B.A.S.E..pwn(1737) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Marxista\Meus documentos\Servers\Samp Server 7777 0.3a\gamemodes\B.A.S.E..pwn(1742) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\Marxista\Meus documentos\Servers\Samp Server 7777 0.3a\gamemodes\B.A.S.E..pwn(1747) : error 035: argument type mismatch (argument 1)
o erro й em cada linha que tem o Navio[numero]


Re: [DUV] Variavel criar objetos - zSuYaNw - 26.08.2010

Nss, jб me irritei!

COPIA E COLA NO SEU GAMEMODE!

http://pastebin.com/yAkS4vmm