Simple thing that I'm getting confused with.
#1

I'm trying to make a menu that will be shows like this
/help [Specific word] ex: /help faction
Then it will show him the faction help menu, a /help, with sections.
It will be much appricate if someone will help me
Reply
#2

What have you got so far?
Reply
#3

Quote:
Originally Posted by StuartD
Посмотреть сообщение
What have you got so far?
Nothing I'm just requesting some help over here, Let me give you an example:
Quote:

. : : Help List : : .

TIP: /help [name]

Names: Account,General,Gov,Faction,Property,Job,Chat,Phon e,Races,Setup,Gold,Dog,Vehicle,Fish

Names: Weddings

Reply
#4

I use strtok, but it's outdated. I suggest you do not use it, use sscanf instead. But if you still want to use it then let me explain, strtok is out dated so you need to define the stock function yourself, you can find it at the https://sampwiki.blast.hk/wiki/Strtok. It is used to find words before a spacing(including the spacing if I'm not wrong) then stores the character number after the spacing in the index variable you created(second argument). Therefore, first you get "/help ", then use strtok again with the index value of the last spacing and you will get the words after "/help "

pawn Код:
new index, cmd[10], data[100];
cmd = strtok(cmdtext, index); //Will return "/help " then save the next character's index in the index variable
data = strtok(cmdtext, index); //Start returning from the defined character index
Take note if the data after /help cannot have spacing or else it will return only the ones before the spacing

I'm not sure what I'm writing is right because that's from what I have been observing. I asked the same question before, people here gave me all kinds of weird codes that made me gave up on using command with data and use dialog instead but then I found strtok. I couldn't find a proper tutorial for sscanf and was confused with it so I didn't want to use it, strtok works fine for me. We both got confused with the same thing, I hope this prevents you from getting the same faith like I did
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)