Skocz do zawartości

Witamy w Nieoficjalnym polskim support'cie AMX Mod X

Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
  • Rozpoczynaj nowe tematy i odpowiedaj na inne
  • Zapisz się do tematów i for, aby otrzymywać automatyczne uaktualnienia
  • Dodawaj wydarzenia do kalendarza społecznościowego
  • Stwórz swój własny profil i zdobywaj nowych znajomych
  • Zdobywaj nowe doświadczenia

Dołączona grafika Dołączona grafika

Guest Message by DevFuse
 

Zdjęcie

[KOSZ] problem z pytaniami


  • Zamknięty Temat jest zamknięty
2 odpowiedzi w tym temacie

#1 Maciuś20

    Profesjonalista

  • Użytkownik

Reputacja: 19
Początkujący

  • Postów:202
  • Steam:steam
  • Imię:Maciek
  • Lokalizacja:Daleko
Offline

Napisano 13.07.2017 13:58

Witam mam problem z pytaniami przerobiłem go na zm by po zadaniu pytania i ktoś dobrze odpowiedział dawało mu albo ap albo exp

kod 

/* Plugin generated by AMXX-Studio */
 
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <zm>
 
 
#define PLUGIN "Questions / Equation Event"
#define VERSION "1.1"
#define AUTHOR "Screeaam.."
 
new szQuestion[512] = "";
new szAnswer[512] = "";
new szPyt[512] = "";
new szOdp[512] = "";
new message[512];
new gszFile[128];
 
// CVARS
new mode, qee, czas, odliczanie, zakonczenie, style, first, second, RGB, PosX, PosY, minF, maxF, minG, maxG;
new count, active, start, show_time;
 
// True answer;
new answer[512];
 
// Catch winner?
new bool:catch = false;
 
// Question / Equation is in progress?
new bool:is_in_progress;
 
// Arrays
new Array:questions, Array:answers;
 
new SyncHudObj;
 
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
 
// CVARS
qee = register_cvar("qee_active", "1");               // 0 - Plugin Disable; 1 - Plugin Enable
mode = register_cvar("qee_mode", "0");                // 0 - Questions; 1 - Equation; 2 - random;
czas = register_cvar("qee_time_start", "300.0");      // Time to start Questions in second
odliczanie = register_cvar("qee_count", "10");        // Time Countdown to the questions
zakonczenie = register_cvar("qee_end", "8");          // Time to write answer
style = register_cvar("qee_show", "0");               // Style to show questions 0 - HudMessage; 1 - ClientPrint
first = register_cvar("qee_max_fnumber", "100");      // First number to equation
second = register_cvar("qee_max_snumber", "200");     // Second number to equation
RGB = register_cvar("qee_rgb", "255255255");          // Colors of HudMessages
PosX = register_cvar("qee_posx", "-1.0");             // Position X of HudMessage
PosY = register_cvar("qee_posy", "0.28");             // Position Y of HudMessage
minF = register_cvar("qee_min_frags", "2");           // Minimum frags award
maxF = register_cvar("qee_max_frags", "10");          // Maximum frags award
minG = register_cvar("qee_min_gold", "500");          // Minimum gold award
maxG = register_cvar("qee_max_gold", "5000");         // Maximum gold award
show_time = register_cvar("qee_time_hud", "6.0");     // How long do you want to see a shout
 
start = get_pcvar_num(czas);
 
// ARRAYS
questions = ArrayCreate(64,10)
answers = ArrayCreate(64,10)
 
// REGISTERS
register_clcmd("say", "say_handle");
register_clcmd("Pytanie", "pytanie");
register_clcmd("Odpowiedz", "odpowiedz");
register_clcmd("say /menu_qee", "admin_menu");
register_clcmd("/menu_qee", "admin_menu");
register_clcmd("/qee", "admin_menu");
register_clcmd("say /qee", "admin_menu");
 
set_task(float(start), "g_count", 2000);
 
// FILES
new szDir[128];
        get_configsdir(szDir, charsmax(szDir));
        add(szDir, sizeof szDir, "/Questions_Equation");
        
        if (!dir_exists(szDir))
                mkdir(szDir);
 
format(gszFile, charsmax(gszFile), "%s/questions.ini", szDir);
if(!file_exists(gszFile))
write_file(gszFile, "^"Stolica Polski to?^" ^"Warszawa^"");
 
SyncHudObj = CreateHudSyncObj();
 
ZaladujPlik();
}
 
public ZaladujPlik()
{
new sz1[64],sz2[64];
 
new line=0, text[128],chars
do
        {
           line = read_file(gszFile,line,text,127,chars)
             parse(text, sz1, 63, sz2, 63);
                ArrayPushString(questions,sz1);
          ArrayPushString(answers,sz2);
 
        }
        while(line!=0)
}
 
