AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do you use set_user_godmode with a menu? (read the doc) (https://forums.alliedmods.net/showthread.php?t=10320)

Stealth Penguin 02-15-2005 16:57

How do you use set_user_godmode with a menu? (read the doc)
 
Hello, my last post may have been to broad so this is a narrowed down one. I have read the documentation and tutorials for amx and amxx over and over and still cannot figure out how to make this certain part of the plugin I'm making work. I can't figure out how to get a command executed on a person who is chosen through a menu. Here is the part of the code that I believe is causing the problem:
Code:
public TGOMenuCommand(id,key) {     new player = g_menuPlayers[id][g_nTGOMenuPosition[id] * 7 + key]     new name[32], name2[32], authid[32],authid2[32]     get_user_name(player,name2,31)     get_user_authid(id,authid,31)     get_user_authid(player,authid2,31)     get_user_name(id,name,31)     new userid2 = get_user_userid(player)         switch (key) {         case 7: {         ++g_menuOption[id]         g_menuOption[id] %= 3       switch(g_menuOption[id])       {       case 0: g_menuSettings[id] = 0       case 1: g_menuSettings[id] = 5       case 2: g_menuSettings[id] = 60       }     ShowTGOMenu(id,g_nTGOMenuPosition[id])     }     case 8: ShowTGOMenu(id,++g_nTGOMenuPosition[id])     case 9: ShowTGOMenu(id,--g_nTGOMenuPosition[id])     default: {     log_amx("GodmodeOther: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")",         name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] )     switch (get_cvar_num("amx_show_activity")) {         case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_2",name,name2)         case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_1",name2)     }              g_menuPlayers[id]         if(get_user_godmode(player, 0 ) == 1)         {         set_user_godmode(player, 1 ) // turn on         }     else         { // if already on         set_user_godmode(player, 0 ) // turn off         }     }     server_exec()     ShowTGOMenu(id,g_nTGOMenuPosition[id])     } }   return PLUGIN_HANDLED }

Any help would be appreciated very much.

Peli 02-15-2005 19:37

Well you should change this :
Code:
if(get_user_godmode(player, 0 ) == 1)         {         set_user_godmode(player, 1 ) // turn on         }     else         { // if already on         set_user_godmode(player, 0 ) // turn off         }
To this :
Code:
if(get_user_godmode(player) != 1) // Checks if godmode isn't on a player {    set_user_godmode(player, 1) // Sets godmode on a player }
That might work... :)

Stealth Penguin 02-15-2005 20:49

That clears the godmode stuff up but I think theres something thats stopping it from compiling correctly, mayhaps some brackets misplaced. Anything obvious that anyone can see that I might have missed?


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

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