about sscanf "enum" or "array"
#3

Quote:
Originally Posted by M4D
Посмотреть сообщение
i've explained with comments

pawn Код:
//>Define a new variable that store "States" Field info into it
new pState[56];
//>Store data into "pState" Variable
cache_get_field_content(0, "States", pState,/*connectionHandle*/, sizeof(pState));
//>Your Enum :D
enum pStateInfo {
    Float:health,
    Float:armour,
    Float:position[3],
    interior,
    world
}
new pCurrentState[pStateInfo];
//now Separate Data from pState Variable into Enum Variables
sscanf(pState, "fP<,>fP<,>fP<,>fP<,>fP<,>iP<,>i", pCurrentState[health], pCurrentState[armour], pCurrentState[position[0]], pCurrentState[position[1]], pCurrentState[position[2]], pCurrentState[interior], pCurrentState[world]);
//now you finished...stored "States" field information into enum variables...
NOTE: Your information into "States" Field MUST be like this: 100.0,100.0,0.0,0.0,0.0,0,0

i mean DON't put "Space" between floats and ,
for example don't save them like this: 100.0, 100.0, 0.0, 0.0,................

if you want to save them like this you have to put a space after , between < and > in the sscanf function...
Yours is a very newbie version.
This method isn't used Enum.
Just like create a lot of "new".

But Thank you for reply.


+Rep
Reply


Messages In This Thread
about sscanf "enum" or "array" - by iLuXing - 23.12.2014, 08:40
Re: about sscanf "enum" or "array" - by M4D - 23.12.2014, 09:07
Re: about sscanf "enum" or "array" - by iLuXing - 23.12.2014, 09:23
Re: about sscanf "enum" or "array" - by M4D - 23.12.2014, 09:57
Re: about sscanf "enum" or "array" - by Vince - 23.12.2014, 10:34
Re: about sscanf "enum" or "array" - by iLuXing - 25.12.2014, 12:45

Forum Jump:


Users browsing this thread: 2 Guest(s)