AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   curweapon help (https://forums.alliedmods.net/showthread.php?t=54124)

Samurai [/] 04-17-2007 15:33

curweapon help
 
PHP Code:

public event_curweapon(id
{     
new 
wpn read_data(2); 
if(
wpn != CSW_USP)
return 
PLUGIN_CONTINUE
strip_user_weapons
(id)
give_item (id"weapon_knife")
return 
PLUGIN_CONTINUE;  


How can i make same thing to glock, but glock would give 2flashbangs and 1 smokegrenade instead.

and if terrorist side player got knife it would do same

Nican 04-17-2007 16:34

Re: curweapon help
 
you could use get_user_team(id) to find his team

PHP Code:

public event_curweapon(id
{     
new 
team cs_get_user_team(id)
if(
team == CS_TEAM_CT)
return 
PLUGIN_CONTINUE
strip_user_weapons
(id)
give_item (id"weapon_knife")
return 
PLUGIN_CONTINUE;  



Samurai [/] 04-17-2007 17:03

Re: curweapon help
 
Quote:

Originally Posted by Nican (Post 466447)
you could use get_user_team(id) to find his team

PHP Code:

public event_curweapon(id
{     
new 
team cs_get_user_team(id)
if(
team == CS_TEAM_CT)
return 
PLUGIN_CONTINUE
strip_user_weapons
(id)
give_item (id"weapon_knife")
return 
PLUGIN_CONTINUE;  



and how i put these all to curweapon ?

Nican 04-17-2007 17:10

Re: curweapon help
 
You can find weapon list at:
http://www.amxmodx.org/funcwiki.php?go=module&id=4

so i think it should be something like:
PHP Code:

public event_curweapon(id
{     
new 
wpn read_data(2); 
if(
wpn == CSW_USP){
  
strip_user_weapons(id)
  
give_item (id"weapon_knife")
} else if (
wpn == CSW_GLOCK18){
  
strip_user_weapons(id)
  
give_item (id"weapon_hegrenade")
}




scrtxxcaz 04-18-2007 01:45

Re: curweapon help
 
not sure if this is exactly what u want but u can arrange it the way you want it

Code:

public plugin_int() {
          register_plugin(PLUGIN, VERSION, AUTHOR)
          register_event("CurWeapon","current_weapon")
}
public current_weapon(id){
          new team = get_user_team(id,team,31)
          new ammo,clip,weapon
          get_user_weapon(weapon,ammo,clip)
          if(weapon == CSW_GLOCK18)
          {
                    if(team == 2)  //CT
                    {
                              strip_user_weapons(id)
                              give_item(id,"weapon_flashbang")
                              give_item(id,"weapon_flashbang")
                              give_item(id,"weapon_smokegrenade")
                      }
          }
          else if(weapon == CSW_KNIFE)
          {
                    if(team == 1)  //Terroist
                    {
                                strip_user_weapons(id)
                                give_item(id,"weapon_flashbang")
                                give_item(id,"weapon_flashbang")
                                give_item(id,"weapon_smokegrenade")
                    }
          }
}


Samurai [/] 04-18-2007 07:04

Re: curweapon help
 
Quote:

Originally Posted by scrtxxcaz (Post 466623)
not sure if this is exactly what u want but u can arrange it the way you want it

Code:

public plugin_int() {
          register_plugin(PLUGIN, VERSION, AUTHOR)
          register_event("CurWeapon","current_weapon")
}
public current_weapon(id){
          new team = get_user_team(id,team,31)
          new ammo,clip,weapon
          get_user_weapon(weapon,ammo,clip)
          if(weapon == CSW_GLOCK18)
          {
                    if(team == 2)  //CT
                    {
                              strip_user_weapons(id)
                              give_item(id,"weapon_flashbang")
                              give_item(id,"weapon_flashbang")
                              give_item(id,"weapon_smokegrenade")
                      }
          }
          else if(weapon == CSW_KNIFE)
          {
                    if(team == 1)  //Terroist
                    {
                                strip_user_weapons(id)
                                give_item(id,"weapon_flashbang")
                                give_item(id,"weapon_flashbang")
                                give_item(id,"weapon_smokegrenade")
                    }
          }
}


What i exactly mean is:
Code:

if anyone got glock //do something
if terrorist side player got knife //do something
if anyone got usp //do something


scrtxxcaz 04-18-2007 08:06

Re: curweapon help
 
Code:

public plugin_int() {
          register_plugin(PLUGIN, VERSION, AUTHOR)
          register_event("CurWeapon","current_weapon")
}
public current_weapon(id){
          new team = get_user_team(id,team,31)
          new ammo,clip,weapon
        get_user_weapon(weapon,ammo,clip)
          if(weapon == CSW_GLOCK18)
          {
                      // write your do something here
          }
          if(weapon == CSW_USP)
        {
                      //write your do something here
          }
          if(weapon == CSW_KNIFE && team == 1) //terroist
        {
                    // write your do something here
         }
}

i even color coordinated it for you, so dont say i didnt do anything for you.. lol

Samurai [/] 04-18-2007 08:29

Re: curweapon help
 
Quote:

Originally Posted by scrtxxcaz (Post 466714)
Code:

public plugin_int() {
          register_plugin(PLUGIN, VERSION, AUTHOR)
          register_event("CurWeapon","current_weapon")
}
public current_weapon(id){
          new team = get_user_team(id,team,31)
          new ammo,clip,weapon
        get_user_weapon(weapon,ammo,clip)
          if(weapon == CSW_GLOCK18)
          {
                    // write your do something here
          }
          if(weapon == CSW_USP)
        {
                      //write your do something here
          }
          if(weapon == CSW_KNIFE && team == 1) //terroist
        {
                    // write your do something here
         }
}

i even color coordinated it for you, so dont say i didnt do anything for you.. lol

This is my code:
PHP Code:

public current_weapon(id)

new 
team get_user_team(id,team,31)
new 
ammo,clip,weapon
get_user_weapon
(weapon,ammo,clip)
if(
weapon == CSW_GLOCK1)
{
strip_user_weapons(id)
give_item("weapon_flashbang")
give_item("weapon_flashbang")
give_item("weapon_smokegrenade")
}
if(
weapon == CSW_USP)
{
strip_user_weapons(id)
give_item("weapon_knife")
}
if(
weapon == CSW_KNIFE && team == 1//terroist
{
strip_user_weapons(id)
give_item("weapon_flashbang")
give_item("weapon_flashbang")
give_item("weapon_smokegrenade")
}
if(
weapon == CSW_C4)
{
strip_user_weapons(id)
}


whit errors:
Code:

/home/groups/amxmodx/tmp3/textIuXvLo.sma(613) : error 035: argument type mismatch (argument 2)
/home/groups/amxmodx/tmp3/textIuXvLo.sma(619) : error 035: argument type mismatch (argument 1)
/home/groups/amxmodx/tmp3/textIuXvLo.sma(620) : error 035: argument type mismatch (argument 1)
/home/groups/amxmodx/tmp3/textIuXvLo.sma(621) : error 035: argument type mismatch (argument 1)
/home/groups/amxmodx/tmp3/textIuXvLo.sma(626) : error 035: argument type mismatch (argument 1)
/home/groups/amxmodx/tmp3/textIuXvLo.sma(631) : error 035: argument type mismatch (argument 1)
/home/groups/amxmodx/tmp3/textIuXvLo.sma(632) : error 035: argument type mismatch (argument 1)
/home/groups/amxmodx/tmp3/textIuXvLo.sma(633) : error 035: argument type mismatch (argument 1)


scrtxxcaz 04-18-2007 08:40

Re: curweapon help
 
my bad its too late for me here.. fixed should work
Code:

public plugin_int() {
          register_plugin(PLUGIN, VERSION, AUTHOR)
          register_event("CurrentWeapon","current_weapon","be")
}
public current_weapon(id)
{
            new team[32]
            new teamid = get_user_team(id,team,31)
            new ammo,clip,weapon
            get_user_weapon(weapon,ammo,clip)
            if(weapon == CSW_GLOCK18)
              {
                      strip_user_weapons(id)
                      give_item(id,"weapon_flashbang")
                      give_item(id,"weapon_flashbang")
                      give_item(id,"weapon_smokegrenade")
              }
              if(weapon == CSW_USP)
              {
                            strip_user_weapons(id)
                            give_item(id,"weapon_knife")
                }
                if(weapon == CSW_KNIFE && teamid == 1) //terroist
                {
                              strip_user_weapons(id)
                              give_item(id,"weapon_flashbang")
                              give_item(id,"weapon_flashbang")
                              give_item(id,"weapon_smokegrenade")
                }
                if(weapon == CSW_C4)
                {
                                strip_user_weapons(id)
                  }
}

make sure u have the "be" in the register_clcmd("CurrentWeapon",current_weapon ","be") code i fogot it the first time

Samurai [/] 04-18-2007 08:53

Re: curweapon help
 
Quote:

Originally Posted by scrtxxcaz (Post 466724)
my bad its too late for me here.. fixed should work
Code:

public plugin_int() {
          register_plugin(PLUGIN, VERSION, AUTHOR)
          register_event("CurrentWeapon","current_weapon","be")
}
public current_weapon(id)
{
            new team[32]
            new teamid = get_user_team(id,team,31)
            new ammo,clip,weapon
            get_user_weapon(weapon,ammo,clip)
            if(weapon == CSW_GLOCK18)
              {
                      strip_user_weapons(id)
                      give_item(id,"weapon_flashbang")
                      give_item(id,"weapon_flashbang")
                      give_item(id,"weapon_smokegrenade")
              }
              if(weapon == CSW_USP)
              {
                            strip_user_weapons(id)
                            give_item(id,"weapon_knife")
                }
                if(weapon == CSW_KNIFE && teamid == 1) //terroist
                {
                              strip_user_weapons(id)
                              give_item(id,"weapon_flashbang")
                              give_item(id,"weapon_flashbang")
                              give_item(id,"weapon_smokegrenade")
                }
                if(weapon == CSW_C4)
                {
                                strip_user_weapons(id)
                  }
}

make sure u have the "be" in the register_clcmd("CurrentWeapon",current_weapon ","be") code i fogot it the first time

What is this then?
Code:
register_event("CurWeapon", "event_curweapon", "be","1=2") }


All times are GMT -4. The time now is 06:37.

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