AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Help me (https://forums.alliedmods.net/showthread.php?t=194234)

Choose_Your_Destiny 08-26-2012 12:58

[HELP] Help me
 
I have dr sw.I want to use this plugin on my server.

the plugin questions correct answer gives the issuer awards.

They are: Health,Armor,Money and Awp gun.The plugin i would like to add to it at drpoint(Deathrun Shop)

EDIT:

With cvar the value can be changed.(ex: "sm_drpoint","5")

PHP Code:

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

#define PLUGIN "The Smartest" 
#define VERSION "1.0" 
#define AUTHOR "Krevedko" 

//new string_nums 
new question[131
new 
answer[64
new 
quest[64
new 
nick_winner[32
new 
results 
new string_num 
new random_quest 
new SayText 
new bool:HasC4[33

// Квары 
new redgreenblue 
new moneyawpstrip_weaponhealtharmorkevlarsound 

public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
    
register_logevent("newround"2"1=Round_Start"); 
    
red register_cvar("sm_red","0"); 
    
green register_cvar("sm_green","255"); 
    
blue register_cvar("sm_blue","0"); 
    
money register_cvar("sm_money","3500"); 
    
awp register_cvar("sm_awp","1"); 
    
sound register_cvar("sm_sound","1"); 
    
health register_cvar("sm_health","15"); 
    
armor register_cvar("sm_armor","100"); 
    
kevlar register_cvar("sm_kevlar","1"); 
    
strip_weapon register_cvar("sm_strip","1"); 
    
register_clcmd("say /vopros","resultats"); 
    
register_clcmd("say /question","resultats"); 
    
register_clcmd("say /winner""winner"); 
    
register_clcmd("say","check_results"); 
    
register_clcmd("say_team","check_results"); 
    
SayText get_user_msgid("SayText"); 
    
readfiles() 


public 
plugin_precache()  

    
precache_sound("the_smart/pipewarp.wav"
    return 
PLUGIN_CONTINUE 


public 
readfiles() 

    if (!
file_exists("addons/amxmodx/configs/questions.ini")) 
    { 
        
write_file("addons/amxmodx/configs/questions.ini""; This is questation database file. DB structure:^n;^"&#1074;questation^" ^"answer^"^n^"1+1^" ^"2^"", -1)  
    



public 
newround() 

    
results 
    
new txtlen 
    string_num 
file_size("addons/amxmodx/configs/questions.ini"1
    
random_quest random_num 1,string_num 
    
read_file("addons/amxmodx/configs/questions.ini"random_questquestion130txtlen
    while ( (
question[0] == ';' || equali(question,"")) ) 
    { 
        
random_quest random_num 1,string_num 
        
read_file("addons/amxmodx/configs/questions.ini"random_questquestion130txtlen
    } 
    
    
// парсим 
    
trim(question
    
    
parse(questionquestsizeof(quest) , answersizeof(answer)) 
    
    
    
set_hudmessage(get_pcvar_num(red), get_pcvar_num(green), get_pcvar_num(blue), 0.030.5506.012.00.20.2, -1
    
show_hudmessage(0"Smartest: %s = ?"quest




public 
check_results(id

    
    static 
chat[192]; 
    
read_args(chatsizeof(chat) - 1); 
    
remove_quotes(chat); 
    
    if ( 
results == ) { // проверка на доступность ответа 
        
        
if (equali(chatanswer )) 
        { 
            
go_nagrada(id
        } 
    } else 
    
    if (
chat[0] == '-' || chat[0] == '1' || chat[0] == '2' || chat[0] == '3' || chat[0] == '4' || chat[0] == '5' || chat[0] == '6' || chat[0] == '7' || 
    
chat[0] == '8' || chat[0] == '9' || chat[0] == '0'
    
print_col_chat(0"^4К Sorry, but ^3%s ^4 is already answered and gained award."nick_winner// Обламываем 


public 
go_nagrada(id// награда 

    
results // записываем ответ 
    
    
if (get_pcvar_num(sound) == 1) { 
        
client_cmd(0"spk the_smart/pipewarp" 
    } 
    
    if (
is_user_alive(id)) { 
        if (
get_pcvar_num(awp) == 1
        { 
            if (
get_pcvar_num(strip_weapon) == 1
            { 
                
                if (
user_has_weapon(idCSW_C4) && get_user_team(id) == 1
                    
HasC4[id] = true
                else 
                    
HasC4[id] = false
                
                
strip_user_weapons(id
                
                if (
HasC4[id]) 
                { 
                    
give_item(id"weapon_c4"); 
                    
cs_set_user_plantid ); 
                } 
                
                
give_item(id"weapon_knife"
                
give_item(id"weapon_deagle"
                
cs_set_user_bpammoidCSW_DEAGLE35 
                
            } 
            
give_item(id"weapon_awp"
            
cs_set_user_bpammoidCSW_AWP20 
        } 
        if ( 
get_pcvar_num(kevlar) == ) { 
            
give_item(id"item_kevlar"
        } 
        new 
give_health get_user_health(id) + get_pcvar_num(health
        
set_user_health(idgive_health
        new 
give_armor get_pcvar_num(armor
        
set_user_armor(idgive_armor
    }     
    
get_user_name(id,nick_winner,31); 
    new 
give_money cs_get_user_money(id) + get_pcvar_num(money
    
cs_set_user_money(idgive_money
    
print_col_chat(0"^4%s^3 have got first right answer^4and gained award! ^3%i ^4$, ^3%i ^4hp, ^3%i ^4ap"nick_winnerget_pcvar_num(money), get_pcvar_num(health), 
    
get_pcvar_num(armor)) 
    if ( 
get_pcvar_num(awp) == 1
        
print_col_chat(0"^4and ^3AWP"


public 
winner(id

    if ( 
results == 
    { 
        
print_col_chat(id"^4%s^3 have got first right answer! ^4и gained award! ^3%i ^4$, ^3%i ^4hp, ^3%i ^4ap"nick_winnerget_pcvar_num(money), get_pcvar_num(health), 
        
get_pcvar_num(armor)) 
        if ( 
get_pcvar_num(awp) == 1
            
print_col_chat(id"^4and ^3AWP"
    } else 
    
print_col_chat(id"^4No one answered right. Be first?"


public 
resultats(id

    
set_hudmessage(get_pcvar_num(red), get_pcvar_num(green), get_pcvar_num(blue), 0.030.5506.012.00.20.2, -1
    if ( 
results == 
    { 
        
show_hudmessage(id"Smartest ended. Winner in chat."
        
print_col_chat(id"^4First is ^3%s ^4and he is gained award! ^3%i ^4$, ^3%i ^4hp, ^3%i ^4ap"nick_winnerget_pcvar_num(money), get_pcvar_num(health), 
        
get_pcvar_num(armor)) 
        if ( 
get_pcvar_num(awp) == 1
            
print_col_chat(id"^4and ^3AWP"
    } else 

    
show_hudmessage(id"Smartest: %s = ?"quest



stock print_col_chat(const id, const input[], any:...)  
{  
new 
count 1players[32];  
static 
msg[191];  
vformat(msg190input3);  
replace_all(msg190"!g""^4"); // Green Color  
replace_all(msg190"!y""^1"); // Default Color (у©°  ж№«ој©)  
replace_all(msg190"!t""^3"); // Team Color  
if (idplayers[0] = id; else get_players(playerscount"ch");  
{  
for ( new 
0counti++ )  
{  
    if ( 
is_user_connected(players[i]) )  
    { 
        
message_begin(MSG_ONE_UNRELIABLESayText_players[i]);  
        
write_byte(players[i]);  
        
write_string(msg);  
        
message_end(); 
    }  
}  
}  



Liverwiz 08-26-2012 13:07

Re: [HELP] Help me
 
1. make a descriptive topic.
2. what? Not sure what you want.

Choose_Your_Destiny 08-26-2012 13:28

Re: [HELP] Help me
 
PHP Code:

print_col_chat(0"^4%s^3 have got first right answer^4and gained award! ^3%i ^4$, ^3%i ^4hp, ^3%i ^4ap,^3%i ^4DRPOINT"nick_winnerget_pcvar_num(money), get_pcvar_num(health), get_pcvar_num(drpoint
    
get_pcvar_num(armor))  
    if ( 
get_pcvar_num(awp) == 1)  
        
print_col_chat(0"^4and ^3AWP"

PHP Code:

get_pcvar_num(drpoint

I want to add this plugin drpoint

Liverwiz 08-26-2012 13:35

Re: [HELP] Help me
 
in plugin_init

drpoint = register_cvar("amx_drpoint", "1")

is that what you want?

Choose_Your_Destiny 08-26-2012 13:53

Re: [HELP] Help me
 
Ohhh yeah!! Thnx man :)

EDIT:

It gives 100 drpoint :shock: I want just 10 drpoint(or cvar command can be set with)

Liverwiz 08-26-2012 14:11

Re: [HELP] Help me
 
change the cvar value?

and don't delete your code.

Choose_Your_Destiny 08-26-2012 18:31

Re: [HELP] Help me
 
Quote:

Originally Posted by Liverwiz (Post 1783410)
change the cvar value?

and don't delete your code.

I have done enough description in topic.


All times are GMT -4. The time now is 05:47.

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