Kod:
#include <amxmodx>
#include <engine>
#include <reapi>
#define PLUGIN "Yetenek_Menu"
#define VERSION "1.0"
#define AUTHOR "By.KinG"
new const TAG[] = "WebDiyo GaminG";
new Secili_Yetenek[33];
new bool: Cift_Ziplama[33];
new bool: Parasut[33];
new jumpnum[33] = 0;
new bool:dojump[33] = false;
new para_ent[33];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
register_clcmd("say /yetenek", "Yetenek_Menu");
RegisterHookChain(RG_CBasePlayer_Spawn, "CBasePlayer_Spawn", .post = true);
}
public Yetenek_Menu(id)
{
static Item[128], Text[33];
switch(Secili_Yetenek[id])
{
case 1 :
{
formatex(Text, 32, "+40 Can");
}
case 2 :
{
formatex(Text, 32, "Hizli Kosma");
}
case 3 :
{
formatex(Text, 32, "Yuksek Ziplama");
}
case 4 :
{
formatex(Text, 32, "Cift Ziplama");
}
case 5 :
{
formatex(Text, 32, "Parasut");
}
default :
{
formatex(Text, 32, "Secili Yetenek Yok");
}
}
formatex(Item, charsmax(Item), "\d[\r%s\d] \w| \yYetenek Menu \d[\ySu Anki Yetenegin \w: \r%s\d]", TAG, Text);
new Menu = menu_create(Item, "Yetenek_Menu_Handler");
formatex(Item, charsmax(Item), "\y+40 Can");
menu_additem(Menu, Item, "1");
formatex(Item, charsmax(Item), "\yHizli Kosma [1.3x Hiz]");
menu_additem(Menu, Item, "2");
formatex(Item, charsmax(Item), "\yYuksek Ziplama [500 Gravity]");
menu_additem(Menu, Item, "3");
formatex(Item, charsmax(Item), "\yCift Ziplama");
menu_additem(Menu, Item, "4");
formatex(Item, charsmax(Item), "\yParasut");
menu_additem(Menu, Item, "5");
formatex(Item, charsmax(Item), "\yYetenek Yok");
menu_additem(Menu, Item, "6");
menu_setprop(Menu, MPROP_BACKNAME, "\wGeri");
menu_setprop(Menu, MPROP_NEXTNAME, "\wIleri");
menu_setprop(Menu, MPROP_EXITNAME, "\wCikis");
menu_display(id, Menu, 0);
}
public Yetenek_Menu_Handler(id, Menu, Item)
{
if(Item == MENU_EXIT)
{
menu_destroy(Menu);
return PLUGIN_HANDLED;
}
new Data[6], Name[64];
new Access, CallBack;
menu_item_getinfo(Menu, Item, Access, Data, 5, Name, 63, CallBack);
new Key = str_to_num(Data);
switch(Key)
{
case 1 :
{
Secili_Yetenek[id] = 1;
Renkli_Yazi(id, "^1[^3%s^1] ^4Yetenek Olarak ^3+40 Can ^4Aldin", TAG);
Renkli_Yazi(id, "^1[^3%s^1] ^4Yeniden ^3Dogdugunda ^4Ozelligin ^3Aktif ^4Olacak", TAG);
}
case 2 :
{
Secili_Yetenek[id] = 2;
Renkli_Yazi(id, "^1[^3%s^1] ^4Yetenek Olarak ^3Hizli Kosma ^4Aldin", TAG);
Renkli_Yazi(id, "^1[^3%s^1] ^4Yeniden ^3Dogdugunda ^4Ozelligin ^3Aktif ^4Olacak", TAG);
}
case 3 :
{
Secili_Yetenek[id] = 3;
Renkli_Yazi(id, "^1[^3%s^1] ^4Yetenek Olarak ^3Yuksek Ziplama ^4Aldin", TAG);
Renkli_Yazi(id, "^1[^3%s^1] ^4Yeniden ^3Dogdugunda ^4Ozelligin ^3Aktif ^4Olacak", TAG);
}
case 4 :
{
Secili_Yetenek[id] = 4;
Renkli_Yazi(id, "^1[^3%s^1] ^4Yetenek Olarak ^3Cift Ziplama ^4Aldin", TAG);
Renkli_Yazi(id, "^1[^3%s^1] ^4Yeniden ^3Dogdugunda ^4Ozelligin ^3Aktif ^4Olacak", TAG);
}
case 5 :
{
Secili_Yetenek[id] = 5;
Renkli_Yazi(id, "^1[^3%s^1] ^4Yetenek Olarak ^3Parasut ^4Aldin", TAG);
Renkli_Yazi(id, "^1[^3%s^1] ^4Yeniden ^3Dogdugunda ^4Ozelligin ^3Aktif ^4Olacak", TAG);
}
case 6 :
{
Secili_Yetenek[id] = 6;
Renkli_Yazi(id, "^1[^3%s^1] ^4Sahip Oldugun Yetenekleri ^3Kaybettin", TAG);
}
}
return PLUGIN_HANDLED;
}
public CBasePlayer_Spawn(id)
{
if(para_ent[id] > 0)
{
remove_entity(para_ent[id])
rg_reset_maxspeed(id);
para_ent[id] = 0
}
switch(Secili_Yetenek[id])
{
case 1 :
{
set_entvar(id, var_health, Float: get_entvar(id, var_health) + 40.0);
}
case 2 :
{
set_entvar(id, var_maxspeed, Float: 1.3);
}
case 3 :
{
set_entvar(id, var_gravity, Float: 0.5);
}
case 4 :
{
Cift_Ziplama[id] = true;
}
case 5 :
{
Parasut[id] = true;
}
}
}
public client_PreThink(id)
{
if(!is_user_alive(id)) return PLUGIN_CONTINUE
if(!Cift_Ziplama[id]) return PLUGIN_CONTINUE
new Float:fallspeed = 100 * -1.0
new Float:frame
new button = get_user_button(id)
new oldbutton = get_user_oldbutton(id)
new flags = get_entity_flags(id)
if(para_ent[id] > 0 && (flags & FL_ONGROUND))
{
if(get_entvar(id, var_gravity) == 0.1) rg_reset_maxspeed(id)
{
if(entity_get_int(para_ent[id],EV_INT_sequence) != 2)
{
entity_set_int(para_ent[id], EV_INT_sequence, 2)
entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
entity_set_float(para_ent[id], EV_FL_framerate, 0.0)
return PLUGIN_CONTINUE;
}
frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 2.0
entity_set_float(para_ent[id],EV_FL_fuser1,frame)
entity_set_float(para_ent[id],EV_FL_frame,frame)
if(frame > 254.0)
{
remove_entity(para_ent[id])
para_ent[id] = 0
}
else
{
remove_entity(para_ent[id])
rg_reset_maxspeed(id)
para_ent[id] = 0
}
return PLUGIN_CONTINUE;
}
}
if (button & IN_USE)
{
new Float:velocity[3]
entity_get_vector(id, EV_VEC_velocity, velocity)
if(velocity[2] < 0.0)
{
if(para_ent[id] <= 0)
{
para_ent[id] = create_entity("info_target")
if(para_ent[id] > 0)
{
entity_set_string(para_ent[id],EV_SZ_classname,"parachute")
entity_set_edict(para_ent[id], EV_ENT_aiment, id)
entity_set_edict(para_ent[id], EV_ENT_owner, id)
entity_set_int(para_ent[id], EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_model(para_ent[id], "models/JailBreaK/Parachute.mdl")
entity_set_int(para_ent[id], EV_INT_sequence, 0)
entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
}
}
if(para_ent[id] > 0)
{
entity_set_int(id, EV_INT_sequence, 3)
entity_set_int(id, EV_INT_gaitsequence, 1)
entity_set_float(id, EV_FL_frame, 1.0)
entity_set_float(id, EV_FL_framerate, 1.0)
set_entvar(id, var_gravity, 0.1)
velocity[2] = (velocity[2] + 40.0 < fallspeed) ? velocity[2] + 40.0 : fallspeed
entity_set_vector(id, EV_VEC_velocity, velocity)
if(entity_get_int(para_ent[id],EV_INT_sequence) == 0)
{
frame = entity_get_float(para_ent[id],EV_FL_fuser1) + 1.0
entity_set_float(para_ent[id],EV_FL_fuser1,frame)
entity_set_float(para_ent[id],EV_FL_frame,frame)
if (frame > 100.0)
{
entity_set_float(para_ent[id], EV_FL_animtime, 0.0)
entity_set_float(para_ent[id], EV_FL_framerate, 0.4)
entity_set_int(para_ent[id], EV_INT_sequence, 1)
entity_set_int(para_ent[id], EV_INT_gaitsequence, 1)
entity_set_float(para_ent[id], EV_FL_frame, 0.0)
entity_set_float(para_ent[id], EV_FL_fuser1, 0.0)
}
}
}
}
else if(para_ent[id] > 0)
{
remove_entity(para_ent[id])
rg_reset_maxspeed(id)
para_ent[id] = 0
}
}
else if((oldbutton & IN_USE) && para_ent[id] > 0 )
{
remove_entity(para_ent[id])
rg_reset_maxspeed(id)
para_ent[id] = 0
}
if((button& IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(oldbutton & IN_JUMP))
{
if(jumpnum[id] < 1)
{
dojump[id] = true
jumpnum[id]++
return PLUGIN_CONTINUE
}
}
if((button& IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
{
jumpnum[id] = 0
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
public client_PostThink(id)
{
if(!is_user_alive(id)) return PLUGIN_CONTINUE
if(!Cift_Ziplama[id]) return PLUGIN_CONTINUE
if(dojump[id] == true)
{
new Float:velocity[3]
entity_get_vector(id,EV_VEC_velocity,velocity)
velocity[2] = random_float(265.0,285.0)
entity_set_vector(id,EV_VEC_velocity,velocity)
dojump[id] = false
return PLUGIN_CONTINUE
}
return PLUGIN_CONTINUE
}
stock Renkli_Yazi(const ID, const input[], any:...)
{
new Count = 1, Players[32];
static Message[191];
vformat(Message, 190, input, 3);
/* ^1 | ^x01 --> Yellow */
/* ^4 | ^x04 --> Green */
/* ^3 | ^x03 --> Team Color */
replace_all(Message, 190, "^1", "^x01");
replace_all(Message, 190, "^4", "^x04");
replace_all(Message, 190, "^3", "^x03");
switch(AMXX_VERSION_NUM)
{
case 182 :
{
if(ID) Players[0] = ID; else get_players(Players, Count, "ch");
{
for(new i = 0; i < Count; i++)
{
if(is_user_connected(Players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, Players[i]);
write_byte(Players[i]);
write_string(Message);
message_end();
}
}
}
}
case 183 :
{
client_print_color(ID, ID, Message);
}
default :
{
client_print(ID, print_chat, Message);
}
}
}