public Zapisz(id){
new file = fopen(gszFile, "a");
new szData[512];
 
formatex(szData, 512, "^"%s^" ^"%s^"^n", szPyt, szOdp);
fputs(file, szData);
 
client_print(id, 3, "******Zapisano!******");
 
fclose(file);
}
 
public g_count()
{
active = get_pcvar_num(qee);
if(active && !is_in_progress) 
{
count = get_pcvar_num(odliczanie);
 
format(message, charsmax(message), "Do zadania pytania pozostalo %i sekund", count);
show_text(message)
 
remove_task(2000);
set_task(1.0, "odswiezzz", 2000,_,_,"b");
 
is_in_progress = true;
}
}
 
public odswiezzz()
{
new modes = get_pcvar_num(mode);
if(count-- <= 0){
remove_task(2000)
for(new id = 1; id < 33; id++) choose_style(modes)
}
else
{
format(message, charsmax(message), "Do zadania pytania pozostalo %i sekund", count);
show_text(message)
}
}
 
public choose_style(style)
{
if(active)
{
new end = get_pcvar_num(zakonczenie);
set_task(float(end), "Zakoncz", 3000);
catch = true;
 
switch(style)
{
case 0:
{
static line;
if(++line >= ArraySize(questions)){
line = 0;
}
ArrayGetString(questions,line,szQuestion,charsmax(szQuestion));
ArrayGetString(answers,line,szAnswer,charsmax(szAnswer));
 
format(message, charsmax(message), "%s", szQuestion);
show_text(message)
 
format(answer, charsmax(answer), "%s", szAnswer); 
 
return PLUGIN_HANDLED;
}
case 1:
{
new fnumber = get_pcvar_num(first); new snumber = get_pcvar_num(second);
new rnd1 = random_num(10, fnumber);
new rnd2 = random_num(10, snumber);
new rnd3 = rnd2 / 2;
new wynik = rnd1 + rnd2 - rnd3;
format(answer, 511, "%i", wynik); 
 
format(message, charsmax(message), "Rozwiaz rownanie: %i + %i - %i", rnd1, rnd2, rnd3);
show_text(message)
 
return PLUGIN_HANDLED;
}
case 2:
{
new rnd = random_num(0,1);
choose_style(rnd);
return PLUGIN_HANDLED;
}
}
}
return PLUGIN_CONTINUE;
}
 
public say_handle(id){
if(!catch || !active)
return PLUGIN_CONTINUE;
 
new command[192]
read_argv(1,command,191)
 
if(equali(command,answer)) 
{
awards(id);
remove_task(3000);
set_task(float(start), "g_count", 2000);
 
catch = false;
is_in_progress = false;
}
return PLUGIN_CONTINUE;
}
 
public Zakoncz()
{
if(!active || !catch) return PLUGIN_HANDLED;
 
format(message, charsmax(message), "Przykro mi, nikt nie wygral!");
show_text(message)
 
catch = false;
is_in_progress = false;
set_task(float(start), "g_count", 2000);
 
return PLUGIN_CONTINUE;
}
 
public plugin_end(){
ArrayDestroy(questions);
ArrayDestroy(answers);
}
 
public admin_menu(id)
{
new menu = menu_create("Dodawanie Pytan", "admin_menu_handle")
menu_additem(menu, "Dodaj Pytanie");
menu_additem(menu, "Przeladuj pytania");
 
if(get_user_flags(id) & ADMIN_BAN)
menu_display(id, menu, 0)
}
public admin_menu_handle(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
if(item == 0)
client_cmd(id, "messagemode Pytanie");
if(item == 1){
       ZaladujPlik();
client_print(id, 3, "******Przeladowano pytania!******");
}
 
menu_destroy(menu);
return PLUGIN_CONTINUE;
}
 
public pytanie(id){     
new text[192]
read_argv(1,text,191)
format(szPyt, charsmax(szPyt), "%s", text);  
client_cmd(id, "messagemode Odpowiedz");
}
public odpowiedz(id){   
new text[192]
read_argv(1,text,191)
format(szOdp, charsmax(szOdp), "%s", text);  
Zapisz(id);
}
 
stock show_text(message[])
{
ClearSyncHud(0, SyncHudObj);
 
new show = get_pcvar_num(style);
new color[10] 
new r, g, b, c
get_pcvar_string(RGB, color, 9) 
c = str_to_num(color) 
r = c / 1000000 
c %= 1000000  
g = c / 1000 
b = c % 1000 
 
new Float:timeshow = get_pcvar_float(show_time);
new Float:X = get_pcvar_float(PosX);
new Float:Y = get_pcvar_float(PosY);
set_hudmessage(r, g, b, X, Y, 0, 6.0, timeshow)
 
if(show == 0)
ShowSyncHudMsg(0, SyncHudObj, "%s", message)
else if(show == 1)
client_print(0, print_center, "%s", message)
}
 
