Sscanf in Strcmp?
#1

Is it possible to use strcmp with sscanf?
Reply
#2

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

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

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...?
Reply
#5

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)
Reply
#6

Wrong by me in the first post, sorry.


i don't know any possible way.
~regards.
Reply
#7

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
Reply
#8

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)