SA-MP Forums Archive
How ??? - 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: How ??? (/showthread.php?tid=65595)



How ??? - harrold - 14.02.2009

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 ?


Re: How ??? - Extremo - 14.02.2009

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.


Re: How ??? - harrold - 14.02.2009

But sscanf is for commands
How can i do it?


Re: How ??? - harrold - 14.02.2009

Any??
How ?
With a split function? HOW?


Re: How ??? - Joe Staff - 14.02.2009

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)


Re: How ??? - harrold - 14.02.2009

cool can u give me a example?
with this code: 12 89 13 82
The weapon: 12 bullets: 89
The weapon: 13 bullets: 82


Re: How ??? - Joe Staff - 14.02.2009

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


Re: How ??? - harrold - 14.02.2009

No 24
But normal in a command you do: sscnaf(params,"bla",bla) [red]return SendClientMessage......[/red]
But what now?



Re: How ??? - hoodline - 14.02.2009

https://sampwiki.blast.hk/wiki/Fast_Commands#sscanf


Re: How ??? - harrold - 14.02.2009

No i don't mean!!!
Can anybody tell me what i need to add?