AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Script won't compile (https://forums.alliedmods.net/showthread.php?t=87741)

Maurice 03-15-2009 20:03

Script won't compile
 
Hello, i maded a scripts wich shows a menu like the old buy menu's style but due some reason i can't compile it, i dont get any errors the compiler just hangs also the online compiler here can't handle it.

I use the same scripts for some other ingame menu's wich works flawlesly, here the code which doesn't compile.

PHP Code:

include <amxmodx
#include <cstrike> 
#include <amxmisc>

#define KeysMenu5 (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)

public plugin_init() {
    
register_plugin("Custom Menu's","1.0",""

    
register_clcmd"rules","ShowMenu5"0"open menu")
    
register_clcmd"say rules","ShowMenu5"0"open menu")
    
register_clcmd"say_team rules","ShowMenu5"0"open menu")

    
register_menucmd(register_menuid("Menu5"), KeysMenu5"PressedMenu5")


public 
ShowMenu5(id,level,cid) {
    if (!
cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED
    show_menu
(idKeysMenu5"\yServer Rules^n^n\w1. No cheating^nNo hacking or using any other file wich give you an advatage on other players.^n^n2. Decent language^nNo respectless, offending/insulting, accusing, threatening, sicknesses, advertising,^nracism, nazism, rationally and non English/Dutch language.^n^n3. Decent nickname^nNo respectless, offending/insulting, accusing, threatening, sicknesses, advertising,^nracism, nazism, rationally and copying nicknames.^n^n4. No spam^nNo spamming with chat, radio and voicecom features.^n^n5. Decent gameplay^nNo intentional teamblocking, -attacking, -killing, not completing your mission.^nOur public servers are meant for the common players, extreme noobs/pro's might be^nremoved to guarantee a playable gameplay for the common player. ^n^n0. I agree         9. I disagree^n^n\yCopyright 2009 Dutchgamers.nl^nLast changed 15-3-2009", -1"Menu5")
    return 
PLUGIN_HANDLED
}

public 
PressedMenu5(idkey) {

    switch (
key) {
        case 
0client_cmd(id,"")
        case 
1client_cmd(id,"")
        case 
2client_cmd(id,"")
        case 
3client_cmd(id,"")
        case 
4client_cmd(id,"")
        case 
5client_cmd(id,"")
        case 
6client_cmd(id,"")
        case 
7client_cmd(id,"")
        case 
8client_cmd(id,"disconnect")
    }
    return 
PLUGIN_HANDLED



AntiBots 03-15-2009 20:16

Re: Script won't compile
 
PHP Code:

#include <amxmodx> 

?

Others include are un nesesary.

PHP Code:

register_menuid("\yServer Rules"


alan_el_more 03-15-2009 20:22

Re: Script won't compile
 
Look at this

https://forums.alliedmods.net/showthread.php?t=46364

Maurice 03-15-2009 21:25

Re: Script won't compile
 
Quote:

Originally Posted by AntiBots (Post 781522)
PHP Code:

#include <amxmodx> 

?

Others include are un nesesary.

Thanks for the tip althought #include <amxmisc> is required otherwise i get an error message related with cmd_acces.

Quote:

Originally Posted by AntiBots (Post 781522)
PHP Code:

register_menuid("\yServer Rules"


What do you mean wtih this? Do i have to add it?

The basic script works perfect only when i add the rules it won't compile anymore without any error messges, the compiler just crash. Is it because the rules are to long or to long lines? Without all the rule text the script compiles fine see the below script.

PHP Code:

#include <amxmodx> 
#include <amxmisc>

#define KeysMenu5 (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)

public plugin_init() {
    
register_plugin("Custom Menu's","1.0",""

    
register_clcmd"rules","ShowMenu5"0"open menu")
    
register_clcmd"say rules","ShowMenu5"0"open menu")
    
register_clcmd"say_team rules","ShowMenu5"0"open menu")

    
register_menucmd(register_menuid("Menu5"), KeysMenu5"PressedMenu5")


public 
ShowMenu5(id,level,cid) {
    if (!
cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED
    show_menu
(idKeysMenu5"\yServer Rules^n^nw1. ^n2. ^n3. ^n4. ^n5. ^n6. ^n7. ^n8. ^n9. ^n^n0. ", -1"Menu5")
    return 
PLUGIN_HANDLED
}

public 
PressedMenu5(idkey) {

    switch (
key) {
        case 
0client_cmd(id,"")
        case 
1client_cmd(id,"")
        case 
2client_cmd(id,"")
        case 
3client_cmd(id,"")
        case 
4client_cmd(id,"")
        case 
5client_cmd(id,"")
        case 
6client_cmd(id,"")
        case 
7client_cmd(id,"")
        case 
8client_cmd(id,"disconnect")
    }
    return 
PLUGIN_HANDLED



AntiBots 03-15-2009 21:28

Re: Script won't compile
 
You dont need this. because access is 0

PHP Code:

    if (!cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED 


Arkshine 03-16-2009 06:01

Re: Script won't compile
 
It doesn't compile because your line is toooooo long and the compiler doesn't like that. Just cut it using by example severals #define then formating all #define into one string. But even with that there are too much text. You should reduce.

Maurice 03-16-2009 21:13

Re: Script won't compile
 
Quote:

Originally Posted by AntiBots (Post 781566)
You dont need this. because access is 0

PHP Code:

    if (!cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED 


Thats indeed correct, the reason why i added it is because i use the same scripts for some other ingame menu's only then are only admins allowed to open them. For the public menu's i will remove it because it is useless.

Quote:

Originally Posted by arkshine (Post 781723)
It doesn't compile because your line is toooooo long and the compiler doesn't like that. Just cut it using by example severals #define then formating all #define into one string. But even with that there are too much text. You should reduce.

Thanks telling me wats was wrong. I noticed some other plugins wich have MultiLanguage can have some long messages. When i add ML to this plugin can i write the actualy rules in the .txt file and get it to work afterall?

Arkshine 03-17-2009 04:43

Re: Script won't compile
 
It should work.

Maurice 03-17-2009 21:30

Re: Script won't compile
 
I tried to add ML but it is harder as i thought, meaybe someone can help me a bit. I think i only need to add this id, "MESSAGE" somewhere in the line between the // signs and create a costom_menu.txt file in the lang folder with this text:
[en]
MESSAGE = rules

I tried some places to add id, "MESSAGE" but i get compile errors wich means i'm doing it wrong.

PHP Code:

#include <amxmodx> 
#include <amxmisc>

#define KeysMenu5 (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)

public plugin_init() {
    
register_plugin("Custom Menu's","1.0",""
    
register_dictionary("custom_menu.txt")

    
register_clcmd"rules","ShowMenu5"0"open menu")
    
register_clcmd"say rules","ShowMenu5"0"open menu")
    
register_clcmd"say_team rules","ShowMenu5"0"open menu")

    
register_menucmd(register_menuid("Menu5"), KeysMenu5"PressedMenu5")


public 
ShowMenu5(id,level,cid) {
    if (!
cmd_access(id,level,cid,1))
    return 
PLUGIN_HANDLED
//  show_menu(id, KeysMenu5, "the menu text", -1, "Menu5")
//
    
show_menu(idKeysMenu5"%L", -1"Menu5")
//
    
return PLUGIN_HANDLED
}

public 
PressedMenu5(idkey) {

    switch (
key) {
        case 
0client_cmd(id,"")
        case 
1client_cmd(id,"")
        case 
2client_cmd(id,"")
        case 
3client_cmd(id,"")
        case 
4client_cmd(id,"")
        case 
5client_cmd(id,"")
        case 
6client_cmd(id,"")
        case 
7client_cmd(id,"")
        case 
8client_cmd(id,"disconnect")
    }
    return 
PLUGIN_HANDLED



Exolent[jNr] 03-17-2009 21:38

Re: Script won't compile
 
PHP Code:

    new menu[128];
    
formatex(menusizeof(menu) - 1"%L"id"MESSAGE");
    
show_menu(idKeysMenu5menu, -1"Menu5"



All times are GMT -4. The time now is 08:51.

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