Using char on variables.
#2

I don't know much myself, but I'll tell what I know (or guess)
char calculates number of cells required to hold this much chars of packed string. Untaged values are 1 cell wide. 5 char equals 2, and you are trying to hold 5 cells in 2 cells - ain't gonna work. If you change 5 char in your current code to 20 char - it will work just fine, becuase it will equal 5 cells.

pawn Код:
new Detail[5 char] = !"Hello";
This will work, because now we have packed hello string inside this char-array. Anyway: char has 8 bits of length, so it can hold values from 0 to 255 (no negative vaules) - in your case the 500 is too big for single byte, and it would fail anyway.

I don't know if there is conversion from untagged value to char, but I you can assign values like this:

pawn Код:
new Detail[ 5 char ];
Detail{0} = 255;
Detail{1} = 1;
Detail{2} = 100;
Detail{3} = 40;
Detail{4} = 50;
GivePlayerMoney(playerid, Detail{0});
Related thingies:
https://sampforum.blast.hk/showthread.php?tid=216730
There is char operator section in pawn_language_guide.pdf
https://sampwiki.blast.hk/wiki/Keywords:Operators#char - ain't too helpful
Reply


Messages In This Thread
Using 'char' array on variables. - by Activest - 03.03.2013, 19:32
Re: Using char on variables. - by Misiur - 03.03.2013, 20:02
Re: Using char on variables. - by Vince - 03.03.2013, 20:02
Re: Using char on variables. - by ReVo_ - 03.03.2013, 20:03
Re: Using char on variables. - by AndreT - 03.03.2013, 20:05
Re: Using char on variables. - by Activest - 03.03.2013, 20:27
Re: Using char on variables. - by LarzI - 03.03.2013, 20:36
Re: Using char on variables. - by Vince - 03.03.2013, 20:36
Re: Using char on variables. - by LarzI - 03.03.2013, 20:44
Re: Using char on variables. - by Activest - 03.03.2013, 20:57

Forum Jump:


Users browsing this thread: 1 Guest(s)