AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Upgrade Mod help plz (https://forums.alliedmods.net/showthread.php?t=28251)

SweatyBanana 05-10-2006 19:18

Upgrade Mod help plz
 
NEED MEGA HELP!!..Look at my bottom help with native errors...

Des12 05-10-2006 20:10

Re: Upgrade Mod help :) (With menus :))
 
Quote:

Originally Posted by SweatyBanana
Code:
stTime = register_cvar("stuck_time", "5")     stAmount = register_cvar("stuck_amount", "1")     AnTime = register_cvar("anounce_time","45")

Wouldnt you want to use

Code:
 register_cvar("stuck_time", "5");     register_cvar("stuck_amount", "1");     register_cvar("anounce_time","45");    // later on...    stTime = get_cvar_num("stuck_time");     stAmount = get_cvar_num("stuck_amount");     AnTime = get_cvar_num("anounce_time");

FatalisDK 05-10-2006 20:42

There is no need to do all those set_tasks. You can just do this:

Code:
case '1': {     cmd_stuck(id) } case '2': {     foot_steps(id) } //etc

SweatyBanana 05-10-2006 21:46

Look to bottom...

SweatyBanana 05-10-2006 22:20

EDIT: NEW PROBLEM...NEXT POST

SweatyBanana 05-10-2006 22:40

Ok...Im getting a native error in this function...It says its trying set the server solid instead of the player...how can I fix that??:

Code:
public unclip(id) {     entity_set_int(id, EV_INT_solid, SOLID_BBOX) }


anyone tell me what Im doing wrong??

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #include <engine> #define PLUGIN "Upgrades Mod" #define VERSION "1.0" #define AUTHOR "SweatyBanana" new stuck[33]; new g_Menu public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_cvar("stuck_time", "5")     register_cvar("stuck_amount", "1")     register_cvar("anounce_time","30")         set_task(20.0,"advertise");         register_clcmd("say /upgrades", "Menu_Command")     register_clcmd("say_team /upgrades", "Menu_Command")             g_Menu = menu_create("Upgrade Mod", "Menu_Handle")       menu_additem(g_Menu, "Temporary Semi-Clip", "1")       menu_additem(g_Menu, "Silent footsteps", "2")       menu_additem(g_Menu, "Raise armor and Health", "3")       menu_additem(g_Menu, "Low Gravity", "4")       menu_additem(g_Menu, "Faster Speed", "5")       menu_additem(g_Menu, "reserved", "6")       menu_additem(g_Menu, "reserved", "7")         register_logevent("round_start", 2, "0=World triggered", "1=Round_Start"); } public Menu_Command(id) {     menu_display(id, g_Menu, 0)           return PLUGIN_HANDLED } public Menu_Handle(id, Menu, Item) {       new szCommand[3],  Accesss, Callback           menu_item_getinfo(Menu, Item, Accesss, szCommand, 2, _, _, Callback)           switch(szCommand[0])     {         case '-':         {             return PLUGIN_HANDLED         }                   case '1':         {             cmd_stuck(id)         }                   case '2':         {             foot_steps(id)         }                     case '3':         {             armor_hp(id)         }                   case '4':         {             gravity(id)         }                   case '5':         {             fast_speed(id)         }                   case '6':         {             foot_steps(id)         }                   case '7':         {             foot_steps(id)         }     }           return PLUGIN_HANDLED } public advertise() {     client_print(0,print_chat,"[UPGRADE] say /upgrades to show the upgrade menu.")     set_task(get_cvar_float("anounce_time"),"advertise")     return PLUGIN_HANDLED } public foot_steps(id) {     set_user_footsteps (id, 1) } public armor_hp(id) {     cs_set_user_armor (id, 200, CsArmorType:2)     set_user_health(id, 125) } public gravity(id) {     set_user_gravity (id, 0.25) } public fast_speed(id) {     new Float:speed = get_user_maxspeed(id) + 140.0;     set_user_maxspeed(id , speed); } public round_start() {     for(new id = 1; id <= 32; id++)        stuck[id] = 0; } public cmd_stuck(id) {     new Time = get_cvar_num("stuck_time");     new stuckamount = get_cvar_num("stuck_amount");         if(!is_user_alive(id))     {         client_print(id, print_chat, "[STUCK] you can only use the stuck option if you are alive!")         return PLUGIN_HANDLED;     }         if(stuck[id] >= stuckamount)     {         client_print(id , print_chat , "[AMXX] You can only do that command %i times a round", stuckamount);         return PLUGIN_HANDLED;     }         else     {         entity_set_int(id, EV_INT_solid, SOLID_TRIGGER)         stuck[id]++;         set_task(get_cvar_float("stuck_time"),"unclip")         client_print(id, print_chat, "[UPGRADE] You have %i second(s) until becoming solid again.", Time);     }     return PLUGIN_HANDLED; } public unclip(id) {     entity_set_int(id, EV_INT_solid, SOLID_BBOX) }

