Raised This Month: $12 Target: $400
 3% 

Solved String


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SlientArmy
Junior Member
Join Date: Aug 2019
Old 08-05-2019 , 15:41   String
Reply With Quote #1

I want to write the names of the maps as a string, but I can't. The same maps will not come out in the vote.
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>

#define PLUGIN "Plugin Name"
#define VERSION "1.0"
#define AUTHOR "Slient Army"
#define MENUTAG "KIRAATHANE"
#define MENUKISATAG "KG"

new Rounds_Num,Map_Check[6],Vote_This[6]

new 
Map_Names[][] = {    
    {
""},
    {
"jail_buyukisyan_dark"},
    {
"jail_buyukisyan_v8"},
    {
"jail_buyukisyan_v1"},
    {
"jail_buyukisyan_v2"},
    {
"jail_buyukisyan_v3"},
    {
"jail_buyukisyan_v4"},
    {
"jail_buyukisyan_v5"},
    {
"jail_buyukisyan_v6"},
    {
"jail_buyukisyan_v7"}
}

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("saEnd"2"1=Round_End");
    
register_logevent("saRs"2"1=Round_Start");
}
public 
saEnd() {
    
Rounds_Num++
}
public 
saRs() {
    for(new 
isizeof Map_Namesi++) {
        
Map_Check[1] = random_num(0,Map_Names[random_num(0,i)][0])
        
    }
    for(new 
cget_maxplayers(); c++) OylamaMenu(c)
}

public 
OylamaMenu(id){    
    static 
Item[128]
    
    
formatex(Itemcharsmax(Item),"\d| \w`\r%s \d| \d| \wMap \yOylama \wMenusu ",MENUTAG)
    new 
Menu menu_create(Item"OylamaMenu_")

    
formatex(Itemcharsmax(Item),"\d| \w`\r%s \d| \d- \w%s",MENUKISATAG,Map_Check[1])
    
menu_additem(MenuItem"1")
    
formatex(Itemcharsmax(Item),"\d| \w`\r%s \d| \d- \w%s",MENUKISATAG,Map_Check[2])
    
menu_additem(MenuItem"2")
    
formatex(Itemcharsmax(Item),"\d| \w`\r%s \d| \d- \w%s",MENUKISATAG,Map_Check[3])
    
menu_additem(MenuItem"3")
    
formatex(Itemcharsmax(Item),"\d| \w`\r%s \d| \d- \w%s",MENUKISATAG,Map_Check[4])
    
menu_additem(MenuItem"4")
    
formatex(Itemcharsmax(Item),"\d| \w`\r%s \d| \d- \w%s",MENUKISATAG,Map_Check[5])
    
menu_additem(MenuItem"5")
        
    
menu_setprop(Menu,MPROP_EXITNAME,"\wCikis")
    
menu_display(id,Menu,0)
}
public 
OylamaMenu_(idmenuitem) {
    if( 
item == MENU_EXIT ) {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
key str_to_num(data);

    switch(
key){
        case 
1: {
            
Vote_This[1]++
        }
        case 
2: {
            
Vote_This[2]++
        }
        case 
3: {
            
Vote_This[3]++
        }
        case 
4: {
            
Vote_This[4]++
        }
        case 
5: {
            
Vote_This[5]++
        }    
    }
    return 
PLUGIN_HANDLED


Last edited by Bugsy; 08-06-2019 at 20:15.
SlientArmy is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 08-05-2019 , 17:31   Re: String
Reply With Quote #2

Do you want to get 5 random indexes from an array and put them to a vote menu?
__________________
Relaxing is offline
SlientArmy
Junior Member
Join Date: Aug 2019
Old 08-05-2019 , 17:50   Re: String
Reply With Quote #3

Imm i want 7 index can you do it ?
SlientArmy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-05-2019 , 19:00   Re: String
Reply With Quote #4

You are probably getting errors. Add ' debug' after your plugin in plugins.ini. You are better off with explaining what you are trying to do instead of asking for help in 'code talk'.
Code:
public saRs() {     for(new i; i < sizeof Map_Names; i++) { //This makes no sense, you are saying: Map_Check[1] = "give me a random number between 0 and the first character of a random map name"
        Map_Check[1] = random_num(0,Map_Names[random_num(0,i)][0])
              } //This will error if your server is not 100% full when it is called. Use get_players() to display it to only connected and alive/dead using flags.
    for(new c; c < get_maxplayers(); c++) OylamaMenu(c)
}

It's hard to tell what you're trying to do. Are you trying to make the maps appear in a random order in the menu each time it is displayed to a player?
__________________
Bugsy is offline
SlientArmy
Junior Member
Join Date: Aug 2019
Old 08-06-2019 , 01:31   Re: String
Reply With Quote #5

Yes its true.
SlientArmy is offline
SlientArmy
Junior Member
Join Date: Aug 2019
Old 08-06-2019 , 17:44   Re: String
Reply With Quote #6

I solved
SlientArmy is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:02.


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