Carregar Varios objetos com LooP -
Marlon307 - 20.08.2014
Estou terminando uma include e preciso de ajuda para conseguir a carregar todas as "SLOT" com uma LOOP
ou em vez de ficar fazendo varias verificaзхes para carregar cada slot esse e o codigo que estou querendo mudar para carregar com um loop, jб tentei de varias forma mais nгo consegui.
pawn Код:
if(DOF2::GetInt(file, "Index") == 0)
{
new index = DOF2::GetInt(file,"0Index"),
modelid = DOF2::GetInt(file,"0Modelo"),
boneid = DOF2::GetInt(file,"0Boneid"),
Float:fOffsetX = DOF2::GetFloat(file,"0pX"),
Float:fOffsetY = DOF2::GetFloat(file,"0pY"),
Float:fOffsetZ = DOF2::GetFloat(file,"0pZ"),
Float:fRotX = DOF2::GetFloat(file,"0rX"),
Float:fRotY = DOF2::GetFloat(file,"0rY"),
Float:fRotZ = DOF2::GetFloat(file,"0rZ"),
Float:fScaleX = DOF2::GetFloat(file,"0eX"),
Float:fScaleY = DOF2::GetFloat(file,"0eY"),
Float:fScaleZ = DOF2::GetFloat(file,"0eZ");
SetPlayerAttachedObject(playerid,index,modelid,boneid,fOffsetX,fOffsetY,fOffsetZ,fRotX,fRotY,fRotZ,fScaleX,fScaleY,fScaleZ);
}
Re: Carregar Varios objetos com LooP -
Dolby - 20.08.2014
Quote:
Originally Posted by Dolby
pawn Код:
for(new i; i < 10; i++) { new strText[15]; format(strText, 15, "%dIndex", i); DOF2::SetInt(file, strText, 1); }
E assim sucessivamente.
|
Basta ir formatando cada linha.
pawn Код:
new str[50];
format(str, 50, "%dIndex", DOF2::GetInt(file, "Index"));
new index = DOF2::GetInt(file,str),
Re: Carregar Varios objetos com LooP -
Marlon307 - 20.08.2014
Quote:
Originally Posted by Dolby
Basta ir formatando cada linha.
pawn Код:
new str[50]; format(str, 50, "%dIndex", DOF2::GetInt(file, "Index")); new index = DOF2::GetInt(file,str),
|
vlw moзo vc esta me ajudando muito obrigado
Re: Carregar Varios objetos com LooP -
Marlon307 - 21.08.2014
Quote:
Originally Posted by Dolby
Basta ir formatando cada linha.
pawn Код:
new str[50]; format(str, 50, "%dIndex", DOF2::GetInt(file, "Index")); new index = DOF2::GetInt(file,str),
|
So mais uma duvida porque quando coloco "%f" no lugar de "%d" nгo funciona
funciona %d
pawn Код:
for(new i; i != 10; ++i)
{
format(strText, 15, "%dpY", i);
new Float:fOffsetY = DOF2::GetInt(file, strText);
}
%f nгo funciona
pawn Код:
for(new i; i != 10; ++i)
{
format(strText, 15, "%fpY", i);
new Float:fOffsetY = DOF2::GetInt(file, strText);
}
mais por o "%d" funcionar o objeto fica com a posiзгo errada tem que ser o "%f" que e Float
Re: Carregar Varios objetos com LooP -
Schocc - 21.08.2014
Tem que usar
DOF2::GetFloat
Re: Carregar Varios objetos com LooP -
Dolby - 21.08.2014
Nesse caso,
i й um inteiro.
Mas talvez nгo seja necessбrio o loop, vocк deve passar a variбvel
index como parвmetro no format.
pawn Код:
new str[50];
format(str, 50, "%dIndex", DOF2::GetInt(file, "Index"));
new index = DOF2::GetInt(file,str),
Re: Carregar Varios objetos com LooP -
zSuYaNw - 21.08.2014
pawn Код:
Specifier Meaning
%i Integer (whole number)
%d Integer (whole number).
%s String
%f Floating-point number (Float: tag)
%c ASCII character
%x Hexadecimal number
%b Binary number
%% Literal '%'
https://sampwiki.blast.hk/wiki/Format
'-'