Posts: 260
Threads: 28
Joined: Jan 2009
Reputation:
0
Hi all
How can i load player weapons?
If i save the weapons (with dini)
weapons=15:67,36:78,25:88
Then i get example:
weapon id: 15 with 67 bullets
and i get id 35 with 78 bullets
and i get id 25 with 88 bullets
How ?
Posts: 717
Threads: 11
Joined: Jul 2008
Reputation:
0
Well, you'll have to split the string, the easiest way to do that is using sscanf i guess. Take a look at the Useful Functions topic.
Posts: 260
Threads: 28
Joined: Jan 2009
Reputation:
0
But sscanf is for commands
How can i do it?
Posts: 2,593
Threads: 38
Joined: Aug 2007
Reputation:
0
sscanf isn't just for commands, it's for strings with spaces in it =p So it will split a string by the spaces in it and give the exact type of variable oyu're looking for (Float, Integer, Player ID etc)
Posts: 260
Threads: 28
Joined: Jan 2009
Reputation:
0
cool can u give me a example?
with this code: 12 89 13 82
The weapon: 12 bullets: 89
The weapon: 13 bullets: 82
Posts: 2,593
Threads: 38
Joined: Aug 2007
Reputation:
0
new weapon[13];
new ammo[13];
sscanf(string,"iiiiiiiiiiiiiiiiiiiiiiiiii",weapon[0],ammo[0],weapon[1],ammo[1] ...// continue
****** should make it so you could just do 26i or something
Posts: 260
Threads: 28
Joined: Jan 2009
Reputation:
0
No 24
But normal in a command you do: sscnaf(params,"bla",bla) [red]return SendClientMessage......[/red]
But what now?
Posts: 260
Threads: 28
Joined: Jan 2009
Reputation:
0
No i don't mean!!!
Can anybody tell me what i need to add?