Raised This Month: $ Target: $400
 0% 

32 bit test


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kp3t3h
Senior Member
Join Date: Feb 2011
Old 05-22-2012 , 17:52   32 bit test
Reply With Quote #1

ok i have this plugin but i want it to show a message to everyone when a person fails the test
==========================
here it is, all done. thankyou
PHP Code:
/***************************************************

This plugin is to test if players have set 32-bit.

Multiple pictures are show to each player and he or she needs to
choose proper one (in menu). If player does not choose properly
after X tries he or she is disconnected. Pictures are show after
the player dies, not to disturb the gameplay.

CVARs (default):
32bit_max_tries "2"
32bit_immunity_flag ""

Plugin is using "data/lang/32bit_test.txt" language file.

***************************************************/

#pragma semicolon 1
#include <amxmodx> 
#include <amxmisc>
#define TASKID 18923

new g_test_details[33][3];
new 
g_tested[33];
new 
g_tries[33];
new 
g_quick_test[33];
new 
g_immunity_flag;
new 
p_tested32bit[33];
new 
p_max_tries;
new 
p_immunity_flag;
new 
p_warmup_active//this cvar is to prevent from testing players during warmup. When "amx_warmup_active" is "1" then tests do not occur (you can use it for custom warmup)

public plugin_init(){
    
register_plugin("32-bit test","2.0","Czesio");
    
register_dictionary("32bit_test.txt");
    
register_event("DeathMsg""event_death_msg""a");
    
    
p_max_tries register_cvar("32bit_max_tries""2");
    
p_immunity_flag register_cvar("32bit_immunity_flag""");
    
p_warmup_active register_cvar("amx_warmup_active""0");
    
    new 
tmp[32];
    for(new 
i=1i<33i++){
        
formatex(tmp,31,"tested32bit_%d",i);
        
p_tested32bit[i] = register_cvar(tmp,"0");
        
g_tested[i] = get_pcvar_num(p_tested32bit[i]);
    }
    
    
get_pcvar_string(p_immunity_flagtmp31);
    
g_immunity_flag read_flags(tmp);
    
    
register_menucmd(register_menuid("menu_start"), 511"menu_start_handler");
    
register_menucmd(register_menuid("menu_a"), 511"menu_a_handler");
    
register_menucmd(register_menuid("menu_b"), 511"menu_b_handler");
    
register_menucmd(register_menuid("menu_c"), 511"menu_c_handler");
    
    return 
PLUGIN_CONTINUE;
}

public 
client_connect(id){
    
g_tries[id] = 0;
    
g_quick_test[id] = 0;
}

public 
event_death_msg(){
    new 
victim read_data(2);
    
set_task(1.5,"test_player"victim TASKID);
    
    return 
PLUGIN_HANDLED;
}

public 
test_player(id){
    
id -= TASKID;
    
    if(
get_pcvar_num(p_warmup_active))
        return;
    
    if(
is_user_connected(id) && !is_user_bot(id) && !is_user_hltv(id) && g_tested[id] != get_user_userid(id)){
        if(
get_user_flags(id) & g_immunity_flag){
            
g_tested[id] = get_user_userid(id);
            return;
        }
        
        
g_tries[id]++;
        
        if(
g_tries[id] > get_pcvar_num(p_max_tries)){
            
test_failed(id);
        }
        else{
            
g_test_details[id][0] = random(8) + 1;
            
g_test_details[id][1] = random(8) + 1;
            
g_test_details[id][2] = random(8) + 1;
            if(
g_quick_test[id])
                
show_menu_test(id,0);
            else
                
show_menu_start(id);
        }
    }
}

public 
menu_start_handler(id,key){
    
key++;
    if(
key == 1)
        
show_menu_test(id,0);
    else if(
key == 2)
        
kick_player(id);
    else if(
key == 4)
        
show_more_info(id);
    else if(
key == 5){
        
g_quick_test[id] = 1;
        
show_menu_test(id,0);
    }
    else
        
show_menu_start(id);
}

public 
menu_a_handler(id,key){
    
menu_test_handler(idkey0);
}
public 
menu_b_handler(id,key){
    
menu_test_handler(idkey1);
}
public 
menu_c_handler(id,key){
    
menu_test_handler(idkey2);
}

public 
menu_test_handler(idkeystage){
    
key++;
    if(
key == 9)
        
show_menu_test(idstage);
    else if(
stage == && key == g_test_details[id][stage])
        
test_passed(id);
    else if(
key == g_test_details[id][stage])
        
show_menu_test(idstage 1);
    else
        
test_failed(id);
}

