Raised This Month: $ Target: $400
 0% 

mho_mod [status: beta testing]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gzus
Member
Join Date: Jan 2007
Old 02-19-2007 , 15:45   mho_mod [status: beta testing]
Reply With Quote #1

man... im ready to just smash my damn computer and be done with this crap cause its drivin up a wall.. i've spent more than a week tryin to figure out this damn menu problem.. every freakin time i think i got it, it messes up again.. if anyone actually cares to help me out with this, i'll give u more than the credit u deserve..

my problem: When users select a race, it does NOT set the race.. most of the other stuff seems to work just fine, but users can not select races, well they can, but it reads as Nothing when ever they do select a race.. I think if anyone helps me fix this, im going to leave it alone for awhile.. I'd like someone to help optimize it as well, cause once the menu works properly again, im going to add a type of shop menu, then hopefully submit it as a new plugin.. but it needs some good ole T.L.C. but apperently im not lovin it right

the zip file contains the alien model used int he plugin, i think most scripters should have the rest..

the console will display crap loads of debug info which should help u determine where the problem is..

CONSOLE:

--MHO MOD-- KEY 3 SELECTED - Machine for: Al AuthId: STEAM_0:0:8861339
--MHO MOD-- [SAVED Choosen] Race for: Al AuthId: STEAM_0:0:8861339 as 4
--MHO MOD-- Loaded XP for: Machine
--MHO MOD-- [SHOWING HUD] for: Al ---- [Nothing] Level: 0 XP: 0

im assuming the problem is within the loadxp function, but ive tried making so many changes i cant even start to think about it anymore, its driving me nuts!!!!!!!!!!!!


__________________________
UPDATED SOURCE - 2-23-07
Attached Files
File Type: zip alien4.zip (510.0 KB, 87 views)
File Type: sma Get Plugin or Get Source (mho_mod.sma - 725 views - 41.0 KB)
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com

Last edited by gzus; 02-27-2007 at 10:17. Reason: updating
gzus is offline
SpikeyHair
BANNED
Join Date: Feb 2007
Old 02-21-2007 , 08:12   Re: mho_mod needs help
Reply With Quote #2

u got everything right?
SpikeyHair is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 02-21-2007 , 08:58   Re: mho_mod needs help
Reply With Quote #3

I changed a few things with the plugin.
Test this:
Attached Files
File Type: sma Get Plugin or Get Source (mhomod.sma - 765 views - 34.0 KB)
mateo10 is offline
gzus
Member
Join Date: Jan 2007
Old 02-21-2007 , 10:26   Re: mho_mod needs help
Reply With Quote #4

i got the majority of the problems fixed, however i am no good with menus man.. i dont know what it is, i jus mess up every menu i touch.. i had thought it was the race menu itself that was causing the problems with not registering their race/and causing some fault in the loading of the users xp.. after re-doing my loadxp function, i found that was my problem..

i had a bunch of if statements asking what the lastchosen race was, then attemtping to load the xp of the last race, if there was no previous xp, the race woul dbe reset to 0, with 0 lvl and xp. this cleared that up:

