AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Could someone pleaseeeeeeeeee tell me whats wrong with this? (https://forums.alliedmods.net/showthread.php?t=10378)

Stealth Penguin 02-17-2005 17:22

Could someone pleaseeeeeeeeee tell me whats wrong with this?
 
This is part of my plugin and the whole thing compiles fine with no errors but won't do anything when I use it in my menu in game... the menu part functions perfectly but I can't seem to get this set_user_godmode command to work correctly (and yes I have all the includes).
Please check it over for me? Any advice would be greatly appreciated.
Code:
public TGOMenuCommand(id,key) {     new player = g_menuPlayers[id][g_nTGOMenuPosition[id] * 7 + key]     switch (key)     {         case 8: ShowTGOMenu(id,++g_nTGOMenuPosition[id])         case 9: ShowTGOMenu(id,--g_nTGOMenuPosition[id])         default: set_user_godmode(player, 1 )     }     server_exec()     ShowTGOMenu(id,g_nTGOMenuPosition[id])     return PLUGIN_HANDLED }

XxAvalanchexX 02-17-2005 18:08

DEBUG!

Do many console prints at many different break points with all the values up to that point.

philman213 02-17-2005 18:23

Re: Could someone pleaseeeeeeeeee tell me whats wrong with t
 
Quote:

Originally Posted by Stealth Penguin
This is part of my plugin and the whole thing compiles fine with no errors but won't do anything when I use it in my menu in game... the menu part functions perfectly but I can't seem to get this set_user_godmode command to work correctly (and yes I have all the includes).
Please check it over for me? Any advice would be greatly appreciated.
Code:
public TGOMenuCommand(id,key) {     new player = g_menuPlayers[id][g_nTGOMenuPosition[id] * 7 + key]     switch (key)     {         case 8: ShowTGOMenu(id,++g_nTGOMenuPosition[id])         case 9: ShowTGOMenu(id,--g_nTGOMenuPosition[id])         default: set_user_godmode(player, 1 )     }     server_exec()     ShowTGOMenu(id,g_nTGOMenuPosition[id])     return PLUGIN_HANDLED }

Put quotes around the 1:
Code:

default: set_user_godmode(player,"1")
Make sure the plugin is enabled in your plugins.ini

Stealth Penguin 02-17-2005 19:14

when I put the quotes around the 1 it doesn't compile correctly

XxAvalanchexX 02-17-2005 21:49

philman, what kind of crappy advice are you giving out? Don't tell people to do things such as use a string value where an integer is required.

Stealth Penguin 02-18-2005 16:01

Thank you very much for your replies XxAvalanchexX. I'm greatful to have caught someones ear :-). Could you show me an example of how I would use console_print to return values to me? All I found in the documentation was console_print ( id, const message[], ... ) and I don't seem to have much luck setting function parameters :-/ I'm going to see if I can get it to work myself but if you could show me an example of how to do it properly I would be forever indebted to you.

XxAvalanchexX 02-18-2005 18:12

Code:
public TGOMenuCommand(id,key) {     new player = g_menuPlayers[id][g_nTGOMenuPosition[id] * 7 + key]     console_print(id,"PRE: key: %i - player: %i - menupos: %i",key,player,g_nTGOMenuPosition[id]);     switch (key)     {         case 8: ShowTGOMenu(id,++g_nTGOMenuPosition[id])         case 9: ShowTGOMenu(id,--g_nTGOMenuPosition[id])         default: set_user_godmode(player, 1 )     }     console_print(id,"POST: key: %i - player: %i - menupos: %i",key,player,g_nTGOMenuPosition[id]);     server_exec()     ShowTGOMenu(id,g_nTGOMenuPosition[id])     return PLUGIN_HANDLED }

Stealth Penguin 02-18-2005 19:54

Hmm, when I tried that it compiled fine and I like how you got rid of the extra code but it doesn't do anything more than before. Any ideas of what might be going wrong?

XxAvalanchexX 02-18-2005 21:28

It isn't supposed to do anything else than before. Check the data in the console that it printed out (with console_print) and see if it matches what it should be.

Stealth Penguin 02-19-2005 10:04

what I meant is that it doesn't print anything to the console on either the server console or my console when I'm doing a dedicated server or to my console when I'm running a listen server.


All times are GMT -4. The time now is 19:23.

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