AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Split 2 simple codes (https://forums.alliedmods.net/showthread.php?t=224546)

Ardonicek 08-25-2013 13:12

Split 2 simple codes
 
Hello, i want you to add this
PHP Code:

{
        if(
cs_get_user_money(id)>10000)
        {
            
bank[id]+= cs_get_user_money(id) - 10000
            cs_set_user_money
(id,10000)
        }
        if(
cs_get_user_money(id)<10000)
        {
            if(
bank[id] < 10000 cs_get_user_money(id))
            {
                
cs_set_user_money(id,cs_get_user_money(id)+bank[id])
                
bank[id]=0
            
}
            else
            {
                
bank[id]-=  10000 cs_get_user_money(id)
                
cs_set_user_money(id,10000)
            }
        }
        
set_hudmessage(025500.70.8706.00.10.10.2next_hudchannel(id) )
        
show_hudmessage(id,"%L",id,"MSG_BANK",bank[id])


To this:

PHP Code:

public ShowHud(id

    new 
szText[555 char
    if(
Level[id] == 200
    { 
         
formatex(szTextsizeof(szText) -1"[%s]^n[Dalsi Level: %s]^n[XP : %i]^n[Kupenie XP = /buyxp]"Prefix[Level[id]], Prefix[Level[id] +1], eXP[id])  
    } 
    else 
    { 
        
formatex(szTextsizeof(szText) -1"Verzia: 1.3.3^n^n[%s]^n[XP : %i / %i]^n[Money: COSKORO] [Kupenie XP = /buyxp]"Prefix[Level[id]], eXP[id], LevelsLevel[id]]) 
    } 
    
set_hudmessage(128185110.010.2002.05.02.0_1)
    
show_hudmessage(idszText)



devilicioux 08-25-2013 13:21

Re: Split 2 simple codes
 
Wrong arguments in both the Show_hudmessage functions..

Ardonicek 08-25-2013 13:28

Re: Split 2 simple codes
 
Edited. Btw. i just need to implement it into hudmsg in second code and make it work.

devilicioux 08-25-2013 13:42

Re: Split 2 simple codes
 
Quote:

Originally Posted by Ardonicek (Post 2021482)
Edited. Btw. i just need to implement it into hudmsg in second code and make it work.

Still Wrong .. U dint pass the String in the first code and u are passing "id" 2 times in the second one ..

Ardonicek 08-25-2013 14:02

Re: Split 2 simple codes
 
Is it okay now?


PHP Code:


public cpt(id)
{
        if(
cs_get_user_money(id)>10000)
        {
            
bank[id]+= cs_get_user_money(id) - 10000
            cs_set_user_money
(id,10000)
        }
        if(
cs_get_user_money(id)<10000)
        {
            if(
bank[id] < 10000 cs_get_user_money(id))
            {
                
cs_set_user_money(id,cs_get_user_money(id)+bank[id])
                
bank[id]=0
            
}
            else
            {
                
bank[id]-=  10000 cs_get_user_money(id)
                
cs_set_user_money(id,10000)
            }
        }
        
set_hudmessage(025500.70.8706.00.10.10.2next_hudchannel(id) )
        
show_hudmessage(id,"%L",id,"MSG_BANK",bank[id])



devilicioux 08-26-2013 04:39

Re: Split 2 simple codes
 
First Code

PHP Code:

show_hudmessage(id,"%L",id,"MSG_BANK",bank[id]) 

:arrow:

PHP Code:

show_hudmessage(id"%L"LANG_PLAYER"MSG_BANK"bank[id]) 



Second Code



PHP Code:

show_hudmessage(idszText



:arrow:


PHP Code:

show_hudmessage(id"%s"szText


YamiKaitou 08-26-2013 10:20

Re: Split 2 simple codes
 
Quote:

Originally Posted by devilicioux (Post 2021860)
First Code

PHP Code:

show_hudmessage(id,"%L",id,"MSG_BANK",bank[id]) 

:arrow:

PHP Code:

show_hudmessage(id"%L"LANG_PLAYER"MSG_BANK"bank[id]) 




Wrong, original is correct


Quote:

Second Code
Quote:



PHP Code:

show_hudmessage(idszText



:arrow:


PHP Code:

show_hudmessage(id"%s"szText


Wrong, original is correct

devilicioux 08-26-2013 12:59

Re: Split 2 simple codes
 
Where am i wrong Yami .. Please explain me how that worked ?

YamiKaitou 08-26-2013 13:05

Re: Split 2 simple codes
 
Quote:

Originally Posted by devilicioux (Post 2022108)
Where am i wrong Yami .. Please explain me how that worked ?

LANG_PLAYER is only supposed to be used if you are sending the message to everyone at one, such as
Code:

show_hudmessage(0, "%L", LANG_PLAYER, "MSG_BANK", bank[id])
If you are only sending to 1 user, use their index



This
Code:

show_hudmessage(id, szText)
works just fine, there is no reason to format it and force additional native calls when it is not needed

devilicioux 08-27-2013 04:33

Re: Split 2 simple codes
 
Okay ty for the great explanation .. :)


All times are GMT -4. The time now is 18:48.

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