SA-MP Forums Archive
Extract from string to string - 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: Extract from string to string (/showthread.php?tid=592971)



Extract from string to string - Dusan01 - 31.10.2015

Hi guys, how can i extract this string: "veh 522" to a another string and when loop find a (spacebar) to break so i can get in another string like "veh"


Re: Extract from string to string - Abagail - 31.10.2015

It sounds like what you are doing could be done with integers, what are you trying to do?


Re: Extract from string to string - Dusan01 - 31.10.2015

Quote:
Originally Posted by Abagail
Посмотреть сообщение
It sounds like what you are doing could be done with integers, what are you trying to do?
Here is my code:
Код:
new komch[126];
    for(new b = 1; b < 50; b++) {
        printf("Number: %d",b);
    	if(strcmp(cmdtext, " ", true, b)) {
    	    print("debugradi");
    		strmid(komch, cmdtext, 0, b);
		}
    }
im doing this for mysql system for commands permission so i cant check for commad if he type /veh 522 so i ned to extract just /veh


Re: Extract from string to string - ThePhenix - 31.10.2015

Use sscanf.


Re: Extract from string to string - Dusan01 - 31.10.2015

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
Use sscanf.
TNX BRO, REP+