Raised This Month: $ Target: $400
 0% 

[ZP] Problema al restringir armas


  
 
 
Thread Tools Display Modes
Author Message
Sidix
Senior Member
Join Date: Feb 2011
Location: Limbo City
Old 02-19-2011 , 09:13   [ZP] Problema al restringir armas
#1

hola bueno tengo unos problemas al restringir las armas seguí el tutorial de exact para restringir armas para los niveles porque quiero que aparesca el menu así ejemplo:

Arma primaria [1-7]

1 IMI Galil [Disponible]

2 Famas [Disponible]

3 M4A1 Carbine [Req Level 5]

4 AK-47 Kalashnikov [Req Level 10]

...


pero edité de dos formas el code pero sale así

[IMG]http://img813.**************/img813/1740/sinttulo4q.png[/IMG]

[IMG]http://img202.**************/img202/9195/sinttulo3md.png[/IMG]


aqui dejo el code:

PHP Code:
// Buy Menu 1
public show_menu_buy1(taskid)
{
    
// Get player id
    
static id
    
(taskid g_maxplayers) ? (id ID_SPAWN) : (id taskid);
    
    
// Zombies or survivors get no guns
    
if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
        return;
    
    
// Bots pick their weapons randomly
    
if (is_user_bot(id))
    {
        
buy_primary_weapon(idrandom_num(0sizeof g_primary_items 1))
        
menu_buy2(idrandom_num(0sizeof g_secondary_items 1))
        return;
    }
    
    
// Automatic selection enabled for player and menu called on spawn event
    
if (WPN_AUTO_ON && taskid g_maxplayers)
    {
        
buy_primary_weapon(idWPN_AUTO_PRI)
        
menu_buy2(idWPN_AUTO_SEC)
        return;
    }
    
    static 
menu[999], lenweap
    len 
0
    
    
// Title
    
len += formatex(menu[len], sizeof menu len"\r%L \y[%d-%d]^n^n"id"MENU_BUY1_TITLE"WPN_STARTID+1min(WPN_STARTID+7WPN_MAXIDS))
    
    
// 1-7. Weapon List
    
for (weap WPN_STARTIDweap min(WPN_STARTID+7WPN_MAXIDS); weap++)
    {
        if(
g_level[id] >= g_levelprimary[weap])
        
len += formatex(menu[len], sizeof menu len"\r%d.\w %s \y[Level %d]^n"weap-WPN_STARTID+1WEAPONNAMES[get_weaponid(g_primary_items[weap])], g_levelprimary[weap])
        
        else
        
        
len += formatex(menu[len], sizeof menu len"\d%d. %s [Level %d]^n"weap-WPN_STARTID+1WEAPONNAMES[get_weaponid(g_primary_items[weap])], g_levelprimary[weap])
        
len += formatex(menu[len], sizeof menu len"\r%d.\y %s^n"weap-WPN_STARTID+1WEAPONNAMES[get_weaponid(g_primary_items[weap])])
        }
    
    
// 8. Auto Select
    
len += formatex(menu[len], sizeof menu len"^n\r8.\w %L \y[%L]"id"MENU_AUTOSELECT"id, (WPN_AUTO_ON) ? "MOTD_ENABLED" "MOTD_DISABLED")
    
    
// 9. Next/Back - 0. Exit
    
len += formatex(menu[len], sizeof menu len"^n^n\r9.\y %L/%L^n^n\r0.\y %L"id"MENU_NEXT"id"MENU_BACK"id"MENU_EXIT")
    
    
show_menu(idKEYSMENUmenu, -1"Buy Menu 1")
}

