Raised This Month: $ Target: $400
 0% 

is here somethinge wrong ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
risontek22
Member
Join Date: Mar 2013
Location: localhost
Old 04-30-2013 , 11:35   is here somethinge wrong ?
Reply With Quote #1

hi, a would like ask you what is here wrong?

PHP Code:
public Body_Vloz(id)
{
    new 
Sprava[256]
    
read_argv(idSpravacharsmax(Sprava))
    if(!(
equali(Sprava,"ALL")) || !(equali(Sprava,"all")))
    {
    
        if((
containi(Sprava"q") != -1) || 
        (
containi(Sprava"w") != -1) || 
        (
containi(Sprava"e") != -1) || 
        (
containi(Sprava"r") != -1) || 
        (
containi(Sprava"t") != -1) || 
        (
containi(Sprava"z") != -1) || 
        (
containi(Sprava"u") != -1) || 
        (
containi(Sprava"i") != -1) || 
        (
containi(Sprava"o") != -1) || 
        (
containi(Sprava"p") != -1) || 
        (
containi(Sprava"a") != -1) || 
        (
containi(Sprava"s") != -1) || 
        (
containi(Sprava"d") != -1) || 
        (
containi(Sprava"f") != -1) || 
        (
containi(Sprava"g") != -1) || 
        (
containi(Sprava"h") != -1) || 
        (
containi(Sprava"i") != -1) || 
        (
containi(Sprava"k") != -1) || 
        (
containi(Sprava"l") != -1) || 
        (
containi(Sprava"m") != -1) || 
        (
containi(Sprava"n") != -1) || 
        (
containi(Sprava"b") != -1) || 
        (
containi(Sprava"v") != -1) || 
        (
containi(Sprava"c") != -1) ||
        (
containi(Sprava"y") != -1) || 
        (
containi(Sprava"x") != -1))
        {
            
ChatColor(id,"%s Do kolonky napis len !tcislo!y alebo slovo !tall",Prefix)
            return 
PLUGIN_HANDLED
        
}
    }
    if(
equali(Sprava,"ALL") || equali(Sprava,"all"))
    {
        
UserBank[id] += UserMoney[id]
        
ChatColor(id,"%s Uspesne si si do banky vlozil %i$",Prefix,UserMoney[id])
        
UserMoney[id] = 0
    
    
}
    else
    {
        new 
Vklad 
        Vklad 
Sprava[charsmax(Sprava)]
        if(
Vklad >= UserMoney[id])
        {
            
UserBank[id] += Vklad
            UserMoney
[id] -= Vklad
            ChatColor
(id,"%s Uspesne si si do banky vlozil %i$",Prefix,Vklad)
        }
        else
        {
            
Vklad -= UserMoney[id]
            
ChatColor(id,"%s Nemas tolko penazi, chyba ti %i$",Prefix,Vklad)
        }
    }
    return 
PLUGIN_HANDLED

risontek22 is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-30-2013 , 11:51   Re: is here somethinge wrong ?
Reply With Quote #2

Code:
        if((containi(Sprava, "q") != -1) ||           (containi(Sprava, "w") != -1) ||           (containi(Sprava, "e") != -1) ||           (containi(Sprava, "r") != -1) ||           (containi(Sprava, "t") != -1) ||           (containi(Sprava, "z") != -1) ||           (containi(Sprava, "u") != -1) ||           (containi(Sprava, "i") != -1) ||           (containi(Sprava, "o") != -1) ||           (containi(Sprava, "p") != -1) ||           (containi(Sprava, "a") != -1) ||           (containi(Sprava, "s") != -1) ||           (containi(Sprava, "d") != -1) ||           (containi(Sprava, "f") != -1) ||           (containi(Sprava, "g") != -1) ||           (containi(Sprava, "h") != -1) ||           (containi(Sprava, "i") != -1) ||           (containi(Sprava, "k") != -1) ||           (containi(Sprava, "l") != -1) ||           (containi(Sprava, "m") != -1) ||           (containi(Sprava, "n") != -1) ||           (containi(Sprava, "b") != -1) ||           (containi(Sprava, "v") != -1) ||           (containi(Sprava, "c") != -1) ||         (containi(Sprava, "y") != -1) ||           (containi(Sprava, "x") != -1))

Really? Why not just check if the amount is numeric?

Code:
if(equali(Sprava,"ALL") || equali(Sprava,"all"))

This + the else will never be called because you're preventing the rest of the code from executing by doing what you did above.
Backstabnoob is offline
risontek22
Member
Join Date: Mar 2013
Location: localhost
Old 04-30-2013 , 12:54   Re: is here somethinge wrong ?
Reply With Quote #3

how can i chect it ?
and it is called becouse in start before containi... is
PHP Code:
if(!(equali(Sprava,"ALL")) || !(equali(Sprava,"all"))) 
risontek22 is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-30-2013 , 14:34   Re: is here somethinge wrong ?
Reply With Quote #4

I don't get it
Backstabnoob is offline
daniel46
Senior Member
Join Date: Dec 2011
Old 04-30-2013 , 14:45   Re: is here somethinge wrong ?
Reply With Quote #5

make const of all your letter or whatever and then make FOR for all of the const DONE
daniel46 is offline
risontek22
Member
Join Date: Mar 2013
Location: localhost
Old 04-30-2013 , 15:39   Re: is here somethinge wrong ?
Reply With Quote #6

But how can i do this, for example. If(sprava >= usermonez) ? This dpnt work
risontek22 is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 04-30-2013 , 15:59   Re: is here somethinge wrong ?
Reply With Quote #7

Go read some tutorials on pawn basics before attempting to code, there's plenty on these forums.
Backstabnoob is offline
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-01-2013 , 04:44   Re: is here somethinge wrong ?
Reply With Quote #8

Explain what you actually want to achieve.
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
risontek22
Member
Join Date: Mar 2013
Location: localhost
Old 05-01-2013 , 05:25   Re: is here somethinge wrong ?
Reply With Quote #9

Bank this is function called on messagemod Body_Vloz
risontek22 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-01-2013 , 06:14   Re: is here somethinge wrong ?
Reply With Quote #10

It is not possibl to understand what you are trying to do.
Anyway, there is useless stuff in your code.

PHP Code:

public Body_Vloz(id)
{
    new 
Sprava[256], len
    
// read_argv(id, Sprava, charsmax(Sprava))
    // if it is about chat, better to use read_args
    
len read_args(Spravacharsmax(Sprava))
    
remove_quotes(Sprava)

    if(    !(
equali(Sprava,"ALL")) ) // equali ignores the case
    
{
        for(--
lenlen>=0len--)
        {
            if( 
isalpha(Sprava[len] )
            {
                
ChatColor(id,"%s Do kolonky napis len !tcislo!y alebo slovo !tall",Prefix)
                return 
PLUGIN_HANDLED // if you don't want to return, just use break
            
}
        }
    }

    
// if(equali(Sprava,"ALL") || equali(Sprava,"all"))
    
else // if previous condition has not been passed, here we are, Sprava is ALL or all or All or aLL etc...
    
{
        
UserBank[id] += UserMoney[id]
        
ChatColor(id,"%s Uspesne si si do banky vlozil %i$",Prefix,UserMoney[id])
        
UserMoney[id] = 0
    
}
    
    
// so this won't be called
    // else
    // {
        // new Vklad 
        // Vklad = Sprava[charsmax(Sprava)]
        // if(Vklad >= UserMoney[id])
        // {
            // UserBank[id] += Vklad
            // UserMoney[id] -= Vklad
            // ChatColor(id,"%s Uspesne si si do banky vlozil %i$",Prefix,Vklad)
        // }
        // else
        // {
            // Vklad -= UserMoney[id]
            // ChatColor(id,"%s Nemas tolko penazi, chyba ti %i$",Prefix,Vklad)
        // }
    // }
    
return PLUGIN_HANDLED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:54.


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