Raised This Month: $ Target: $400
 0% 

What's wrong with my code?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Major_victory
Member
Join Date: Nov 2005
Location: Illinois
Old 11-08-2005 , 15:10   What's wrong with my code?
Reply With Quote #1

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?
__________________
Games i've screwed with:
Battlefield 1942, CNC Generals, Red Faction, Incoming/Incoming Forces, The Sims, Sim City 3k, Unreal Tournament, Fallout 1/2, Ragnarok, Goonzu, and CS 1.6.
Major_victory is offline
Send a message via AIM to Major_victory Send a message via Yahoo to Major_victory
 


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 23:43.


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