AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved String (https://forums.alliedmods.net/showthread.php?t=317945)

SlientArmy 08-05-2019 15:41

String
 
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



Relaxing 08-05-2019 17:31

Re: String
 
Do you want to get 5 random indexes from an array and put them to a vote menu?

SlientArmy 08-05-2019 17:50

Re: String
 
Imm i want 7 index can you do it ?

Bugsy 08-05-2019 19:00

Re: String
 
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?

SlientArmy 08-06-2019 01:31

Re: String
 
Yes its true.

SlientArmy 08-06-2019 17:44

Re: String
 
I solved :)


All times are GMT -4. The time now is 17:18.

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