Code:
//------------------------------------------------------------------------------------------- public LoadXP(id)     {         new szName[32], szAuthId[32]         get_user_name(id, szName, 31)         get_user_authid(id, szAuthId, 31)         new authid[32];         get_user_authid(id,authid,31);                 new vaultkey[64], vaultdata[64];                 format(vaultkey,63,"RACE-%s-last_chosen",authid);         get_vaultdata(vaultkey,vaultdata,63);         PlayerLastClass[id] = str_to_num(vaultdata);         server_print("--MHO MOD-- [Last Selected] - %i: %s AuthId: %s", PlayerLastClass[id], CLASSES[PlayerLastClass[id]], szName, szAuthId)                 if (PlayerLastClass[id] == 0){             PlayerClass[id] = CLASS_NOTHING         }                 if (PlayerLastClass[id] == 1){             PlayerClass[id] = CLASS_MUTANT;         }                 if (PlayerLastClass[id] == 2){             PlayerClass[id] = CLASS_ALIEN;         }                 if (PlayerLastClass[id] == 3){             PlayerClass[id] = CLASS_PREDATOR;         }                 if (PlayerLastClass[id] == 4){             PlayerClass[id] = CLASS_MACHINE;         }                 //format(vaultkey,63,"RACE-%s-class_%s",authid, CLASSES[PlayerClass[id]]);         //get_vaultdata(vaultkey,vaultdata,63);         //PlayerClass[id] = str_to_num(vaultdata);                     format(vaultkey,63,"RACE-%s-xp_%s",authid, CLASSES[PlayerClass[id]]);         get_vaultdata(vaultkey,vaultdata,63);         PlayerXP[id] = str_to_num(vaultdata);                       format(vaultkey,63,"RACE-%s-level_%s",authid, CLASSES[PlayerClass[id]]);         get_vaultdata(vaultkey,vaultdata,63);         PlayerLevel[id] = str_to_num(vaultdata);         server_print("--MHO MOD-- [Loaded %s XP] - %s AuthId: %s", CLASSES[PlayerClass[id]], szName, szAuthId)                                     return PLUGIN_HANDLED } //------------------------------------------------------------------------------------------- public SaveXP(id)     {     new szName[32], szAuthId[32]     get_user_name(id, szName, 31)     get_user_authid(id, szAuthId, 31)     new authid[32];     get_user_authid(id,authid,31);     new vaultkey[64], vaultdata[64];         //format(vaultkey,63,"RACE-%s-class_%s",authid, CLASSES[PlayerClass[id]]);     //format(vaultdata,63,"%d",PlayerClass[id]);     //set_vaultdata(vaultkey,vaultdata);     //PlayerClass[id] = str_to_num(vaultdata);                 format(vaultkey,63,"RACE-%s-xp_%s",authid, CLASSES[PlayerLastClass[id]]);     format(vaultdata,63,"%d",PlayerXP[id]);     set_vaultdata(vaultkey,vaultdata);     //PlayerXP[id] = str_to_num(vaultdata);                   format(vaultkey,63,"RACE-%s-level_%s",authid, CLASSES[PlayerLastClass[id]]);     format(vaultdata,63,"%d",PlayerLevel[id]);       set_vaultdata(vaultkey,vaultdata);     PlayerLevel[id] = str_to_num(vaultdata);     //server_print("--MHO MOD-- [Saved %s XP] - %s AuthId: %s", CLASSES[PlayerClass[id]], szName, szAuthId) } //-------------------------------------------------------------------------------------------

that cleared a number of lines off, and helped organize things a little more cleanly, but that still doesnt help with the ghetto shop-menu.. throught out today. ill be creating a new menu for the shop.. i did learn how to charge users money and all that, so i think it should be fairly easy.. but then again, menus dislike me.. [shrugs] hopefully by friday i'll have a copy ready for review so everyone can flame me for trying to release a plugin heh

thanks for the reply guys
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com
gzus is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 02-21-2007 , 12:31   Re: mho_mod needs help
Reply With Quote #5

