Getting strings of a table
#1

Alright .. this is how my table looks like, and a row just to test shit.


pawn Код:
new ID = 0, Float:Spawn_X, Float: Spawn_Y, Float: Spawn_Z, Fee, Till, Owner[24], Name[128];
        sscanf( line , "p|ifffiiss" , ID, Spawn_X, Spawn_Y, Spawn_Z, Fee, Till, Owner, Name);
        printf("[BIZ] %s (ID: %i | Owner: %s) set up!", Name, ID, Owner);
The string "Name" is empty, while "Owner" contains "Noone LV Rent-a-Car"

Anyone a clue on how to prevent that? Pretty annoying
Reply
#2

Try something like this
pawn Код:
new string[128];
sscanf( line , "p|ifffiiz" , ID, Spawn_X, Spawn_Y, Spawn_Z, Fee, Till, string);
sscanf( string, "p|sz", Owner, Name);
or

pawn Код:
sscanf( line , "ifffiisz" , ID, Spawn_X, Spawn_Y, Spawn_Z, Fee, Till, Owner, Name);
Reply
#3

Try strmid.
Reply
#4

@dice7: Nope, p| is required since it splits everything with a "|" (needed with mysql rows)
"z" is an optionable string, didn't work either, same outcome with the 2 methodes ..

@MenaceX^: If you got any example, sure, like never used strmid and the wiki doesn't really help. I guess I'd have to totally re-write it then with all that strval strfloat and shit, which I really hate and just bugs for me, lol.

EDIT: I tried using explode and split, both just comes up with empty values, (strings empty, values are 0)

http://pastebin.com/d19e23ea
Reply
#5

Fixed, i didn't need to split it using p| , works now. :3

/lock
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)