AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [solved]How to fix warnings here? (https://forums.alliedmods.net/showthread.php?t=41165)

Xum 07-10-2006 08:53

[solved]How to fix warnings here?
 
Compiles ok, no errors no warnings but when i start server gives me a runtime error 10 from plugin.

What's the problem?


Code:
// Credits to: Gizmo and Rolnaaba #include <amxmodx> #include <amxmisc> new argMessage[256] public plugin_init() {     register_plugin("HUDmsg", "1.0", "Hip_hop_x")         register_event("DeathMsg", "DeathMsg", "a")     register_event("ResetHUD", "startround", "a")         register_cvar("sv_hudmsg", "1", 0)         register_concmd("amx_hudcenter", "cmd_message", ADMIN_CHAT, "message in the center")         register_concmd("amx_hudmsg", "cmd_extrem", ADMIN_ALL, "<message up>")   } public startround(id) {         set_task(0.2, argMessage)     } public cmd_message (id) {         if(!access(id, ADMIN_CHAT))         {                 console_print(id, "[AMXX] You have no access to this command!");                 return PLUGIN_HANDLED         }                     read_args(argMessage, 255)         set_hudmessage(130, 90, 70, -1.0, 0.45, 0, 1.0, 999991.0, 0.1, 0.2, -1)               show_hudmessage(0, argMessage)     return PLUGIN_HANDLED } public cmd_extrem(id) {         if(!access(id, ADMIN_CHAT)) {                 console_print(id, "[AMXX] You have no access to this command!");             return PLUGIN_HANDLED       }                 read_args(argMessage, 255)     set_hudmessage(150, 89, 37, -1.0, 0.10, 0, 1.0, 999991.0, 0.1, 0.2, -1)         show_hudmessage(0, argMessage)         return PLUGIN_HANDLED } public recl(id) {         console_print(id, "[Xu Message] For more plugins vizit xu-share.tk") } public client_connect(id) {     new name[18]     get_user_name(id, name, 17)     if(get_cvar_num("sv_hudmsg") == 1) {         set_hudmessage(190, 30, 0, -1.0, 0.15, 0, 1.0, 7.0, 0.1, 0.2, -1)         show_hudmessage(0, "%s connecting", name)     } } public     client_disconnect(id) {     new name[18]     get_user_name(id, name, 17)         if(get_cvar_num("sv_hudmsg") == 1) {         set_hudmessage(190, 30, 0, -1.0, 0.24, 0, 1.0, 5.0, 0.1, 0.2, -1)         show_hudmessage(0, "%s disconnected", name)     } } public DeathMsg(id){         set_task(0.2, argMessage)         }

Rolnaaba 07-10-2006 09:25

Re: How to fix warnings here?
 
Code:
#include <amxmodx> #include <amxmisc> new argMessage[256]    public plugin_init()  {     register_plugin("HUDmsg", "1.0", "Hip_hop_x")       register_event("DeathMsg", "DeathMsg", "a")     register_cvar("sv_hudmsg", "1", 0)       register_concmd("amx_hudcenter", "cmd_message", ADMIN_CHAT, "message in the center")         register_concmd("amx_hudmsg", "cmd_extrem", ADMIN_ALL, "<message up>")                }      public cmd_message (id) {         if(!access(id, ADMIN_CHAT))         {                 console_print(id, "[AMXX] You have no access to this command!");                 return PLUGIN_HANDLED         }                     read_args(argMessage, 255)         set_hudmessage(130, 90, 70, -1.0, 0.45, 0, 1.0, 999991.0, 0.1, 0.2, -1)               show_hudmessage(0, argMessage)     return PLUGIN_HANDLED     }    public cmd_extrem(id) {         if(!access(id, ADMIN_CHAT)) {                 console_print(id, "[AMXX] You have no access to this command!");             return PLUGIN_HANDLED           }               read_args(argMessage, 255)     set_hudmessage(150, 89, 37, -1.0, 0.10, 0, 1.0, 999991.0, 0.1, 0.2, -1)         show_hudmessage(0, argMessage)         return PLUGIN_HANDLED       }      /*  public recl(id)     {         console_print(id, "[Xu Message] For more plugins vizit xu-share.tk")     }  */  public client_connect(id)  {   new name[18]   get_user_name(id, name, 17)   if(get_cvar_num("sv_hudmsg") == 1) {   set_hudmessage(190, 30, 0, -1.0, 0.15, 0, 1.0, 7.0, 0.1, 0.2, -1)   show_hudmessage(0, "%s connecting", name)  }  } public     client_disconnect(id) {     new name[18]     get_user_name(id, name, 17)         if(get_cvar_num("sv_hudmsg") == 1) {         set_hudmessage(190, 30, 0, -1.0, 0.24, 0, 1.0, 5.0, 0.1, 0.2, -1)         show_hudmessage(0, "%s disconnected", name)     } } public DeathMsg(id){     set_task(0.2, argMessage)         }
all i got was 4 lloose indentation errors when i compiled, so i fixed those here it is, i didnt even look at the code tho just fixed compilation errors

Xum 07-10-2006 11:44

Re: How to fix warnings here?
 
Thx, but here is the part i didn't understand:
Example 1: here i get warning
Code:
  public cmd_warning (id) {         if(!access(id, ADMIN_CHAT))         {                 console_print(id, "[AMXX] You have no access to this command!");                 return PLUGIN_HANDLED         }                     read_args(argMessage, 255)         set_hudmessage(130, 90, 70, -1.0, 0.45, 0, 1.0, 999991.0, 0.1, 0.2, -1)               show_hudmessage(0, argMessage) return PLUGIN_HANDLED }


Example 2: Here i don't get warning (i only moved return PLUGIN_HANDLED a little bit)
[small] public cmd_working (id)
{
if(!access(id, ADMIN_CHAT))
{
console_print(id, "[AMXX] You have no access to this command!");
return PLUGIN_HANDLED
}


read_args(argMessage, 255)
set_hudmessage(130, 90, 70, -1.0, 0.45, 0, 1.0, 999991.0, 0.1, 0.2, -1)
show_hudmessage(0, argMessage)
return PLUGIN_HANDLED
}



Rolnaaba 07-10-2006 11:47

Re: How to fix warnings here?
 
ur getting loose indentation warnings i think, i have to assume cause ur not telling me ur warnings, and it is because you have
Code:
return PLUGIN_HANDLED
all the way to the left, indent it so it is even with the

Code:

    read_args(argMessage, 255)   
    set_hudmessage(130, 90, 70, -1.0, 0.45, 0, 1.0, 999991.0, 0.1, 0.2, -1)         
    show_hudmessage(0, argMessage)

part and it will be fixed

ex:
Code:

read_args(argMessage, 255)
set_hudmessage(130, 90, 70, -1.0, 0.45, 0, 1.0, 999991.0, 0.1, 0.2, -1)
show_hudmessage(0, argMessage)
return PLUGIN_HANDLED


Xum 07-10-2006 11:50

Re: How to fix warnings here?
 
Yes i get lose identitation warnings from return PLUGIN_HANDLED .



Rolnaaba 07-10-2006 11:51

Re: How to fix warnings here?
 
ok edited above post look at it again, it shows you what you need to do

Xum 07-10-2006 11:56

Re: [solved]How to fix warnings here?
 
Yes i understand now. Thank you again :D

Rolnaaba 07-10-2006 11:57

Re: [solved]How to fix warnings here?
 
anytime good luck Xum

Xum 07-10-2006 12:50

Re: [solved]How to fix warnings here?
 
Compiles ok, no errors no warnings but when i start server gives me a runtime error 10 from plugin.

What's the problem?
Code:
// Credits to: Gizmo and Rolnaaba #include <amxmodx> #include <amxmisc> new argMessage[256] public plugin_init() {     register_plugin("HUDmsg", "1.0", "Hip_hop_x")         register_event("DeathMsg", "DeathMsg", "a")     register_event("ResetHUD", "startround", "a")         register_cvar("sv_hudmsg", "1", 0)         register_concmd("amx_hudcenter", "cmd_message", ADMIN_CHAT, "message in the center")         register_concmd("amx_hudmsg", "cmd_extrem", ADMIN_ALL, "<message up>")   } public startround(id) {         set_task(0.2, argMessage)     } public cmd_message (id) {         if(!access(id, ADMIN_CHAT))         {                 console_print(id, "[AMXX] You have no access to this command!");                 return PLUGIN_HANDLED         }                     read_args(argMessage, 255)         set_hudmessage(130, 90, 70, -1.0, 0.45, 0, 1.0, 999991.0, 0.1, 0.2, -1)               show_hudmessage(0, argMessage)     return PLUGIN_HANDLED } public cmd_extrem(id) {         if(!access(id, ADMIN_CHAT)) {                 console_print(id, "[AMXX] You have no access to this command!");             return PLUGIN_HANDLED       }                 read_args(argMessage, 255)     set_hudmessage(150, 89, 37, -1.0, 0.10, 0, 1.0, 999991.0, 0.1, 0.2, -1)         show_hudmessage(0, argMessage)         return PLUGIN_HANDLED } public recl(id) {         console_print(id, "[Xu Message] For more plugins vizit xu-share.tk") } public client_connect(id) {     new name[18]     get_user_name(id, name, 17)     if(get_cvar_num("sv_hudmsg") == 1) {         set_hudmessage(190, 30, 0, -1.0, 0.15, 0, 1.0, 7.0, 0.1, 0.2, -1)         show_hudmessage(0, "%s connecting", name)     } } public     client_disconnect(id) {     new name[18]     get_user_name(id, name, 17)         if(get_cvar_num("sv_hudmsg") == 1) {         set_hudmessage(190, 30, 0, -1.0, 0.24, 0, 1.0, 5.0, 0.1, 0.2, -1)         show_hudmessage(0, "%s disconnected", name)     } } public DeathMsg(id){         set_task(0.2, argMessage)         }

shino 07-10-2006 13:38

Re: [un-solved]How to fix warnings here?
 
I don't quite know, what this plugin is meant to do, description would pe helpful, but... here's the code.
Code:
// Credits to: Gizmo and Rolnaaba #include <amxmodx> #include <amxmisc> new HudString[256],HudText[256] // those will be needed public plugin_init() {     register_plugin("HUDmsg", "1.0", "Hip_hop_x")             register_cvar("sv_hudmsg", "1")     register_cvar("sv_hudmsgtext","whatever you want")             register_concmd("amx_hudcenter", "cmd_message", ADMIN_CHAT, "message in the center")         register_concmd("amx_hudmsg", "cmd_extrem", ADMIN_ALL, "<message up>")         get_cvar_string("sv_hudmsgtext",HudString,255) // gets string from a cvar and binds it to HudString     format(HudText,255,"%s",HudString) // it formats a text from source(HudString) and binds it } public cmd_message (id) {         if(!access(id, ADMIN_CHAT))         {                 console_print(id, "[AMXX] You have no access to this command!");                 return PLUGIN_HANDLED         }                 set_hudmessage(130, 90, 70, -1.0, 0.45, 0, 1.0, 999991.0, 0.1, 0.2, -1)               show_hudmessage(0, "%s",HudText)     // Shows the text from HudText, which gets the text from HudString, which get the text from your cvar     return PLUGIN_HANDLED } public cmd_extrem(id) {         if(!access(id, ADMIN_CHAT)) {                 console_print(id, "[AMXX] You have no access to this command!");             return PLUGIN_HANDLED       }                 set_hudmessage(150, 89, 37, -1.0, 0.10, 0, 1.0, 999991.0, 0.1, 0.2, -1)         show_hudmessage(0, "%s",HudText)     // Shows the text from HudText, which gets the text from HudString, which get the text from your cvar     return PLUGIN_HANDLED } public recl(id) {         console_print(id, "[Xu Message] For more plugins vizit xu-share.tk") } public client_connect(id) {     new name[18]     get_user_name(id, name, 17)     if(get_cvar_num("sv_hudmsg") == 1) {         set_hudmessage(190, 30, 0, -1.0, 0.15, 0, 1.0, 7.0, 0.1, 0.2, -1)         show_hudmessage(0, "%s connecting", name)     } else return PLUGIN_HANDLED     return PLUGIN_CONTINUE } public client_disconnect(id) {     new name[18]     get_user_name(id, name, 17)         if(get_cvar_num("sv_hudmsg") == 1) {         set_hudmessage(190, 30, 0, -1.0, 0.24, 0, 1.0, 5.0, 0.1, 0.2, -1)         show_hudmessage(0, "%s disconnected", name)     } else return PLUGIN_HANDLED     return PLUGIN_CONTINUE }
you can change the text through a cvar.


All times are GMT -4. The time now is 07:57.

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