SA-MP Forums Archive
hmmm.. how to put a float in a variable? - 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: hmmm.. how to put a float in a variable? (/showthread.php?tid=65676)



hmmm.. how to put a float in a variable? - rensfromrpas - 15.02.2009

hi i'm busy with my house system :P
but i am creating a command that could place a house cut in need to put a float
in a variable but it won't work here are some parts:
the errors
Код:
C:\DOCUME~1\*****\BUREAU~1\Server\GAMEMO~1\***.pwn(151) : warning 213: tag mismatch
C:\DOCUME~1\*****\BUREAU~1\Server\GAMEMO~1\***.pwn(152) : warning 213: tag mismatch
C:\DOCUME~1\*****\BUREAU~1\Server\GAMEMO~1\***.pwn(153) : warning 213: tag mismatch
C:\DOCUME~1\*****\BUREAU~1\Server\GAMEMO~1\***.pwn(154) : warning 213: tag mismatch
C:\DOCUME~1\*****\BUREAU~1\Server\GAMEMO~1\***.pwn(155) : warning 213: tag mismatch
C:\DOCUME~1\*****\BUREAU~1\Server\GAMEMO~1\***.pwn(156) : warning 213: tag mismatch
lines 151, 152, 153...
Код:
HouseInfo[id][hEntX] = x
HouseInfo[id][hEntY] = y
HouseInfo[id][hEntZ] = z
HouseInfo[id][hExtX] = 1272.9116
HouseInfo[id][hExtY] = -768.9028
HouseInfo[id][hExtZ] = 1090.5097
id variavble
Код:
new id = housecount+1;
the Coordinates x,y,z defines
Код:
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x,y,z);
i tried things like : floatstr but i didn't work


Re: hmmm.. how to put a float in a variable? - Marcel - 15.02.2009

Try adding a
pawn Код:
;
after the lines


Re: hmmm.. how to put a float in a variable? - [RP]Rav - 15.02.2009

you made the error in your enum

Код:
enum YourHouseEnum
{
  [...]

  Float: hEntX,
  Float: hEntY,
  Float: hEntZ,
  Float: hExtX,
  Float: hExtY,
  Float: hExtZ,

  [...]
}



Re: hmmm.. how to put a float in a variable? - rensfromrpas - 15.02.2009

oh yeah thanks rav!


Re: hmmm.. how to put a float in a variable? - Donny_k - 15.02.2009

Why an enum if they are all floats ?

Doing this:

pawn Код:
enum eHouse
{
  Float:x,
  Float:y,
  Float:z
}

new
  gHouse[ eHouse ];
Is stupid when you can just use:

pawn Код:
new
  Float:gHouse[ 3 ];



Re: hmmm.. how to put a float in a variable? - [RP]Rav - 15.02.2009

because an enum leaves easy room for expansion, maybe he wants a car that goes with the house, you'll need to define an interior ID, or maybe guns that are stored..


Re: hmmm.. how to put a float in a variable? - Donny_k - 15.02.2009

Quote:
Originally Posted by Rav
because an enum leaves easy room for expansion, maybe he wants a car that goes with the house, you'll need to define an interior ID, or maybe guns that are stored..
I'm not talking about that, I'm talking about why waste code time and effort.



Re: hmmm.. how to put a float in a variable? - rensfromrpas - 15.02.2009

it aren't all floats

take a look at the orignal :S

Код:
enum hInfo
{
	hOwner[16],
	hCost,
	hSale,
	hDesc[256],
	Float:hEntX,
	Float:hEntY,
	Float:hEntZ,
	Float:hExtX,
	Float:hExtY,
	Float:hExtZ,
	hInt,
	hID
};

new HouseInfo[2000][hInfo];



Re: hmmm.. how to put a float in a variable? - [RP]Rav - 15.02.2009

small tip: if you're making that much houses (2000?) you'll need to use virtual worlds


Re: hmmm.. how to put a float in a variable? - Donny_k - 15.02.2009

Well excuse me all over the place

No but do you see my point dude, sometimes people over complicate things for no reason. Like in the example I showed, there is no point in using an enum when a standard array will do. Some people would use the enum just to make it look like they are more advanced when really there is no need to use the enum.