hello all, second post, woot!
anywho i have aproblem here, i've been doing alot of tweaking with other ppl's scripts and learning quite a bit, however i've been trying to add a restrict feature to the bazooka mod plugin by More. so far i've managed to get this
Code:
public forward_playerprethink(id) {
if (is_user_alive(id)) {
new weaponid, clip, ammo
weaponid = get_user_weapon(id, clip, ammo)
if ((weaponid == CSW_C4) && hasBazooka[id]) {
new attack = get_user_button(id) & IN_ATTACK
new oldattack = get_user_oldbutton(id) & IN_ATTACK
new attack2 = get_user_button(id) & IN_ATTACK2
new oldattack2 = get_user_oldbutton(id) & IN_ATTACK2
new moderestrict = get_cvar_num("amx_bazooka_restrict")
if (attack && !oldattack) {
if (CanShoot[id] && allow_shooting && (user_controll[id] == 0)) {
fire_rocket(id)
}
}
else if (attack2 && !oldattack2) {
switch(mode[id]) {
case 1: {
if (moderestrict==1)
{
mode[id] = 1
client_print(id, print_center, "Other modes are restricted")
}
else
{
mode[id] = 2
}
client_print(id, print_center, "Switched to heat-seeking mode")
}
case 2: {
if (moderestrict==1)
{
mode[id] = 1
client_print(id, print_center, "Other modes are restricted")
}
else
{
mode[id] = 3
}
client_print(id, print_center, "Switched to user-guided mode")
}
case 3: {
if (moderestrict==1)
{
mode[id] = 1
client_print(id, print_center, "Other modes are restricted")
}
else
{
mode[id] = 1
}
client_print(id, print_center, "Switched to normal mode")
}
}
}
}
this seems to be the section where when the player presses secondary fire it changes the mode. what i want it to do is read the cvar "amx_bazooka_restrict" and determine wheter or not you can switch modes.
It seems logically sound and compiles without any errors but it just simply doesn't work.
here's his post if you want the plugin:
http://forums.alliedmods.net/showthread.php?p=72047
on a side note i think the cvar only takes effect if it was set before the server was created. i want to be able to turn it on and off in realtime.
another side note, i asked a while ago if he could make an amx_bazooka_give function for that plugin, well... i don't need it now, i already did it

not bad for my first week of scripting eh?
__________________