Hey, I've been learning PASCAL for the last three years, and I decided it's about time I'll made some plugins I've always wanted to see for the HL-Engine.
So, i read almost all of the doc on the site, and started scripting.
I ran into a problem with the menu tutorial, infact not a problem, I just don't understand some of the code there. Let me show you what i mean..
(The link if you want to take a look at the whoel tutorial:
http://www.amxmodx.org/doc/source/sc...nced.htm#menus )
Code:
//The clcmd function will just give us the player id
public showWeaponMenu(id)
{
new menu[192]
new keys = MENU_KEY_0|MENU_KEY_1|MENU_KEY_2
format(menu, 191, "Which Weapon?^n^n1. AK47^n2. M4A1^n3. AWP")
show_menu(id, keys, menu)
return PLUGIN_HANDLED
}
//Our menu function will get the player id and the key they pressed
public giveWeapon(id, key)
{
//key will start at zero
if (key == 0)
{
give_item(id, "weapon_ak47")
} else if (key == 1) {
give_item(id, "weapon_m4a1")
} else if (key == 2) {
give_item(id, "weapon_awp")
}
}
Ok, so the tutorial has this bit of code in it, and i just want to clearify some things.
new menu[192]: What does this Variable do ? Why 192 ? It wasn't explained in the tutorial.
format(menu, 191, "Which Weapon?^n^n1. AK47^n2. M4A1^n3. AWP"): menu, and 191, why ? What does menu do here ? Why 191 ?
And I'd be glad if you could explain the whole format function for me, however that's not very important.
show_menu(id, keys, menu): Why does he call that function ? I see it nowhere in the program, if it's a core function (probably is) care to explain what "menu" has to do with it ?
public giveWeapon(id, key): How is it called ? I see it called nowhere.. And if its called and i somehow missed that, how does it get its id and key ?
Thanks alot,
wnn.