public 
show_menu_start(id){
    new 
menu_body[1000];
    
formatex(menu_body999"\w%L^n^n\w1. %L^n\w2. %L^n^n\w4. %L^n\w5. %L"id"WELCOME"id"WELCOME_ANS1"id"WELCOME_ANS2"id"WELCOME_ANS4"id"WELCOME_ANS5");
    
show_menu(id511menu_body, -1"menu_start");
}

public 
show_menu_test(idstage){
    new 
menu_body[1000];
    
    if(
stage == 0){
        
formatex(menu_body999"\w%L^n^n\w1. A1^n\w2. A2^n\w3.\w A3^n\w4.\w A4^n\w5.\w A5^n\w6.\w A6^n\w7.\w A7^n\w8.\w A8^n^n\w9. %L"id"CHOOSE_PICTURE"id"SHOW_AGAIN");
        
show_menu(id511menu_body, -1"menu_a");
    }
    else if(
stage == 1){
        
formatex(menu_body999"\w%L^n^n\w1. B1^n\w2. B2^n\w3.\w B3^n\w4.\w B4^n\w5.\w B5^n\w6.\w B6^n\w7.\w B7^n\w8.\w B8^n^n\w9. %L"id"CHOOSE_PICTURE"id"SHOW_AGAIN");
        
show_menu(id511menu_body, -1"menu_b");
    }
    else{
        
formatex(menu_body999"\w%L^n^n\w1. C1^n\w2. C2^n\w3.\w C3^n\w4.\w C4^n\w5.\w C5^n\w6.\w C6^n\w7.\w C7^n\w8.\w C8^n^n\w9. %L"id"CHOOSE_PICTURE"id"SHOW_AGAIN");
        
show_menu(id511menu_body, -1"menu_c");
    }
    if(!
g_quick_test[id] || stage == 0)
        
do_motd(idstage);
}

public 
show_more_info(id){
    
do_motd(id, -1);
    
show_menu_start(id);
}

public 
do_motd(id,stage){
    new 
motd[2000];
    new 
find_string[50];
    new 
replace_string[50];
    
    
motd "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd'><html><head><style type='text/css'>body{background:black;color:#fff;font:bold 16px Arial;text-align:center;margin:0;padding:0}th,td{padding-top:4px}b,u{display:inline-block;width:16px;height:48px}td b{background:#808080}td u{background:#7f7f7f}th b{background:#878787}th u{background:#787878}</style><meta http-equiv='content-type' content='text/html;charset=UTF-8'/></head>";
    
    if(
stage != -&& g_quick_test[id] == 0){
        new 
c;
        if(
stage == 0)
            
'A';
        else if(
stage == 1)
            
'B';
        else if(
stage == 2)
            
'C';
        
        
format(motd,1999,"%s<body><br/>%L<br/><br/><table cellpadding='0' cellspacing='5' style='margin:0 auto'><tr><td>%c1<br><b></b><u></u><b></b></td><td>%c2<br><b></b><u></u><b></b></td><td>%c3<br><b></b><u></u><b></b></td><td>%c4<br><b></b><u></u><b></b></td><td>%c5<br><b></b><u></u><b></b></td><td>%c6<br><b></b><u></u><b></b></td><td>%c7<br><b></b><u></u><b></b></td><td>%c8<br><b></b><u></u><b></b></td></tr></table><br/>%L %d / 3</body></html>",motd,id,"DETAILS",c,c,c,c,c,c,c,c,id,"STAGE",stage+1);
        
        
formatex(find_string,49,"<td>%c%d<br><b></b><u></u><b></b></td>",cg_test_details[id][stage]);
        
formatex(replace_string,49,"<th>%c%d<br><b></b><u></u><b></b></th>",cg_test_details[id][stage]);
        
replace(motd1999find_stringreplace_string);
    }
    else if(
stage != -1){
        
strcat(motd,"<body><table cellpadding='0' cellspacing='5' style='margin:0 auto'><tr><td>A1<br><b></b><u></u><b></b></td><td>A2<br><b></b><u></u><b></b></td><td>A3<br><b></b><u></u><b></b></td><td>A4<br><b></b><u></u><b></b></td><td>A5<br><b></b><u></u><b></b></td><td>A6<br><b></b><u></u><b></b></td><td>A7<br><b></b><u></u><b></b></td><td>A8<br><b></b><u></u><b></b></td></tr>",1999);
        
strcat(motd,"<tr><td>B1<br><b></b><u></u><b></b></td><td>B2<br><b></b><u></u><b></b></td><td>B3<br><b></b><u></u><b></b></td><td>B4<br><b></b><u></u><b></b></td><td>B5<br><b></b><u></u><b></b></td><td>B6<br><b></b><u></u><b></b></td><td>B7<br><b></b><u></u><b></b></td><td>B8<br><b></b><u></u><b></b></td></tr>",1999);
        
strcat(motd,"<tr><td>C1<br><b></b><u></u><b></b></td><td>C2<br><b></b><u></u><b></b></td><td>C3<br><b></b><u></u><b></b></td><td>C4<br><b></b><u></u><b></b></td><td>C5<br><b></b><u></u><b></b></td><td>C6<br><b></b><u></u><b></b></td><td>C7<br><b></b><u></u><b></b></td><td>C8<br><b></b><u></u><b></b></td></tr></table></body></html>",1999);
    
        
formatex(find_string,49,"<td>A%d<br><b></b><u></u><b></b></td>",g_test_details[id][0]);
        
formatex(replace_string,49,"<th>A%d<br><b></b><u></u><b></b></th>",g_test_details[id][0]);
        
replace(motd,1999,find_string,replace_string);
        
        
formatex(find_string,49,"<td>B%d<br><b></b><u></u><b></b></td>",g_test_details[id][1]);
        
formatex(replace_string,49,"<th>B%d<br><b></b><u></u><b></b></th>",g_test_details[id][1]);
        
replace(motd,1999,find_string,replace_string);
        
        
formatex(find_string,49,"<td>C%d<br><b></b><u></u><b></b></td>",g_test_details[id][2]);
        
formatex(replace_string,49,"<th>C%d<br><b></b><u></u><b></b></th>",g_test_details[id][2]);
        
replace(motd,1999,find_string,replace_string);
    }
    else{
        
format(motd,1999,"%s<body><br/>%L</body></html>"motdid"MORE_INFO");
    }
    
    
show_motd(idmotd"32-bit test");
}

