Checking for spaces in OnPlayerText
#9

Off-topic, but why on earth would you want to do that..? So if they're at 'Come a Lot' it's going to say 'I'm at Come'. What possible justification is there for wanting that..?

Also, to do this is quite simple:

pawn Код:
new originalString[] = "Hello World";
new finalString[32];
   
new pos = strfind(originalString, " ");

if(pos)
{
    strmid(finalString, originalString, 0, pos);
}
else
{
    strcat(finalString, originalString);
}

printf("Original String: '%s'\nFinal String: '%s'", originalString, finalString);

// Output:
// Original String: 'Hello World'
// Final String: 'Hello'
Reply


Messages In This Thread
Checking for spaces in OnPlayerText - by Luis- - 06.05.2015, 13:50
Re: Checking for spaces in OnPlayerText - by Konstantinos - 06.05.2015, 13:58
Re: Checking for spaces in OnPlayerText - by Luis- - 06.05.2015, 14:01
Re: Checking for spaces in OnPlayerText - by Konstantinos - 06.05.2015, 14:05
Re: Checking for spaces in OnPlayerText - by Luis- - 06.05.2015, 14:07
Re: Checking for spaces in OnPlayerText - by Ahmad45123 - 06.05.2015, 14:08
Re: Checking for spaces in OnPlayerText - by Konstantinos - 06.05.2015, 14:15
Re: Checking for spaces in OnPlayerText - by Luis- - 06.05.2015, 14:16
Re: Checking for spaces in OnPlayerText - by MP2 - 06.05.2015, 14:20
Re: Checking for spaces in OnPlayerText - by Luis- - 06.05.2015, 14:24

Forum Jump:


Users browsing this thread: 2 Guest(s)