Problem "~"
#1

I have /cnn and /cnnn I added

PHP код:
if(strfind(string"~"true) != -1)
                        {
                            return 
SendClientMessage(playeridCOLOR_RED"Can't use in /cnn or /cnnn '~' ");
                        } 
and still doesn't work, I don't want "~" in my /cnn or /cnnn !!
Reply
#2

This function check caracter by caracter:
PHP код:
for(new istring[i]; ++i){
     if(
string[i] == '~'){
         break;
     }
}

if(
string[i] != EOS){
     return 
SendClientMessage(playeridCOLOR_RED"Can't use in /cnn or /cnnn '~' ");

you can test it?
Reply
#3

I put those in my cmds??
Reply
#4

Quote:
Originally Posted by Ugaustin
Посмотреть сообщение
I put those in my cmds??
Yeees!

u can post the full cmd?
Reply
#5

but only ~ without ' ' yes?
Reply
#6

Quote:
Originally Posted by Ugaustin
Посмотреть сообщение
but only ~ without ' ' yes?
Yes. The apostrophes are there to hold the ~ symbol inside the check function. Otherwise, script will give error. If you don't know, how to use this with your command, post your command script as said above.

Edit: The code posted above doesn't seem to work.

This one should work.
PHP код:
for (new istrlen(string); != ji++)
{
    if (
string[i] == '~')
    {
        return 
SendClientMessage(playerid, -1"Can't use in /cnn or /cnnn '~' ");
    }

Ofc, you will have to replace the string with the one you're checking the symbol in.
Reply
#7

Quote:
Originally Posted by zSuYaNw
Посмотреть сообщение
This function check caracter by caracter:
PHP код:
for(new istring[i]; ++i){
     if(
string[i] == '~'){
         break;
     }
}
if(
string[i] != EOS){
     return 
SendClientMessage(playeridCOLOR_RED"Can't use in /cnn or /cnnn '~' ");

you can test it?
This is what strfind is going to do.

I guess there is problem related to your string.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)