Need some answers - 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)
+--- Thread: Need some answers (
/showthread.php?tid=352264)
Need some answers -
Faisal_khan - 19.06.2012
Hi SA-MP Community,
I want answers to these questions explain me.(No wiki links please, I read them already).
Q1).:
What is sscanf? Explain its function.
Q2).:
What is strtok, tmp?
Will ask more questions later.
Re: Need some answers -
ReneG - 19.06.2012
sscanf(******'s) splits a string into integers/floats/strings etc... useful with commands like
Код:
/givemoney [playerid] [amount]
strtok checks for a variable after a space. That is why it was used in commands so much. tmp is just a name of the variable after the space that was most commonly used.
Re: Need some answers -
Faisal_khan - 19.06.2012
With sscanf we can split it in many other parts? Is it same like params?
Re: Need some answers -
ReneG - 19.06.2012
params is just the name of the command text ZCMD and YCMD uses.
Re: Need some answers -
Faisal_khan - 19.06.2012
With sscanf we can split it in many other parts?
Re: Need some answers -
ReneG - 19.06.2012
Yes.
Re: Need some answers -
iggy1 - 19.06.2012
Have you tried reading the sscanf thread? You should understand it if so.
Strtok splits strings into tokens like sscanf does but it's slower, less reliable and doesn't have as much functionality as sscanf and you also have to do additional function calls to turn the tokens into the type of data you need (ints, floats, bools).
Re: Need some answers -
Faisal_khan - 19.06.2012
Thank you dude. +3rep to you!