[KOSZ] Pierwszy raz
KtosNieznany
15.02.2016
Siemka, pierwszy raz w ogóle zabrałem się za próbę napisania czegoś, dopiero się uczę jeśli można to tak nazwać. Więc korzystając z poradników próbowałem napisać sklep za $$ lecz coś chyba spierdzieliłem :< Nie chce się z kompilować, a w AMXx Studio co chwile podkreśla inną linijkę. Jakieś rady co spierniczyłem?
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <hamsandwich> #include <cstrike> #include <fun> #include <fakemeta> #include <engine> #define PLUGIN "Sklep 1.0" #define VERSION "1.0" #define AUTHOR "Christopher" new name [32]; new speed[33]; new skoki[33]; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /sklep", "sklep") register_event( "CurWeapon", "Event_Change_Weapon", "be", "1=1" ); RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1) register_event("RoundTime","round_begin","bc"); register_forward(FM_CmdStart, "CmdStart"); } public sklepv1(id) { new menu = menu_create("\wSklep 1.0 \r By Christopher","menu") menu_additem(menu,"\ySpeed /w[Zwieksza Predkosc] \d[5000$]","1",0) menu_additem(menu,"\yGrawitacja \w[Zwieksza Grawitacje] \d[5000$]","2",0) menu_additem(menu,"\y+2 Skoki \w[Dostajesz dodatkowy skok] \d[8000$]","3",0) menu_setprop(menu,MPROP_EXIT,MEXIT_ALL) menu_display(id,menu,0) } public menu(id, menu, item){ if(item==MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED; } new data[6], iName[64] new key = str_to_num(data) switch(key) { case 1 :{ if (!is_user_alive(id)){ get_user_name(id, name, 31) return PLUGIN_HANDLED; } if (cs_get_user_money(id) >= 5000 ){ get_user_name(id, name, 31) speed[id] = 1; set_user_maxspeed(id, 650.0) cs_set_user_money(id , cs_get_user_money(id) - 5000, 0) } } case 2 : { if (!is_user_alive(id)){ get_user_name(id, name, 31) return PLUGIN_HANDLED; } if (cs_get_user_money(id) >= 5000 ){ get_user_name(id, name, 31) set_user_gravity(id, 0.4) cs_set_user_money(id , cs_get_user_money(id) - 5000, 0) } } case 3 :{ if (!is_user_alive(id)){ get_user_name(id, name, 31) return PLUGIN_HANDLED; } if (cs_get_user_money(id) >= 8000 ){ get_user_name(id, name, 31) skoki[id] = 2; cs_set_user_money(id , cs_get_user_money(id) - 8000, 0) } return PLUGIN_HANDLED; } public Event_Change_Weapon(id){ if(speed[id] == 1){ set_user_maxspeed(id, 650.0) } public Fwd_PlayerSpawn_Post(id){ if (is_user_alive(id)){ if(!speed[id]){ speed[id] = 0; } public CmdStart(id, uc_handle){ if(!is_user_alive(id)) return FMRES_IGNORED; new flags = pev(id, pev_flags); if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && skoki[id]) { --skoki[id]; new Float:velocity[3]; pev(id, pev_velocity,velocity); velocity[2] = random_float(265.0,285.0); set_pev(id, pev_velocity,velocity); } else if(flags & FL_ONGROUND) skoki[id] = 2; return FMRES_IGNORED; } public client_putinserver(id){ skoki[id]=0; speed[id]=0; } public round_begin(){ new maxpl = get_maxplayers() +1; for(new i=1; i < maxpl; ++i){ speed[i]=0; skoki[i]=0; } }
StoDwaJeden
15.02.2016
Trzymaj:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #include <hamsandwich> #include <cstrike> #include <fun> #include <fakemeta> #include <engine> #define PLUGIN "Sklep 1.0" #define VERSION "1.0" #define AUTHOR "Christopher" new name[32]; new speed[33]; new skoki[33]; public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /sklep", "sklep") register_event( "CurWeapon", "Event_Change_Weapon", "be", "1=1" ); RegisterHam(Ham_Spawn, "player", "Fwd_PlayerSpawn_Post", 1) register_event("RoundTime","round_begin","bc"); register_forward(FM_CmdStart, "CmdStart"); } public sklepv1(id) { new menu = menu_create("\wSklep 1.0 \r By Christopher","menu") menu_additem(menu,"\ySpeed /w[Zwieksza Predkosc] \d[5000$]","1",0) menu_additem(menu,"\yGrawitacja \w[Zwieksza Grawitacje] \d[5000$]","2",0) menu_additem(menu,"\y+2 Skoki \w[Dostajesz dodatkowy skok] \d[8000$]","3",0) menu_setprop(menu,MPROP_EXIT,MEXIT_ALL) menu_display(id,menu,0) } public menu(id, menu, item){ if(item==MENU_EXIT) { menu_destroy(menu) return PLUGIN_HANDLED; } new data[6] new key = str_to_num(data) switch(key) { case 1 :{ if (!is_user_alive(id)){ get_user_name(id, name, 31) return PLUGIN_HANDLED; } if (cs_get_user_money(id) >= 5000 ){ get_user_name(id, name, 31) speed[id] = 1; set_user_maxspeed(id, 650.0) cs_set_user_money(id , cs_get_user_money(id) - 5000, 0) } } case 2 : { if (!is_user_alive(id)){ get_user_name(id, name, 31) return PLUGIN_HANDLED; } if (cs_get_user_money(id) >= 5000 ){ get_user_name(id, name, 31) set_user_gravity(id, 0.4) cs_set_user_money(id , cs_get_user_money(id) - 5000, 0) } } case 3 :{ if (!is_user_alive(id)){ get_user_name(id, name, 31) return PLUGIN_HANDLED; } if (cs_get_user_money(id) >= 8000 ){ skoki[id] = 2; cs_set_user_money(id , cs_get_user_money(id) - 8000, 0) } return PLUGIN_HANDLED; } } return PLUGIN_HANDLED; } public Event_Change_Weapon(id){ if(speed[id] == 1){ set_user_maxspeed(id, 650.0) } } public Fwd_PlayerSpawn_Post(id){ if (is_user_alive(id)){ if(!speed[id]){ speed[id] = 0; } } } public CmdStart(id, uc_handle){ if(!is_user_alive(id)) return FMRES_IGNORED; new flags = pev(id, pev_flags); if((get_uc(uc_handle, UC_Buttons) & IN_JUMP) && !(flags & FL_ONGROUND) && !(pev(id, pev_oldbuttons) & IN_JUMP) && skoki[id]) { --skoki[id]; new Float:velocity[3]; pev(id, pev_velocity,velocity); velocity[2] = random_float(265.0,285.0); set_pev(id, pev_velocity,velocity); } else if(flags & FL_ONGROUND) skoki[id] = 2; return FMRES_IGNORED; } public client_putinserver(id){ skoki[id]=0; speed[id]=0; } public round_begin(){ new maxpl = get_maxplayers() +1; for(new i=1; i < maxpl; ++i){ speed[i]=0; skoki[i]=0; } }
Nie domykasz klamerek {}
public Fwd_PlayerSpawn_Post(id){ if (is_user_alive(id)){ if(!speed[id]){ speed[id] = 0; } } }
if(!speed[id]){
speed[id] = 0;
}
Po co ustawiać komuś speed[id] na 0 skoro i tak ma 0?
if (!is_user_alive(id)){ get_user_name(id, name, 31) return PLUGIN_HANDLED; }
Pobierasz nick gracza gdy gracz jest martwy, bądź nie ma go na serwerze i nic z nim nie robisz.
W ogóle nic z pobranym nickiem jak na razie nie robisz.
new data[6] new key = str_to_num(data)
Zawsze Ci wyjdzie 0, poszukaj sobie na amxx jak pobrać info z itemu wybranego w menu.
Użytkownik StoDwaJeden edytował ten post 15.02.2016 23:50
KtosNieznany
16.02.2016
Dzięki, co do nicku to próbowałem zrobić info gdy jest martwy, że kupić nie może ale wywaliłem bo myślałem, że to wina tego lecz okazało się inaczej
DarkGL
16.02.2016
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.