// Buy Menu 2
show_menu_buy2(id)
{
    static 
menu[999], lenweap
    len 
0
    
    
// Title
    
len += formatex(menu[len], sizeof menu len"\r%L^n"id"MENU_BUY2_TITLE")
    
    
// 1-6. Weapon List
    
for (weap 0weap sizeof g_secondary_itemsweap++)
    {
        if(
g_level[id] >= g_levelsecondary[weap])
        
len += formatex(menu[len], sizeof menu len"^n\r%d.\w %s  \y[Level %d]"weap+1WEAPONNAMES[get_weaponid(g_secondary_items[weap])], g_levelsecondary[weap])
        
        else
        
        
len += formatex(menu[len], sizeof menu len"^n\d%d. %s [Level %d]"weap+1WEAPONNAMES[get_weaponid(g_secondary_items[weap])], g_levelsecondary[weap])
        
len += formatex(menu[len], sizeof menu len"^n\r%d.\y %s"weap+1WEAPONNAMES[get_weaponid(g_secondary_items[weap])])
        }
    
    
// 8. Auto Select
    
len += formatex(menu[len], sizeof menu len"^n^n\r8.\w %L \y[%L]"id"MENU_AUTOSELECT"id, (WPN_AUTO_ON) ? "MOTD_ENABLED" "MOTD_DISABLED")
    
    
// 0. Exit
    
len += formatex(menu[len], sizeof menu len"^n^n\r0.\y %L"id"MENU_EXIT")
    
    
show_menu(idKEYSMENUmenu, -1"Buy Menu 2")

de = gracias !!!
__________________
[IMG]http://img839.**************/img839/1879/dmcdanteprofile.png[/IMG]
Sidix is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-19-2011 , 09:20   Re: [ZP] Problema al restringir armas
#2

esta mal cuando pones los datos en el loop.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Sidix
Senior Member
Join Date: Feb 2011
Location: Limbo City
Old 02-19-2011 , 09:41   Re: [ZP] Problema al restringir armas
#3

Gracias Solucionado
__________________
[IMG]http://img839.**************/img839/1879/dmcdanteprofile.png[/IMG]
Sidix is offline
p4rp4d30
Veteran Member
Join Date: Mar 2007
Old 02-19-2011 , 12:23   Re: [ZP] Problema al restringir armas
#4

Simplemente de aca

PHP Code:
for (weap WPN_STARTIDweap min(WPN_STARTID+7WPN_MAXIDS); weap++) 
    { 
        if(
g_level[id] >= g_levelprimary[weap]) 
        
len += formatex(menu[len], sizeof menu len"\r%d.\w %s \y[Level %d]^n"weap-WPN_STARTID+1WEAPONNAMES[get_weaponid(g_primary_items[weap])], g_levelprimary[weap]) 
         
        else 
         
        
len += formatex(menu[len], sizeof menu len"\d%d. %s [Level %d]^n"weap-WPN_STARTID+1WEAPONNAMES[get_weaponid(g_primary_items[weap])], g_levelprimary[weap]) 
        
len += formatex(menu[len], sizeof menu len"\r%d.\y %s^n"weap-WPN_STARTID+1WEAPONNAMES[get_weaponid(g_primary_items[weap])]) 
        } 
sacas el que dice

len += formatex(menu[len], sizeof menu - 1 - len, "\r%d.\y %s^n", weap-WPN_STARTID+1, WEAPONNAMES[get_weaponid(g_primary_items[weap])])

y listo
p4rp4d30 is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 02-19-2011 , 12:34   Re: [ZP] Problema al restringir armas
#5

Y no, se repite dos veces.

PHP Code:
// Buy Menu 1
public show_menu_buy1(taskid)
{
    
// Get player id
    
static id
    
(taskid g_maxplayers) ? (id ID_SPAWN) : (id taskid);
    
    
// Zombies or survivors get no guns
    
if (g_zombie[id] || g_survivor[id] || !is_user_alive(id))
        return;
    
    
// Bots pick their weapons randomly
    
if (is_user_bot(id))
    {
        
buy_primary_weapon(idrandom_num(0sizeof g_primary_items 1))
        
menu_buy2(idrandom_num(0sizeof g_secondary_items 1))
        return;
    }
    
    
// Automatic selection enabled for player and menu called on spawn event
    
if (WPN_AUTO_ON && taskid g_maxplayers)
    {
        
buy_primary_weapon(idWPN_AUTO_PRI)
        
menu_buy2(idWPN_AUTO_SEC)
        return;
    }
    
    static 
menu[999], lenweap
    len 
0
    
    
// Title
    
len += formatex(menu[len], sizeof menu len"\r%L \y[%d-%d]^n^n"id"MENU_BUY1_TITLE"WPN_STARTID+1min(WPN_STARTID+7WPN_MAXIDS))
    
    
// 1-7. Weapon List
    
for (weap WPN_STARTIDweap min(WPN_STARTID+7WPN_MAXIDS); weap++)
    {
        if(
g_level[id] >= g_levelprimary[weap])
            
len += formatex(menu[len], sizeof menu len"\r%d.\w %s \y[Level %d]^n"weap-WPN_STARTID+1WEAPONNAMES[get_weaponid(g_primary_items[weap])], g_levelprimary[weap])
        else
            
len += formatex(menu[len], sizeof menu len"\d%d. %s [Level %d]^n"weap-WPN_STARTID+1WEAPONNAMES[get_weaponid(g_primary_items[weap])], g_levelprimary[weap])
    }
    
    
// 8. Auto Select
    
len += formatex(menu[len], sizeof menu len"^n\r8.\w %L \y[%L]"id"MENU_AUTOSELECT"id, (WPN_AUTO_ON) ? "MOTD_ENABLED" "MOTD_DISABLED")
    
    
// 9. Next/Back - 0. Exit
    
len += formatex(menu[len], sizeof menu len"^n^n\r9.\y %L/%L^n^n\r0.\y %L"id"MENU_NEXT"id"MENU_BACK"id"MENU_EXIT")
    
    
show_menu(idKEYSMENUmenu, -1"Buy Menu 1")
}

// Buy Menu 2
show_menu_buy2(id)
{
    static 
menu[999], lenweap
    len 
0
    
    
// Title
    
len += formatex(menu[len], sizeof menu len"\r%L^n"id"MENU_BUY2_TITLE")
    
    
// 1-6. Weapon List
    
for (weap 0weap sizeof g_secondary_itemsweap++)
    {
        if(
g_level[id] >= g_levelsecondary[weap])
            
len += formatex(menu[len], sizeof menu len"^n\r%d.\w %s  \y[Level %d]"weap+1WEAPONNAMES[get_weaponid(g_secondary_items[weap])], g_levelsecondary[weap])
        else
            
len += formatex(menu[len], sizeof menu len"^n\d%d. %s [Level %d]"weap+1WEAPONNAMES[get_weaponid(g_secondary_items[weap])], g_levelsecondary[weap])
    }
    
    
// 8. Auto Select
    
len += formatex(menu[len], sizeof menu len"^n^n\r8.\w %L \y[%L]"id"MENU_AUTOSELECT"id, (WPN_AUTO_ON) ? "MOTD_ENABLED" "MOTD_DISABLED")
    
    
// 0. Exit
    
len += formatex(menu[len], sizeof menu len"^n^n\r0.\y %L"id"MENU_EXIT")
    
    
show_menu(idKEYSMENUmenu, -1"Buy Menu 2")

Indetado y arreglado.

Problem, pajero?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
 



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:32.


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