AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What is wrong with my code? (https://forums.alliedmods.net/showthread.php?t=107876)

OneMoreLevel 10-31-2009 13:54

What is wrong with my code?
 
PHP Code:

/* Plugin made by OneMoreLevel */
/* Any modification to this code is illegal
unless told so by the author. */
//////////////////////////////////////////////////////////////////////////////////////////
//  ChangeLog
// Version 1.1, Public release.
//-- Made the base of the plugin, and made it multilingual
//
//
//
//
//
//
//
//
//
//
//
//
////////////////////////////////////////////////////////////////////////////////////////////
//  CVARS
// SPY_Cost --- This is how much the spy Costs, default = 5000.
// PLUGIN_TOGGLE --- Toggle the plugin, default 1 (on)

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define PLUGIN "TF2 Spy"
#define VERSION "1.1"
#define AUTHOR "OneMoreLevel"
new spyToggle,spyCost;

public 
plugin_init() {
 
register_plugin("TF2 Spy""1.1""OneMoreLevel")
 
 
register_clcmd("say !spy" "Say_spy")
 
register_clcmd("say_team !spy" "Say_spy")
 
register_clcmd("say !abilities","plugin_menu")
 
 
spyToggle register_cvar("PLUGIN_TOGGLE""1");
 
spyCost register_cvar("SPY_Cost""5000");
 
 
register_dictionary"TF2Dictionary.txt")
 
}
public 
Say_spy (id) {
 if (
is_user_alive(id))
 {
  
client_print(0print_chat"%L"LANG_SERVER"TYPE_SPY")
  if (
cs_get_user_money(id)) > (get_pcvar_num(spyCost))
  
cs_set_user_money(idcs_get_user_money,(id) - (get_pcvar_num(spyCost));
  
strip_user_weapons(id)
  
client_printidprint_chat"%L"LANG_SERVER"NOW_SPY"// Free Multi-lingual advertising :D
 
}
 else if (
cs_get_user_money(id)) < (get_pcvar_num(spyCost))
 {
  
client_printidprint_chat"%L"LANG_SERVER"NOT_ENOUGH_MONEY")
 }
 else if (!
is_user_alive(id))
 {
  
client_printidprint_chat"%L"LANG_SERVER"CANNOT_SPY")
 }
 
}
public 
plugin_menu (id) {
 
 new 
menu menu_create("\rTF2 Spy Abilities""menu_handler");
 
 
menu_additem(menu"\wTeam Camo - Look like the other team""1"0);
 
menu_additem(menu"\wEnviroment Camo - Grass suit""2"0);
 
menu_additem(menu"\wPartial Invisibility - 75% Invis.""3"0);
 
 
 
menu_setprop(menuMPROP_EXITMEXIT_ALL);
 if (
is_user_alive(id))
  
menu_display(idmenu0);
 else
 {
  
client_printidprint_console"%L"LANG_SERVER"SPY_DEAD")
 }
}
public 
menu_handler(idmenuitem)
{
 if (
item == MENU_EXIT )
 { 
  
menu_destroy(menu);
 }
 
 
 
// Here are the data functions and variables
 
new data[6], iName[64];
 new 
accesscallback;
 
menu_item_getinfo(menuitemaccessdata,5iName63callback);
 new 
key str_to_num(data);
 
 switch(
key)
 {
  case 
1:
  {
   
// Print the message and destroy the menu
   
if ( get_user_teamid ) == // CT?
   
{
    (
strip_user_weapons(id))
    
cs_set_user_teamidCS_TEAM_CTCS_T_LEET ); 
    
menu_destroy(menu);
   }
   else if( 
get_user_teamid ) == // T?
   
{
    (
strip_user_weapons(id))
    
cs_set_user_teamidCS_TEAM_TCS_CT_GIGN ); 
    
menu_destroy(menu);
    
   }
   
menu_destroy(menu);
  }
  
  case 
2:
  {
   
   
menu_destroy(menu);
  }
  
  case 
3:
  {
   if ( 
get_user_teamid ) == )
   {
    (
strip_user_weapons(id))
    
cs_set_user_teamidCS_TEAM_CTCS_CT_GIGN ); 
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha65)
    
menu_destroy(menu);
   }
   else if( 
get_user_teamid ) == )
   {
    (
strip_user_weapons(id))
    
cs_set_user_teamidCS_TEAM_TCS_T_LEET ); 
    
set_user_rendering(idkRenderFxGlowShell000kRenderTransAlpha65)
    
menu_destroy(menu);
    
   }
   
menu_destroy(menu);
  }
  
 }
 
 
// Kill the menu, and make a return.
 
menu_destroy(menu);
 return 
PLUGIN_HANDLED;
}
public 
client_connect(id) {
 
client_printidprint_console"%L"LANG_SERVER"WELCOME_MSG")
 
client_printidprint_chat"%L"LANG_SERVER"WELCOME_MSG")
}
public 
client_disconnect(id) {
 
client_printidprint_console"%L"LANG_SERVER"GOODBYE_MSG")
 
client_printidprint_chat"%L"LANG_SERVER"GOODBYE_MSG")
}
/////////////////////////////////
//  To Do?
//-- Make "feign death" option
//-- Ad no footsteps
//-- Knife model?
//
//
//
//
//
//
//
//
//
////////////////////////////////// 

I get a few errors with this, anybody know what it is?

(I know I dont use One of the variables yet.)

xPaw 10-31-2009 13:59

Re: What is wrong with my code?
 
Post errors here next time.

Code:
if (cs_get_user_money(id)) > (get_pcvar_num(spyCost)) cs_set_user_money(id, cs_get_user_money,(id) - (get_pcvar_num(spyCost)); -> if (cs_get_user_money(id) > (get_pcvar_num(spyCost)) ) cs_set_user_money( id, ( cs_get_user_money(id) - get_pcvar_num(spyCost) ) );

I hope you will figure other errors.

OneMoreLevel 10-31-2009 14:05

Re: What is wrong with my code?
 
Thanks alot XPaw :D


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

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