Raised This Month: $ Target: $400
 0% 

zp solve plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
B7PK
Member
Join Date: Apr 2016
Location: palestine
Old 05-23-2016 , 13:00   zp solve plugin
Reply With Quote #1

hello guys...i need plugin Subtract mathematical questions and give "5" ammo packs for Who his answers are true...
sry for my EN see the photo...Mod ZP 5.0.8


and THX

__________________
B7PK is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-23-2016 , 13:20   Re: zp solve plugin
Reply With Quote #2

This plugin is named Trivia , You can find IT .
You will have a cfg or ini file and add your question and answer. just go through it .sma and change points to ammo. If you can't do by yourself then give me set_user_ammo native and will make you for you.
In previous plugin I asked you native name:
it's zp_set_user_ammo ? Or how?
siriusmd99 is offline
B7PK
Member
Join Date: Apr 2016
Location: palestine
Old 05-23-2016 , 13:27   Re: zp solve plugin
Reply With Quote #3

this is my ammo packs full cod
i think it "zp_ammopacks_set"
PHP Code:
/*================================================================================
    
    -----------------------
    -*- [Zp] Ammo Packs -*-
    -----------------------
    
    This plugin is part of Zombie Plague Mod and is distributed under the
    terms of the GNU General Public License. Check ZP_ReadMe.txt for details.
    
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zp50_core>

#define is_user_valid(%1) (1 <= %1 <= g_MaxPlayers)

#define TASK_HIDEMONEY 100
#define ID_HIDEMONEY (taskid - TASK_HIDEMONEY)

// CS Player PData Offsets (win32)
const PDATA_SAFE 2
const OFFSET_CSMONEY 115

const HIDE_MONEY_BIT = (1<<5)

#define MAXPLAYERS 32

new g_MaxPlayers
new g_MsgHideWeapong_MsgCrosshair
new g_AmmoPacks[MAXPLAYERS+1]

new 
cvar_starting_ammo_packscvar_disable_money

public plugin_init()
{
    
register_plugin("[ZP] Ammo Packs"ZP_VERSION_STRING"ZP Dev Team")
    
    
g_MaxPlayers get_maxplayers()
    
g_MsgHideWeapon get_user_msgid("HideWeapon")
    
g_MsgCrosshair get_user_msgid("Crosshair")
    
    
cvar_starting_ammo_packs register_cvar("zp_starting_ammo_packs""5")
    
cvar_disable_money register_cvar("zp_disable_money""0")
    
    
register_event("ResetHUD""event_reset_hud""be")
    
register_message(get_user_msgid("Money"), "message_money")
}

public 
plugin_natives()
{
    
register_library("zp50_ammopacks")
    
register_native("zp_ammopacks_get""native_ammopacks_get")
    
register_native("zp_ammopacks_set""native_ammopacks_set")
}

public 
native_ammopacks_get(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_valid(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return -
1;
    }
    
    return 
g_AmmoPacks[id];
}

public 
native_ammopacks_set(plugin_idnum_params)
{
    new 
id get_param(1)
    
    if (!
is_user_valid(id))
    {
        
log_error(AMX_ERR_NATIVE"[ZP] Invalid Player (%d)"id)
        return 
false;
    }
    
    new 
amount get_param(2)
    
    
g_AmmoPacks[id] = amount
    
return true;
}

public 
client_putinserver(id)
{
    
g_AmmoPacks[id] = get_pcvar_num(cvar_starting_ammo_packs)
}

public 
client_disconnect(id)
{
    
remove_task(id+TASK_HIDEMONEY)
}

public 
event_reset_hud(id)
{
    
// Hide money?
    
if (get_pcvar_num(cvar_disable_money))
        
set_task(0.1"task_hide_money"id+TASK_HIDEMONEY)
}

// Hide Player's Money Task
public task_hide_money(taskid)
{
    
// Hide money
    
message_begin(MSG_ONEg_MsgHideWeapon_ID_HIDEMONEY)
    
write_byte(HIDE_MONEY_BIT// what to hide bitsum
    
message_end()
    
    
// Hide the HL crosshair that's drawn
    
message_begin(MSG_ONEg_MsgCrosshair_ID_HIDEMONEY)
    
write_byte(0// toggle
    
message_end()
}

public 
message_money(msg_idmsg_destmsg_entity)
{
    
// Disable money setting enabled?
    
if (!get_pcvar_num(cvar_disable_money))
        return 
PLUGIN_CONTINUE;
    
    
fm_cs_set_user_money(msg_entity0)
    return 
PLUGIN_HANDLED;
}

// Set User Money
stock fm_cs_set_user_money(idvalue)
{
    
// Prevent server crash if entity's private data not initalized
    
if (pev_valid(id) != PDATA_SAFE)
        return;
    
    
set_pdata_int(idOFFSET_CSMONEYvalue)

__________________
B7PK is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-23-2016 , 13:34   Re: zp solve plugin
Reply With Quote #4

OK , if you can't by yourself I will help you.
siriusmd99 is offline
B7PK
Member
Join Date: Apr 2016
Location: palestine
Old 05-23-2016 , 13:37   Re: zp solve plugin
Reply With Quote #5

i can't by myself is hard for me :\...i think this will help

PHP Code:
/* Plugin generated by AMXX-Studio 
*/