public awards(id)
{
new rannum = random_num(0,1);
new nick[34];
get_user_name(id, nick, 33)
switch(rannum)
{
case 0:
{
new ming = get_pcvar_num(minG); new maxg = get_pcvar_num(maxG);
new rnd = random_num(ming, maxg);
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + rnd, 1);
if(zp_get_user_ammo_packs(id) > 100) zp_set_user_ammo_packs(id, 2);
 
format(message, charsmax(message), "Poprawna odpowiedz! %s wygral +%i ap!", nick, rnd);
show_text(message);
 
return PLUGIN_HANDLED;;
}
case 1:
{
new ming = get_pcvar_num(minG); new maxg = get_pcvar_num(maxG);
new rnd = random_num(ming, maxg);
zp_get_user_exp(id, zp_get_user_exp(id) + rnd, 1);
if(zp_get_user_exp(id) > 3) zp_set_user_exp(id, 2);
 
format(message, charsmax(message), "Poprawna odpowiedz! %s wygral +%i exp!", nick, rnd);
show_text(message);
 
return PLUGIN_HANDLED;
}
}
return PLUGIN_HANDLED;
}

błąd

//// questions_equation_event.sma
// C:\Users\killer_cycDDS\Desktop\zombie\questions_equation_event.sma(317) : error 017: undefined symbol "zp_set_user_ammo_packs"
// C:\Users\killer_cycDDS\Desktop\zombie\questions_equation_event.sma(318) : error 017: undefined symbol "zp_get_user_ammo_packs"
// C:\Users\killer_cycDDS\Desktop\zombie\questions_equation_event.sma(318) : error 017: undefined symbol "zp_set_user_ammo_packs"
// C:\Users\killer_cycDDS\Desktop\zombie\questions_equation_event.sma(323) : warning 225: unreachable code
// C:\Users\killer_cycDDS\Desktop\zombie\questions_equation_event.sma(323) : error 036: empty statement
// C:\Users\killer_cycDDS\Desktop\zombie\questions_equation_event.sma(329) : error 017: undefined symbol "zp_get_user_exp"
// C:\Users\killer_cycDDS\Desktop\zombie\questions_equation_event.sma(330) : error 017: undefined symbol "zp_get_user_exp"
// C:\Users\killer_cycDDS\Desktop\zombie\questions_equation_event.sma(330) : error 017: undefined symbol "zp_set_user_exp"
// C:\Users\killer_cycDDS\Desktop\zombie\questions_equation_event.sma(343) : warning 204: symbol is assigned a value that is never used: "maxF"
// C:\Users\killer_cycDDS\Desktop\zombie\questions_equation_event.sma(343) : warning 204: symbol is assigned a value that is never used: "minF"
//
// 7 Errors.
// Could not locate output file compiled\questions_equation_event.amx (compile failed).
//
// Compilation Time: 0,09 sec
// ----------------------------------------

zm.inc

 

native zp_set_user_exp(id)
native zp_get_user_exp(id)
native zp_get_user_ammo_packs(id)
native zp_get_user_ammo_packs(id)

Użytkownik Maciuś20 edytował ten post 13.07.2017 14:01

  • +
  • -
  • 0

#2 _McHappy

    Wszechwiedzący

  • Support Team

Reputacja: 243
Wszechwidzący

  • Postów:501
  • GG:
  • Imię:Radek
  • Lokalizacja:Tak
Offline

Napisano 13.07.2017 15:24

native zp_set_user_exp(id)
native zp_get_user_exp(id)
native zp_get_user_ammo_packs(id)
native zp_get_user_ammo_packs(id)

na

native zp_set_user_exp(id)
native zp_get_user_exp(id)
native zp_set_user_ammo_packs(id)
native zp_get_user_ammo_packs(id)

w zm.inc (o ile zp_set_user_ammo_packs(id) rzeczywiście istnieje i jest udostępniony przez silnik ZM).


  • +
  • -
  • 0

#3 DarkGL

    Nie oddam ciasteczka !

  • Administrator

Reputacja: 6 555
Godlike

  • Postów:11 985
  • GG:
  • Steam:steam
  • Imię:Rafał
  • Lokalizacja:Warszawa
Offline

Napisano 13.07.2017 16:18

Nazywaj tematy zgodnie z ich treścią.
Napisz ponownie temat nazywając go tak, aby każdy wiedział o co chodzi.

Jednoznacznie określ problematykę tematu, wyróżniając go spośród reszty.
Nie dodawaj zbędnych informacji, znaków, ani emotikon w nazwie tematu.

Ten temat w ciągu 24 godzin zostanie przeniesiony do kosza.
  • +
  • -
  • 0




Użytkownicy przeglądający ten temat: 0

0 użytkowników, 0 gości, 0 anonimowych