SubStream 05-10-2006 22:55

change
Code:
set_task(get_cvar_float("stuck_time"),"unclip")
to
Code:
set_task(get_cvar_float("stuck_time"),"unclip",id)

SweatyBanana 05-10-2006 22:59

1 Attachment(s)
Ill test it out...

SubStream 05-10-2006 22:59

Hopefully that will fix the problem because that is necessary to set the task for that specific person.

SweatyBanana 05-10-2006 23:27

I hope this will work...Heres my almost final code...

Tell me if I did anything wrong..

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #include <engine> #define PLUGIN "Upgrades Mod" #define VERSION "1.0" #define AUTHOR "SweatyBanana" new stuck[33]; new g_Menu public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_cvar("stuck_time", "5")     register_cvar("stuck_amount", "1")     register_cvar("anounce_time","30")     register_cvar("cost","7000")         set_task(20.0,"advertise");         register_clcmd("say /buymenu", "Menu_Command")     register_clcmd("say_team /buymenu", "Menu_Command")             g_Menu = menu_create("Upgrade Mod", "Menu_Handle")     menu_additem(g_Menu, "Temporary Semi-Clip", "1")     menu_additem(g_Menu, "Silent footsteps", "2")     menu_additem(g_Menu, "Raise armor and Health", "3")     menu_additem(g_Menu, "Low Gravity", "4")     menu_additem(g_Menu, "Faster Speed", "5")     menu_additem(g_Menu, "reserved", "6")     menu_additem(g_Menu, "reserved", "7")         register_logevent("round_start", 2, "0=World triggered", "1=Round_Start"); } public Menu_Command(id) {     menu_display(id, g_Menu, 0)           return PLUGIN_HANDLED } public Menu_Handle(id, Menu, Item) {       new szCommand[3],  Accesss, Callback           menu_item_getinfo(Menu, Item, Accesss, szCommand, 2, _, _, Callback)           switch(szCommand[0])     {         case '-':         {             return PLUGIN_HANDLED         }                   case '1':         {             cmd_stuck(id)         }                   case '2':         {             foot_steps(id)         }                     case '3':         {             armor_hp(id)         }                   case '4':         {             gravity(id)         }                   case '5':         {             fast_speed(id)         }                   case '6':         {             reserved(id)         }                   case '7':         {             reserved(id)         }     }           return PLUGIN_HANDLED } public advertise() {     client_print(0,print_chat,"[UM] say /buymenu to show the upgrade menu.")     set_task(get_cvar_float("anounce_time"),"advertise")     return PLUGIN_HANDLED } public foot_steps(id) {     if(cs_get_user_money(id) >= get_cvar_num("cost"))     {         set_user_footsteps (id, 1)     } } public armor_hp(id) {     if(cs_get_user_money(id) >= get_cvar_num("cost"))     {         cs_set_user_armor (id, 200, CsArmorType:2)         set_user_health(id, 125)     } } public gravity(id) {     if(cs_get_user_money(id) >= get_cvar_num("cost"))     {         set_user_gravity (id, 0.25)     } } public fast_speed(id) {     if(cs_get_user_money(id) >= get_cvar_num("cost"))     {         new Float:speed = get_user_maxspeed(id) + 140.0;         set_user_maxspeed(id , speed);     } } public round_start() {     for(new id = 1; id <= 32; id++)        stuck[id] = 0; } public cmd_stuck(id) {     new Time = get_cvar_num("stuck_time");     new stuckamount = get_cvar_num("stuck_amount");         if(!is_user_alive(id))     {         client_print(id, print_chat, "[UM] you can only use the stuck option if you are alive!")         return PLUGIN_HANDLED;     }         if(!(cs_get_user_money(id) >= get_cvar_num("cost")))     {         return PLUGIN_HANDLED;     }         if(stuck[id] >= stuckamount)     {         client_print(id , print_chat , "[UM] You can only do that command %i times a round", stuckamount);         return PLUGIN_HANDLED;     }         else     {         entity_set_int(id, EV_INT_solid, SOLID_TRIGGER)         stuck[id]++;         set_task(get_cvar_float("stuck_time"),"unclip",id)         client_print(id, print_chat, "[UM] You have %i second(s) until becoming solid again.", Time);     }     return PLUGIN_HANDLED; } public unclip(id) {     entity_set_int(id, EV_INT_solid, SOLID_BBOX) } public reserved(id) {     client_print(id, print_chat, "[UM] There is nothing currently in this slot") }


All times are GMT -4. The time now is 04:59.

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