AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help] How can i do this? (https://forums.alliedmods.net/showthread.php?t=159502)

2reason2kill 06-18-2011 05:30

[help] How can i do this?
 
Im trying to do if the player dosent have Enough money Its print somting

like

PHP Code:

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

new Cost

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd("say /Reviveme","revive")
    
Cost register_cvar("revive_cost","16000")
}

public 
revive(id)
{
    
    if(!
is_user_alive(id) )
    {
        new 
money cs_get_user_money(id)
        new 
cost get_pcvar_num(Cost);
        (
money >= cost)
        
cs_user_spawn(id)
        
cs_set_user_money(idmoney -cost)
    }
    else
    {
        
client_print(idprint_chat,"You havent Enough money To buy this item")
    } 

Is it Right?

drekes 06-18-2011 07:40

Re: [help] How can i do this?
 
PHP Code:

    if(!is_user_alive(id))
    {
        new 
money cs_get_user_money(id)
        new 
cost get_pcvar_num(Cost);
        if(
money >= cost)
        {
            
// cs_user_spawn(id)
            
ExecuteHamB(Ham_CS_RoundRespawnid);
            
cs_set_user_money(idmoney -cost)
        }
    
        else
        {
            
client_print(idprint_chat,"You havent Enough money To buy this item")
        } 
    } 

To spawn a player, you can use 3 good ways afaik.

PHP Code:

// 1
ExecuteHamB(Ham_CS_RoundRespawnid);

// 2
ExecuteHamB(Ham_Spawnid);

// 3
set_pev(idpev_deadflagsDEAD_RESPAWNABLE);
dllfunc(DLLFunc_Thinkid

</span></span>

2reason2kill 06-18-2011 12:12

Re: [help] How can i do this?
 
Quote:

Originally Posted by drekes (Post 1490662)
PHP Code:

    if(!is_user_alive(id))
    {
        new 
money cs_get_user_money(id)
        new 
cost get_pcvar_num(Cost);
        if(
money >= cost)
        {
            
// cs_user_spawn(id)
            
ExecuteHamB(Ham_CS_RoundRespawnid);
            
cs_set_user_money(idmoney -cost)
        }
    
        else
        {
            
client_print(idprint_chat,"You havent Enough money To buy this item")
        } 
    } 

To spawn a player, you can use 3 good ways afaik.

PHP Code:

// 1
ExecuteHamB(Ham_CS_RoundRespawnid);

// 2
ExecuteHamB(Ham_Spawnid);

// 3
set_pev(idpev_deadflagsDEATH_RESPAWNABLE);
dllfunc(DLLFunc_Thinkid

</span></span>

Tnx

nikhilgupta345 06-18-2011 12:38

Re: [help] How can i do this?
 
DEATH_RESPAWNABLE -> DEAD_RESPAWNABLE

drekes 06-18-2011 13:48

Re: [help] How can i do this?
 
Quote:

Originally Posted by nikhilgupta345 (Post 1490826)
DEATH_RESPAWNABLE -> DEAD_RESPAWNABLE

Nice catch, fixed


All times are GMT -4. The time now is 23:27.

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