AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Is this work? (https://forums.alliedmods.net/showthread.php?t=196895)

Artifact 09-26-2012 13:41

Is this work?
 
Eg question is: How long you play on this server
Answer must to be with 1 character..
PHP Code:

    if(!key[1])
    {
        
client_print(idprint_chat"You cant type more then 1 caracter")
        return 
PLUGIN_HANDLED
    


is this work?

micapat 09-26-2012 13:51

Re: Is this work?
 
Try.

Backstabnoob 09-26-2012 14:22

Re: Is this work?
 
if( !key[ 0 ] || key[ 1 ] )

micapat 09-26-2012 14:26

Re: Is this work?
 
Without to know how the string is formatted it's useless to suggest some codes.

ConnorMcLeod 09-26-2012 14:32

Re: Is this work?
 
How do you retrieve key ?

.Dare Devil. 09-26-2012 14:52

Re: Is this work?
 
i think if you dont want that [1] contains something then
if(key[1]) // if there are some value then function works

claudiuhks 09-26-2012 15:07

Re: Is this work?
 
PHP Code:

new char32 ];
if( 
strlenchar ) > ) {
  
// two or more characters reached
}

else {
  
// string is empty or contains one character
}

/* For numeric */
new iResult str_to_numchar );

if( 
iResult == ) {
  
// char is "2", iResult is 2 and char[ 0 ] is also 2



Artifact 09-26-2012 15:09

Re: Is this work?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1807016)
How do you retrieve key ?

by read_argv

ConnorMcLeod 09-26-2012 16:27

Re: Is this work?
 
if( read_argv( ... ) == 1 )

But if you hook say or say_team commands you should use read_args + remove_quotes, then #3 seems the best way.

fysiks 09-26-2012 19:50

Re: Is this work?
 
Quote:

Originally Posted by Artifact (Post 1806985)
Eg question is: How long you play on this server
Answer must to be with 1 character..
PHP Code:

    if(!key[1])
    {
        
client_print(idprint_chat"You cant type more then 1 caracter")
        return 
PLUGIN_HANDLED
    


is this work?

What does that question have to do with the code you posted?


All times are GMT -4. The time now is 08:14.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.