new fload: etc.. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: new fload: etc.. (
/showthread.php?tid=111241)
new fload: etc.. -
Naruto4 - 30.11.2009
Код:
public SetPlayerSkinRandom
{
new rand = random(sizeof(gSkins));
SetPlayerSkin(playerid, gSkins[rand][0]);
}
Код:
new Float:gSkins[12][0] = {
{280},
{281},
{282},
{283},
{284},
{285},
{286},
{287},
{288},
{289},
{290},
{105}
};
is this ok to do ?
my pawn crashes after this
Re: new fload: etc.. -
dice7 - 30.11.2009
pawn Код:
public SetPlayerSkinRandom() //there were no (). That was causing the crash
{
new rand = random(sizeof(gSkins));
SetPlayerSkin(playerid, gSkins[rand]);
}
pawn Код:
new Float:gSkins[12] = { 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 105};
Re: new fload: etc.. - Zeex - 30.11.2009
What do you write that
for? Why not
?
It isn't needed. Also, the compiler does know how many elemnts in array if you initialize it when you declare it and wrong number may cause errors on compiling. So just do
pawn Код:
new gSkins[] = { 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 105};
And are you sure you need FLoat: ? I'm asking this because those numbers are integer...
Re: new fload: etc.. -
Naruto4 - 02.12.2009
solved it thx