A tip is to use switch statements.
ex:
Code:
switch(key) {     case 0:     {         client_print(id, print_chat, "You have pressed key number 1");         dosomething(id);     }     case 1:     {         client_print(id, print_chat, "You have pressed key number 2");         dosomething(id);     }     case 2:     {         //etc..     } }
mateo10 is offline
gzus
Member
Join Date: Jan 2007
Old 02-21-2007 , 14:41   Re: mho_mod needs help
Reply With Quote #6

do u know if they would not approve a plugin for something like that? i havent really read into it yet, before i do im trying to get everything working, the specials are coming along pretty well.. i've added a set_task delaying the use of the special for a set time period and such, im actually having a productive day

id like to stray from the switch statements since ive used if statements for over 15 years now, starting with vb, php and such, its just my style heh

but maybe i'll give it a try with these menus since i've having so much trouble with them.

//------- edited:
Oh yea!! Does anyone know where i can find info on displaying an image on the users HUD, like for example the images used for WAR3 when ur special is ready? id like to do that with mine as well.
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com

Last edited by gzus; 02-21-2007 at 14:43.
gzus is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 02-21-2007 , 14:53   Re: mho_mod needs help [HUD DIsplay]
Reply With Quote #7

If you want approval I would recommend using switch statements and pcvars.
mateo10 is offline
gzus
Member
Join Date: Jan 2007
Old 02-21-2007 , 15:09   Re: mho_mod needs help [HUD DIsplay]
Reply With Quote #8

ok ill be checking into that soon, thanks
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com
gzus is offline
gzus
Member
Join Date: Jan 2007
Old 02-22-2007 , 11:13   Re: mho_mod needs help [Money Issue]
Reply With Quote #9

Code:
public MHOShopMenu( id )     {     new szMenuBody[256]     new keys         new nLen = format( szMenuBody, 255, "\yMHO Shop:^n" )         nLen += format( szMenuBody[nLen], 255-nLen, "^n\w1. Low Grav - $500" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. MHO_Cloak - $6000" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w3. Silent Steps - $3000" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w4. Extra Speed  - $4000" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w5. 300 HP - $5000" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w6. NVG - $500" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w7. 1 Respawn - $3000" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w8. Unlimited Ammo - $4000" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n\w9. Ninth Option" )     nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\w0. Exit" )         keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)         show_menu( id, keys, szMenuBody, -1 )         return PLUGIN_CONTINUE } public MenuShopCommand( id, key )     {     new PlayersMoney[33]     PlayersMoney[id] = cs_get_user_money(id)     client_print( id, print_console, "[AMX] Key=%d", key )     client_print( id, print_chat, "[AMX] Key=%d", key )         switch( key )     {         case 0: {             client_print( id, print_chat, "Menu Option #1 [Low Gravity]" )             if (cs_get_user_money(id) >= 500){                 PlayersMoney[id] -= 500                 cs_set_user_money(id, PlayersMoney[id], 1)                 set_user_gravity(id, 0.4)                 server_print("--MHO MOD-- [MHO_Shop] - Baught Low Gravity",0.01)             }         }         case 1: {             client_print( id, print_chat, "Menu Option #2 [MHO_Cloak]" )             if (cs_get_user_money(id) >= 6000){                 PlayersMoney[id] -= 6000                 cs_set_user_money(id, PlayersMoney[id], 1)                 setInvisibility(id, 0)                 server_print("--MHO MOD-- [MHO_Shop] - Baught MHO_Cloak",0.01)             }         }         case 2: {             client_print( id, print_chat, "Menu Option #3 [Silent Steps]" )             if (cs_get_user_money(id) >= 3000){                 PlayersMoney[id] -= 3000                 cs_set_user_money(id, PlayersMoney[id], 1)                 set_user_footsteps(id, 1)                 server_print("--MHO MOD-- [MHO_Shop] - Baught Silent Steps",0.01)             }         }         case 3: {             client_print( id, print_chat, "Menu Option #4 [Extra Speed]" )             if (cs_get_user_money(id) >= 4000){                 PlayersMoney[id] -= 4000                 cs_set_user_money(id, PlayersMoney[id], 1)                 MHO_Shop_Speed[id] = 900                 set_user_maxspeed(id, float(MHO_Shop_Speed[id]))                 server_print("--MHO MOD-- [MHO_Shop] - Baught Extra Speed",0.01)             }         }         case 4: {             client_print( id, print_chat, "Menu Option #5 [300 HP]" )             if (cs_get_user_money(id) >= 5000){                 PlayersMoney[id] -= 5000                 cs_set_user_money(id, PlayersMoney[id], 1)                 set_user_health(id, 300)                 server_print("--MHO MOD-- [MHO_Shop] - Baught 300 HP",0.01)             }         }         case 5: {             client_print( id, print_chat, "Menu Option #6 [NVG]" )             if (cs_get_user_money(id) >= 500){                 PlayersMoney[id] -= 500                 if (!cs_get_user_nvg(id))                     {                     cs_set_user_money(id, PlayersMoney[id], 1)                     cs_set_user_nvg(id, 1)                     server_print("--MHO MOD-- [MHO_Shop] - Baught NVG",0.01)                     } else {                     server_print("--MHO MOD-- [MHO_Shop] - You Already have NVG.",0.01)                 }             }         }         case 6: {             client_print( id, print_chat, "Menu Option #7 [1 Respawn]" )             if (cs_get_user_money(id) >= 3000){                 PlayersMoney[id] -= 3000                 ++Respawns[id]                 server_print("--MHO MOD-- [MHO_Shop] - Baught 1 Respawn Total: %i",Respawns[id])             }         }         case 7: {             client_print( id, print_chat, "Menu Option #8" )             if (cs_get_user_money(id) >= 4000){                 PlayersMoney[id] -= 4000                 cs_set_user_money(id, PlayersMoney[id], 1)                 MHO_Unl_Amm[id] = 1                 server_print("--MHO MOD-- [MHO_Shop] - Baught Unlimited Ammo", 0.01)             }         }         case 8: {             client_print( id, print_chat, "Menu Option #9" )         }         case 9: {             client_print( id, print_chat, "Menu Option EXIT" )         }     }         return PLUGIN_HANDLED }

does anyone see why options 1-6 work, and 7 and 8 do not? i honestly dont get it, the first few will charge the user money, but the last two will not, im baffled.
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com
gzus is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 02-22-2007 , 12:06   Re: mho_mod needs help [Money Issue]
Reply With Quote #10

For the first thing you shouldn't do PlayersMoney as an array. Do this instead:
Code:
new PlayersMoney = cs_get_user_money(id)
For the second, do:
Code:
cs_set_user_money(id, PlayersMoney - amount)
instead of:
Code:
PlayersMoney -= amount cs_set_user_money(id, amount)

Hope that helped you.
mateo10 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:45.


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