AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Moar scr1pt1ng err0rz (https://forums.alliedmods.net/showthread.php?t=76015)

PvtSmithFSSF 08-16-2008 20:12

Moar scr1pt1ng err0rz
 
1 Attachment(s)
Unfortunately I don't know the deal here..
stinkin errors!!

Would love some assistance..

IneedHelp 08-16-2008 20:20

Re: Moar scr1pt1ng err0rz
 
You have a little scripting errors...

PHP Code:

remove_task("Advertise_Msg"

Should be

PHP Code:

remove_task(id

And the tasks:
PHP Code:

set_task(get_pcvar_float(messagecvar[1]), "Advertise_Msg"

Should be:
PHP Code:

set_task(get_pcvar_float(messagecvar[1]), "Advertise_Msg"id

You put bad the index of set_user_health and cs_set_user_money, I think you copy that:

PHP Code:

set_user_health(indexhealth-80)
cs_set_user_money(indexmoney-price

Should be:
PHP Code:

set_user_health(idhealth-80)
cs_set_user_money(idmoney-price

And the last, you put a . in the last lines of code...
And i get a warning, symbol enablecvar is never used.

PvtSmithFSSF 08-16-2008 20:35

Re: Moar scr1pt1ng err0rz
 
oh yah i didn't mean to put enablecvar there yet
thanks man ill put all that in now

edit - holy crap at the new errors, lines too long after substitutions, wahtever the heck that means

IneedHelp 08-16-2008 20:43

Re: Moar scr1pt1ng err0rz
 
What? This compile fine for me, What are the errors that you receive?

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define PLUGIN "Risky Business"
#define VERSION "1.0"
#define AUTHOR "PvtSmithFSSF"

new messagecvar[2]
new 
pricecvar
new custom[2]
new 
payfornothing

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /gamble""gamble")
    
register_clcmd("say gamble""gamble")
    
register_clcmd("say_team /gamble""gamble")
    
register_clcmd("say_team gamble""gamble")
    
    
messagecvar[0] = register_cvar("gamble_msg""1")
    
messagecvar[1] = register_cvar("gamble_msg_time""120")
    
pricecvar register_cvar("gamble_price""3500")
    
custom[0] = register_cvar("gamble_custom_gain""15")
    
custom[1] = register_cvar("gamble_custom_lose""15")
    
payfornothing register_cvar("gamble_payfornothing""1")
}

public 
client_putinserver(id)
{
    if (
get_pcvar_num(messagecvar[0]) == 1)
        
set_task(get_pcvar_float(messagecvar[1]), "Advertise_Msg"id
}

public 
Advertise_Msg(id)
{
    if (
get_pcvar_num(messagecvar[0]) == 1)
    {
        
client_print(idprint_chat"[Gambler] Type 'gamble' to gamble your health. This is risky business!")
    }
    
set_task(get_pcvar_float(messagecvar[1]), "Advertise_Msg"id
    return 
PLUGIN_CONTINUE
}

public 
client_disconnect(id)
{
    
remove_task(id)  
}

public 
gamble(id)
{
    new 
num random_num(1,100)
    new 
money cs_get_user_money(id)
    new 
health get_user_health(id)
    new 
price get_pcvar_num(pricecvar)
    new 
customgain get_pcvar_num(custom[0])
    new 
customlose get_pcvar_num(custom[1])
    
    if (
money price)
    {
        
client_print(idprint_chat"[Gambler] You don't have enough cash!")
    }
    
    else
    {
        if(
num <= 10)
        {
            
client_print(idprint_chat"[Gambler] Sorry, you lost 100 health!")
            
set_user_health(idhealth-100)
            
cs_set_user_money(id,money-price)
        }
    
        else if(
num <= 20)
        {
            
client_print(idprint_chat"[Gambler] Sorry, you lost 80 health!")
            
set_user_health(idhealth-80)
            
cs_set_user_money(idmoney-price)
        }
        
        else if(
num <= 30)
        {
            
client_print(idprint_chat"[Gambler] Sorry, you lost 50 health!")
            
set_user_health(idhealth-50)
            
cs_set_user_money(idmoney-price)
        }
        
        else if(
num <= 40)
        {
            
client_print(idprint_chat"[Gambler] Sorry, you lost %i health!",customlose)
            
set_user_health(id,health-customlose)
            
cs_set_user_money(id,money-price)
        }
        
        else if(
num <= 50)
        {
            
client_print(idprint_chat"[Gambler] Nothing happened, sorry!")
            if (
get_pcvar_num(payfornothing) == 1)
            {
                
cs_set_user_money(idmoney-price)
            }
            else
            {
                
client_print(idprint_chat"[Gambler] It's okay, you won't be charged!")
            }
        }
        
        else if(
num <= 60)
        {
            
client_print(idprint_chat"[Gambler] Congratulations! You've won 30 health! ")
            
set_user_health(id,health+30)
            
cs_set_user_money(idmoney-price)
        }
        
        else if(
num <= 70)
        {
            
client_print(idprint_chat"[Gambler] Congratulations! You've won 50 health! ")
            
set_user_health(id,health+50)
            
cs_set_user_money(idmoney-price)
        }
        
        else if(
num <= 80)
        {
            
client_print(idprint_chat"[Gambler] Congratulations! You've won 80 health! ")
            
set_user_health(id,health+80)
            
cs_set_user_money(idmoney-price)
        }
        
        else if(
num <= 90)
        {
            
client_print(idprint_chat"[Gambler] Congratulations! You've won 100 health! ")
            
set_user_health(id,health+100)
            
cs_set_user_money(idmoney-price)
        }
        
        else if(
num <= 100)
        {
            
client_print(idprint_chat"[Gambler] Congratulation! You've won %i health!",customgain)
            
set_user_health(id,health+customgain)
            
cs_set_user_money(idmoney-price)
        }
   
    }    



PvtSmithFSSF 08-16-2008 20:58

Re: Moar scr1pt1ng err0rz
 
aaaandd now it works, idk why :)
thanks for your help btw dude.
ps: i saw ur signature. i have a suggestion.
a gun menu mod where we can save 'packs' so we just type in the name of our pack and we get it.
for example i type in gunmenu_blahblah in chat and the pack 'blahblah' is created after i choose the weapons for it (they should come up when you type gunmenu_blahblah in chat). then no matter if u leave or not or anything you still can always access that pack unless you type in gunmenu_blahblah again and if it exists you can choose like 'replace pack' or 'use pack'
:)


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

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