Raised This Month: $51 Target: $400
 12% 

Questoins on scripting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 11-18-2005 , 19:30   Questoins on scripting
Reply With Quote #1

I have a few questions on scripting.

1) How would you stop someone from buyone a smoke gernade. What would be the command to deny permission. like
Code:
(weapon_restrict == 1) { ns_has_weapon(id, CSW_SMOKEGRENADE, -1) client_print(id,print_chat,"[AMXX] You are not allowed to purchase Smoke Gernades") }
?

Also what should the value to setweapon = -1 be?
Code:
has_weapon ( index, weapon, [ setweapon = -1] )


Also (haha sorry) I know that things like

Code:
\yFirst Menu:^n
Generate the item variable but how is it broken down? Or what format is it in to generate the variable?
Styles is offline
Send a message via AIM to Styles
cTn
Senior Member
Join Date: Oct 2005
Old 11-18-2005 , 19:49  
Reply With Quote #2

first menu is a definiston for menu .... and for gun u can made code like

if user have weapon plugin handeld and there u make drop and add your message...
__________________
cTn is offline
Send a message via ICQ to cTn Send a message via MSN to cTn
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 11-18-2005 , 20:27  
Reply With Quote #3

But if its like a gernade or flash, people cant drop those. The only "STRIP" command i can see also, strips ALL the weapons.

And i know it means first menu but what does all that mean? I got it from somes script looking at it because i wanted to see if i could understand WHY all that other shit is there. and What it means
Styles is offline
Send a message via AIM to Styles
ts2do
Senior Member
Join Date: Mar 2004
Old 11-18-2005 , 21:43  
Reply With Quote #4

you don't want to use the ns module for cs weapons
__________________
ts2do is offline
Send a message via AIM to ts2do
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 11-18-2005 , 22:25  
Reply With Quote #5

Ook Thanks

Now i get errors with this i dont understand.
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <amxmisc.inc>

public plugin_init()
{
   // Plugin Info
   register_plugin("Admin Server Changer", "0.9", "hYp3r") 
   register_concmd("amx_smokes","admin_restricts",ADMIN_LEVEL_B,"<1|0>")
}


public admin_restricts(id,level,funcidx)  {

   if (!cmd_access(id,level,funcidx,3))
      return PLUGIN_HANDLED

     new restrict[64]
     new smokes = cs_get_weapon_id(CSW_SMOKEGRENADE)

     read_argv(1,restrict,32)


    (if (!restrict = 1))


      client_print(id, print_chat, "[AMXX] You are not allowed to use smoke gernades.")
		}else if{ 

	(if (!restrict = 0)) {

      client_print(id, print_chat, "[AMXX] Smoke gernades are allowed.")

		return PLUGIN_HANDLED
		}
	}
}
Here they are:
Code:
/home/users/amxmodx/tmp3/textG3V4i9.sma(19) : warning 217: loose indentation /home/users/amxmodx/tmp3/textG3V4i9.sma(25) : warning 217: loose indentation /home/users/amxmodx/tmp3/textG3V4i9.sma(25) : error 029: invalid expression, assumed zero /home/users/amxmodx/tmp3/textG3V4i9.sma(25) : error 033: array must be indexed (variable "restrict") /home/users/amxmodx/tmp3/textG3V4i9.sma(25) : error 029: invalid expression, assumed zero /home/users/amxmodx/tmp3/textG3V4i9.sma(25) : fatal error 107: too many error messages on one line
Styles is offline
Send a message via AIM to Styles
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 11-18-2005 , 22:32  
Reply With Quote #6

1. If statement syntax

Code:
if (conditon) {      //code here }

2. you need to convert your array into a number then do this

Code:
new status = str_to_num(restrict);

now you can do things like
if (status = 0)
Freecode is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 11-18-2005 , 22:32  
Reply With Quote #7

Dunno what you're trying to do with that code but here's a fixed version:
Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {    // Plugin Info    register_plugin("Admin Server Changer", "0.9", "hYp3r")    register_concmd("amx_smokes","admin_restricts",ADMIN_LEVEL_B,"<1|0>") } public admin_restricts(id,level,funcidx) {   if (!cmd_access(id,level,funcidx,2))     return PLUGIN_HANDLED   new restrict[32]   //new clip, ammo, weapid = get_user_weapon(id, clip, ammo);   //if(weapid == CSW_SMOKEGRENADE)   read_argv(1,restrict,31)   if(str_to_num(restrict) == 1)   {     client_print(id, print_chat, "[AMXX] You are not allowed to use smoke gernades.")   }   else if(str_to_num(restrict) == 0)   {     client_print(id, print_chat, "[AMXX] Smoke gernades are allowed.")     return PLUGIN_HANDLED   }   return PLUGIN_HANDLED; }
Uncomment the weapon parts.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 11-18-2005 , 23:27  
Reply With Quote #8

Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <amxmisc.inc>

public plugin_init()
{
   // Plugin Info
   register_plugin("Admin Server Changer", "0.9", "hYp3r")
   register_concmd("amx_smokes","admin_restricts",ADMIN_LEVEL_B,"<1|0>")
}


public admin_restricts(id,level,funcidx)  {

   if (!cmd_access(id,level,funcidx,3))
      return PLUGIN_HANDLED

     new restrict[64]
     new smokes = cs_get_weapon_id(CSW_SMOKEGRENADE)   
     

     read_argv(1,restrict,32)
     new status = str_to_num(restrict)

    if (status = 1)
{
      (smokes = 1);
      client_print(id, print_chat, "[AMXX] You are not allowed to use smoke gernades.")
}

   if (status = 0) {
      (smokes = 0);
      client_print(id, print_chat, "[AMXX] Smoke gernades are allowed.")

      return PLUGIN_HANDLED
       }
      }
Thats waht it is now but ikeep geting warnings and the plugin doesnt load right.
Styles is offline
Send a message via AIM to Styles
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 11-18-2005 , 23:40  
Reply With Quote #9

When your using 1 = your setting variable to a certain value
When using 2 == your checking 1 value against another
Freecode is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 11-18-2005 , 23:43  
Reply With Quote #10

wat!? I dont get it sorry.

But one reason it doesnt load is cuz
Code:
[AMXX] Plugin uses an unknown function (name "cs_get_weapon_id") - check your modules.ini. (plugin "rsmokes.amxx")
Styles is offline
Send a message via AIM to Styles
Reply



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


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