SA-MP Forums Archive
Sscanf in Strcmp? - 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: Sscanf in Strcmp? (/showthread.php?tid=411732)



Sscanf in Strcmp? - seanny - 30.01.2013

Is it possible to use strcmp with sscanf?


Re: Sscanf in Strcmp? - denNorske - 30.01.2013

Yes, that is possible, but depending on for what kind of use.


Re: Sscanf in Strcmp? - seanny - 30.01.2013

Well, I know how to use ZCMD + SSCANF, but in my case, there is too many commands to convert.


Re: Sscanf in Strcmp? - u3ber - 30.01.2013

Quote:
Originally Posted by seanny
Посмотреть сообщение
Well, I know how to use ZCMD + SSCANF, but in my case, there is too many commands to convert.
Ok...?


Re: Sscanf in Strcmp? - LarzI - 30.01.2013

So then why do you want to know if you can make commands with sscanf + strcmp if there's too many to convert? Do you want to make new ones? In that case just change OnPlayerCommandText to
pawn Код:
OnPlayerCommandPerformed(playerid, cmdtext[], success)
(or was it OnPlayerCommandRecieved? I don't really remember)


Re: Sscanf in Strcmp? - denNorske - 30.01.2013

Wrong by me in the first post, sorry.


i don't know any possible way.
~regards.


Re: Sscanf in Strcmp? - LarzI - 30.01.2013

Quote:
Originally Posted by airplanesimen
Посмотреть сообщение
No sorry. If you mean the default Command processor, that is not possible.
Well honestly, it's possible. You just have to use the index of the first param as string in sscanf, e.g.
pawn Код:
if( !strcmp( cmdtext, "/cake", true ))
{
    //    /cake is 5 characters long. this means that index 6 is the first letter of the first param
    if( sscanf( cmdtext[ 6 ], "s[4]", "hey" ))
Something like that should be fully possible, as sscanf just splits and extracts parameters into variables.

Still would be more efficient to just use ZCMD though


Re: Sscanf in Strcmp? - u3ber - 30.01.2013

Quote:
Originally Posted by airplanesimen
Посмотреть сообщение
Wrong by me in the first post, sorry.
i don't see anything wrong...

Quote:
Originally Posted by LarzI
// /cake is 5 characters long. this means that index 6 is the first letter of the first param
what?