#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"";Это файл с вопросами и ответам. Как должен выглядеть файл:^n;^"&#1074;опрос^" ^"ответ^"^n^"1+1^" ^"2^"", -1) 
}
}

public 
newround()
{
    
results 0
    
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"Конкурс: %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К сожалению, игрок ^3%s ^4уже ответил на этот вопрос и получил награду."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На вопрос конкурса первым ответил ^3%s ^4и получил награду! ^3%i ^4$, ^3%i ^4hp, ^3%i ^4брони"nick_winnerget_pcvar_num(money), get_pcvar_num(health),
get_pcvar_num(armor))
if ( 
get_pcvar_num(awp) == 1)
print_col_chat(0"^4и ^3AWP")
}

public 
winner(id)
{
    if ( 
results == )
    {
    
print_col_chat(id"^4На вопрос конкурса первым ответил ^3%s ^4и получил награду! ^3%i ^4$, ^3%i ^4hp, ^3%i ^4брони"nick_winnerget_pcvar_num(money), get_pcvar_num(health),
    
get_pcvar_num(armor))
    if ( 
get_pcvar_num(awp) == 1)
    
print_col_chat(id"^4и ^3AWP")
    } else
    
print_col_chat(id"^4Победителя еще нет. Будешь первым?")
}

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"Конкурс окончен. Победитель в чате")
print_col_chat(id"^4На вопрос конкурса первым ответил ^3%s ^4и получил награду! ^3%i ^4$, ^3%i ^4hp, ^3%i ^4брони"nick_winnerget_pcvar_num(money), get_pcvar_num(health),
get_pcvar_num(armor))
if ( 
get_pcvar_num(awp) == 1)
print_col_chat(id"^4и ^3AWP")
} else
{
show_hudmessage(id"Конкурс: %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();
            } 
        } 
    } 

__________________
B7PK is offline
abood alnjjar
Member
Join Date: Oct 2015
Location: palestine
Old 05-25-2016 , 10:36   Re: zp solve plugin
Reply With Quote #6

Nice plugin...when finish i will take it
__________________
abood alnjjar is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-25-2016 , 12:00   Re: zp solve plugin
Reply With Quote #7

Change interval of the questions here:

PHP Code:
#define QUESTION_INTERVAL 30.0 
Change the prefix here:

PHP Code:
new const PluginTag[] = "[Trivia Bot]"
File trivia_list.ini goes to configs folder.

Open file and you will understand how to add questions and answers, i put 2 examples.

Good Luck.
Attached Files
File Type: ini trivia_list.ini (62 Bytes, 112 views)
File Type: sma Get Plugin or Get Source (trivia_bot.sma - 495 views - 3.1 KB)

Last edited by siriusmd99; 05-25-2016 at 13:00.
siriusmd99 is offline
B7PK
Member
Join Date: Apr 2016
Location: palestine
Old 05-25-2016 , 12:42   Re: zp solve plugin
Reply With Quote #8

thx is work but i want make it not need say /trivia and wait to dead to start the trivia...i want make it ask when i playing and not need say /trivia..sry for my English
__________________

Last edited by B7PK; 05-25-2016 at 12:47.
B7PK is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 05-25-2016 , 13:00   Re: zp solve plugin
Reply With Quote #9

I updated the code from my previous post , you can download and try ...
siriusmd99 is offline
B7PK
Member
Join Date: Apr 2016
Location: palestine
Old 05-25-2016 , 13:07   Re: zp solve plugin
Reply With Quote #10

not need say /trivia not work :/...and i want work when i be dead/life in anyways

and thx
__________________

Last edited by B7PK; 05-25-2016 at 13:29.
B7PK 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:28.


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