Raised This Month: $ Target: $400
 0% 

invaild function


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 04-24-2011 , 09:49   invaild function
Reply With Quote #1

i tried to make mod that when ct type /buyak the ct get ak
but if teror writes it says that he cant with colorchat can somone help
(the mod dont supposed to buy weapon,but to give weapon)
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <engine>
#include <colorchat>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /buyak","cmd_getak")
}

public 
cmd_getak(id){
    if(
get_user_team(id) != 1){
        
ColorChat(idRED,"[Jailbreak]Only Guards Can Use Weapons Cmds")
    }
}
    else if(
get_user_team(id) != 2{
        
give_item(0,weapon_ak47)
    }

Dr7sTyLe is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-24-2011 , 09:51   Re: invaild function
Reply With Quote #2

PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <fun> 
#include <engine> 
#include <colorchat> 

#define PLUGIN "New Plug-In" 
#define VERSION "1.0" 
#define AUTHOR "author" 


public plugin_init() { 
    
register_plugin(PLUGINVERSIONAUTHOR
    
register_clcmd("say /buyak","cmd_getak"


public 
cmd_getak(id){ 
    if(
get_user_team(id) == 2){ 
        
ColorChat(idRED,"[Jailbreak]Only Guards Can Use Weapons Cmds"
    } 
    else if(
get_user_team(id) == 1) { 
        
give_item(id,weapon_ak47
    } 

Try This...
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))

Last edited by ProIcons; 04-24-2011 at 10:41.
ProIcons is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 04-24-2011 , 10:23   Re: invaild function
Reply With Quote #3

Wow, you really fixed the code...

PHP Code:
public cmd_getak(id){  
    if(
get_user_team(id) == 2){  
        
ColorChat(idRED,"[Jailbreak]Only Guards Can Use Weapons Cmds")  
    }  
}  
    else if(
get_user_team(id) == 1) {  
        
give_item(0,weapon_ak47)  
    }  

->
PHP Code:
public cmd_getak(id){  
    if(
get_user_team(id) == 2){  
        
ColorChat(idRED,"[Jailbreak]Only Guards Can Use Weapons Cmds")
    }else if(
get_user_team(id) == 1){  
        
give_item(id"weapon_ak47")
    }

and is it the whole code of plugin? do you really need that many includes ? Also if it's for cstrike, you should use cs_get_user_team instead of get_user_team, it's more accurate and efficient.

Last edited by reinert; 04-24-2011 at 10:33.
reinert is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-24-2011 , 10:40   Re: invaild function
Reply With Quote #4

i missed a bracket
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
reinert
Veteran Member
Join Date: Feb 2007
Old 04-24-2011 , 10:55   Re: invaild function
Reply With Quote #5

You fixed your bracket, but u still missed the problem.

give_item(id,"weapon_ak47")
reinert is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 04-24-2011 , 11:01   Re: invaild function
Reply With Quote #6

PHP Code:
public cmd_getak(id){  
    if( 
cs_get_user_teamid ) != CS_TEAM_CT )
        
ColorChat(idRED,"[Jailbreak]Only Guards Can Use Weapons Cmds")

    else 
give_item(id"weapon_ak47")

</span></span>
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-24-2011 , 11:05   Re: invaild function
Reply With Quote #7

Quote:
Originally Posted by nikhilgupta345 View Post
PHP Code:
public cmd_getak(id){  
    if( 
cs_get_user_teamid ) != CS_TEAM_CT )
        
ColorChat(idRED,"[Jailbreak]Only Guards Can Use Weapons Cmds")

    else 
give_item(id"weapon_ak47")

This would allow spectators to use the command.

In addition to using cs_get_user_team() instead of get_use_team(), you should also use the CS_TEAM_ team constants to improve readability. You should also try to call natives as sparingly as possible, here you are checking a players team twice when one call will suffice.
PHP Code:
#include <amxmodx> 
#include <amxmisc> 
#include <cstrike> 
#include <fun> 
#include <engine> 
#include <colorchat> 

#define PLUGIN "New Plug-In" 
#define VERSION "1.0" 
#define AUTHOR "author" 

public plugin_init() 

    
register_pluginPLUGIN VERSION AUTHOR 
    
register_clcmd"say /buyak" "cmd_getak" 


public 
cmd_getakid )

    if ( 
is_user_aliveid ) )
    {
        if ( 
cs_get_user_teamid ) == CS_TEAM_T )
        {
            
ColorChatid RED "[Jailbreak]Only Guards Can Use Weapons Cmds" );
        }
        else
        {
            
give_itemid "weapon_ak47" ); 
        }
    }
    
    
// - Or -

    
if ( is_user_aliveid ) )
        ( 
cs_get_user_teamid ) == CS_TEAM_T ) ? ColorChatid RED "[Jailbreak]Only Guards Can Use Weapons Cmds" ) : give_itemid "weapon_ak47" );

__________________

Last edited by Bugsy; 04-24-2011 at 11:15.
Bugsy is online now
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 04-24-2011 , 15:37   Re: invaild function
Reply With Quote #8

Ty all but i must ask is this code correct also ? its compiled
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <engine>
#include <colorchat>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /buyak","cmd_getak")
}

public 
cmd_getak(id){
    if(
get_user_team(id) != 1){
        
ColorChat(idRED,"[Jailbreak]Only Guards Can Use Weapons Cmds")
    }
    if(
get_user_team(id) != 2){
        
give_item(id"weapon_ak47")
        
give_item(id"weapon_deagle")
        
cs_set_user_bpammo(idCSW_DEAGLE70)
        
cs_set_user_bpammo(idCSW_AK47200)
    }

and question can i change every word color in color chat and if i can, can somone give me a example line : ty
Dr7sTyLe is offline
ProIcons
Senior Member
Join Date: Jan 2009
Location: Greece - Salonica
Old 04-24-2011 , 15:41   Re: invaild function
Reply With Quote #9

why are you using

"!=" ?
!= means that is not matching

if get_user_team(id) was 3 or 2
this would appear to user: ColorChat(id, RED,"[Jailbreak]Only Guards Can Use Weapons Cmds")

you can make it by the way

if (something == somethingelse)
if (get_user_team(id) == 2)
__________________
function rb return $regsubex($$1-,/(.)/g,$+($chr(2) $+ $chr(3),$r(2,15),$chr(2),\1))
ProIcons is offline
Dr7sTyLe
Senior Member
Join Date: Dec 2010
Old 04-24-2011 , 15:49   Re: invaild function
Reply With Quote #10

Quote:
Originally Posted by ProIcons View Post
why are you using

"!=" ?
!= means that is not matching

if get_user_team(id) was 3 or 2
this would appear to user: ColorChat(id, RED,"[Jailbreak]Only Guards Can Use Weapons Cmds")

you can make it by the way

if (something == somethingelse)
if (get_user_team(id) == 2)
yeah ty so is this work and can you answer my question from the last comment?
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <engine>
#include <colorchat>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /buyak","cmd_getak")
}

public 
cmd_getak(id){
    if (
get_user_team(id) == 1){
        
ColorChat(idRED,"[Jailbreak]Only Guards Can Use Weapons Cmds")
    }
    if (
get_user_team(id) == 2){
        
give_item(id"weapon_ak47")
        
give_item(id"weapon_deagle")
        
cs_set_user_bpammo(idCSW_DEAGLE70)
        
cs_set_user_bpammo(idCSW_AK47200)
    }

Dr7sTyLe is offline
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 20:01.


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