public 
test_passed(id){
    
g_tested[id] = get_user_userid(id);
    
set_pcvar_num(p_tested32bit[id], g_tested[id]);
    
client_print(id,print_chat,"[TEST] %L",LANG_PLAYER,"TEST_OK");
}

public 
test_failed(id){
    if(
g_tries[id] >= get_pcvar_num(p_max_tries)){
        
kick_player(id);
    }
    else{
        if(
get_pcvar_num(p_max_tries) - g_tries[id] == 1)
            
client_print(id,print_chat,"[TEST] %L",LANG_PLAYER,"TEST_BAD_1_TRY_LEFT",get_pcvar_num(p_max_tries) - g_tries[id]);
        else
            
client_print(id,print_chat,"[TEST] %L",LANG_PLAYER,"TEST_BAD",get_pcvar_num(p_max_tries) - g_tries[id]);
    }
}

public 
kick_player(id)
{
    new 
szName[32]; get_user_name(idszNamecharsmax(szName))
    
client_print(0print_chat"%s failed at the 32bit test. He is now kicked."szName)
    
server_cmd("kick #%d 16-bit video"get_user_userid(id));

Attached Files
File Type: txt 32bit_test.txt (1.0 KB, 102 views)
__________________
need help with the following
no.1, no.2, no.3, no.4 no.5

Last edited by kp3t3h; 06-04-2012 at 10:02.
kp3t3h is offline
mazmaajinsh
Senior Member
Join Date: Apr 2005
Location: Latvia
Old 05-23-2012 , 11:57   Re: 32 bit test
Reply With Quote #2

Why don't you it yourself?
__________________
Ahujena
mazmaajinsh is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-23-2012 , 12:11   Re: 32 bit test
Reply With Quote #3

Quote:
Originally Posted by mazmaajinsh View Post
Why don't you it yourself?
You aren't required to know how to code things if you are posting in Suggestions/Requests.
This section is for people to make it for you.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
kp3t3h
Senior Member
Join Date: Feb 2011
Old 05-25-2012 , 17:54   Re: 32 bit test
Reply With Quote #4

well, are you going to help me?
__________________
need help with the following
no.1, no.2, no.3, no.4 no.5
kp3t3h is offline
Larcyn
Senior Member
Join Date: Oct 2010
Old 05-25-2012 , 18:08   Re: 32 bit test
Reply With Quote #5

Change your kick_player to this:

PHP Code:
public kick_player(id)
{
    new 
szName[32]; get_user_name(idszNamecharsmax(szName))
    
client_print(0print_chat"%s failed at the 32bit test. He is now kicked."szName)
    
server_cmd("kick #%d 16-bit video"get_user_userid(id));

__________________

Taking private requests, PM me for information.
Selling HideNSeek & Jailbreak plugins.

Selling Achievement API System (PHP &
MySQL / nVault)
Larcyn 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 00:43.


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