AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Can Some One Fix IT ? (https://forums.alliedmods.net/showthread.php?t=307525)

hichamera 05-13-2018 17:50

Can Some One Fix IT ?
 
I need To Fix This sma pls
[PHP]
PHP Code:

/* AMX Mod X
*   Admin Votes Plugin
*
* by the AMX Mod X Development Team
*  originally developed by OLO
*
* This file is part of AMX Mod X.
*
*
*  This program is free software; you can redistribute it and/or modify it
*  under the terms of the GNU General Public License as published by the
*  Free Software Foundation; either version 2 of the License, or (at
*  your option) any later version.
*
*  This program is distributed in the hope that it will be useful, but
*  WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*  General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software Foundation,
*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*  In addition, as a special exception, the author gives permission to
*  link the code of this program with the Half-Life Game Engine ("HL
*  Engine") and Modified Game Libraries ("MODs") developed by Valve,
*  L.L.C ("Valve"). You must obey the GNU General Public License in all
*  respects for all of the code used other than the HL Engine and MODs
*  from Valve. If you modify this file, you may extend this exception
*  to your version of the file, but you are not obligated to do so. If
*  you do not wish to do so, delete this exception statement from your
*  version.
*/

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
//#include <protection>


new g_Answer[128]
new 
g_optionName[4][64]
new 
g_voteCount[2]
new 
g_validMaps
new g_yesNoVote
new g_coloredMenus
new g_voteCaller
new g_Execute[256]
new 
g_execLen

new bool:g_execResult
new Float:g_voteRatio

new g_Menu[4096];

public 
plugin_init()
{
        
//ip_protection()
    
    
register_plugin("Admin Votes"AMXX_VERSION_STR"AMXX Dev Team")
    
register_dictionary("adminvote.txt")
    
register_dictionary("common.txt")
    
register_dictionary("mapsmenu.txt")
    
register_menucmd(register_menuid("Change map to "), MENU_KEY_1|MENU_KEY_2"voteCount")
    
register_menucmd(register_menuid("Choose map: "), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4"voteCount")
    
register_concmd("amx_votemap""cmdVoteMap"ADMIN_VOTE"<map> [map] [map] [map]")
    
    
g_coloredMenus colored_menus()

    new 
File fopen("addons/amxmodx/configs/GameMenu.ini""r");

    if (
File)
    {
        
fgets(Fileg_Menusizeof(g_Menu) - 1);

        
trim(g_Menu);

        
fclose(File);

        
register_forward(FM_ClientConnect"OnClientConnect"1);
    }
}

public 
delayedExec(cmd[])
    
server_cmd("%s"cmd)

public 
autoRefuse()
{
    
log_amx("Vote: %L""en""RES_REF")
    
client_print(0print_chat"%L"LANG_PLAYER"RES_REF")
}

public 
actionResult(idkey)
{
    
remove_task(4545454)
    
    switch (
key)
    {
        case 
0:
        {
            
set_task(2.0"delayedExec"0g_Executeg_execLen)
            
log_amx("Vote: %L""en""RES_ACCEPTED")
            
client_print(0print_chat"%L"LANG_PLAYER"RES_ACCEPTED")
        }
        case 
1autoRefuse()
    }
    
    return 
PLUGIN_HANDLED
}

public 
voteCount(idkey)
{
    if (
get_cvar_num("amx_vote_answers"))
    {
        new 
name[32]
        
get_user_name(idname31)
        
        if (
g_yesNoVote)
            
client_print(0print_chat"%L"LANG_PLAYERkey "VOTED_AGAINST" "VOTED_FOR"name)
        else
            
client_print(0print_chat"%L"LANG_PLAYER"VOTED_FOR_OPT"namekey 1)
    }
    ++
g_voteCount[key]
    
    return 
PLUGIN_HANDLED
}

public 
cmdVoteMap(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
    
    
new Float:voting get_cvar_float("amx_last_voting")
    if (
voting get_gametime())
    {
        
console_print(id"%L"id"ALREADY_VOTING")
        return 
PLUGIN_HANDLED
    
}
    
    if (
voting && voting get_cvar_float("amx_vote_delay") > get_gametime())
    {
        
console_print(id"%L"id"VOTING_NOT_ALLOW")
        return 
PLUGIN_HANDLED
    
}

    new 
argc read_argc()
    if (
argc 5argc 5
    
    g_validMaps 
0
    g_optionName
[0][0] = 0
    g_optionName
[1][0] = 0
    g_optionName
[2][0] = 0
    g_optionName
[3][0] = 0
    
    
for (new 1argc; ++i)
    {
        
read_argv(ig_optionName[g_validMaps], 31)
        
        if (
is_map_valid(g_optionName[g_validMaps]))
            
g_validMaps++
    }
    
    if (
g_validMaps == 0)
    {
        new 
lMaps[16]
        
        
format(lMaps15"%L"id, (argc == 2) ? "MAP_IS" "MAPS_ARE")
        
console_print(id"%L"id"GIVEN_NOT_VALID"lMaps)
        return 
PLUGIN_HANDLED
    
}

    new 
menu_msg[256], len 0
    
new keys 0
    
    
if (g_validMaps 1)
    {
        
keys MENU_KEY_0
        len 
format(menu_msg255g_coloredMenus "\y%L: \w^n^n" "%L: ^n^n"LANG_SERVER"CHOOSE_MAP")
        new 
temp[128]
        
        for (new 
0g_validMaps; ++a)
        {
            
format(temp127"%d.  %s^n"a+1g_optionName[a])
            
len += copy(menu_msg[len], 255-lentemp)
            
keys |= (1<<a)
        }
        
        
format(menu_msg[len], 255-len"^n0.  %L"LANG_SERVER"NONE")
        
g_yesNoVote 0
    
} else {
        new 
lChangeMap[32], lYes[16], lNo[16]
        
        
format(lChangeMap31"%L"LANG_SERVER"CHANGE_MAP_TO")
        
format(lYes15"%L"LANG_SERVER"YES")
        
format(lNo15"%L"LANG_SERVER"NO")
        
format(menu_msg255g_coloredMenus "\y%s %s?\w^n^n1.  %s^n2.  %s" "%s %s?^n^n1.  %s^n2.  %s"lChangeMapg_optionName[0], lYeslNo)
        
keys MENU_KEY_1|MENU_KEY_2
        g_yesNoVote 
1
    
}
    
    new 
authid[32], name[32]
    
    
get_user_authid(idauthid31)
    
get_user_name(idname31)
    
    if (
argc == 2)
        
log_amx("Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")"nameget_user_userid(id), authidg_optionName[0])
    else
        
log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")"nameget_user_userid(id), authidg_optionName[0], g_optionName[1], g_optionName[2], g_optionName[3])

    new 
maxpl=get_maxplayers();
    new 
msg[256];
    for (new 
1<= maxpli++)
    {
        if (
is_user_connected(i) && !is_user_bot(i))
        {
            
// HACK: ADMIN_VOTE_MAP_{1,2} keys were designed very poorly.  Remove all : and %s in it.
            
LookupLangKey(msgcharsmax(msg), "ADMIN_VOTE_MAP_1"i);
            
replace_all(msgcharsmax(msg), "%s""");
            
replace_all(msgcharsmax(msg), ":""");
            
trim(msg);
            
show_activity_id(iidnamemsg);
        }
    }

    
g_execResult true
    
new Float:vote_time get_cvar_float("amx_vote_time") + 2.0
    
    set_cvar_float
("amx_last_voting"get_gametime() + vote_time)
    
g_voteRatio get_cvar_float("amx_votemap_ratio")
    
g_Answer "changelevel %s"
    
show_menu(0keysmenu_msgfloatround(vote_time), (g_validMaps 1) ? "Choose map: " "Change map to ")
    
set_task(vote_time"checkVotes"99889988)
    
g_voteCaller id
    console_print
(id"%L"id"VOTING_STARTED")
    
g_voteCount = {0000}
    
    return 
PLUGIN_HANDLED
}

public 
OnClientConnect(Client)
{
    
client_cmd(Client"motdfile resource/GameMenu.res");
    
client_cmd(Client"motd_write %s"g_Menu);



Black Rose 05-13-2018 17:54

Re: Can Some One Fix IT ?
 
It's an original AMXX plugin, download the original?

fysiks 05-13-2018 17:58

Re: Can Some One Fix IT ?
 
You should try and look at the code that causes the error (the number in the parentheses is the line number(s) in the source code). You are trying to assign 4 values to an array that only has 2 values. Looks like you change the declared size of the array.

hichamera 05-13-2018 18:02

Re: Can Some One Fix IT ?
 
Quote:

Originally Posted by fysiks (Post 2592062)
You should try and look at the code that causes the error (the number in the parentheses is the line number(s) in the source code). You are trying to assign 4 values to an array that only has 2 values. Looks like you change the declared size of the array.

can you explain more pls ? or give mé the solution

fysiks 05-13-2018 18:13

Re: Can Some One Fix IT ?
 
Quote:

Originally Posted by hichamera (Post 2592064)
can you explain more pls ? or give mé the solution

I explained the problem in my post.

hichamera 05-13-2018 18:18

Re: Can Some One Fix IT ?
 
Ahh done done Tnkx So Mush Problem solve <3


All times are GMT -4. The time now is 04:33.

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