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

Chicken fight pluigin or mod


Post New Thread Reply   
 
Thread Tools Display Modes
Ravi81
Junior Member
Join Date: Jun 2022
Old 06-07-2022 , 02:30   Re: Chicken fight pluigin or mod
Reply With Quote #11

Like this ?

PHP Code:
#include <amxmodx>
#include <hamsandwich>
 
public plugin_init() {
        
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
}
 
public 
fwHamPlayerSpawnPost(iPlayer) {
        if (
is_user_alive(iPlayer)) {
                
// player spawned
        
}


public 
UseCommand()
{
    
server_cmd("c_chicken #%d"get_user_userid(iPlayer))")
    return PLUGIN_HANDLED

but i can't compile it like that i get this error message:
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

chicken-mod.sma(16) : error 017: undefined symbol "iPlayer"
chicken-mod.sma(16 -- 17) : warning 215: expression has no effect

1 Error.
Could not locate output file chicken-mod.amx (compile failed).
sorry i'm not really good at it
Ravi81 is offline
ZaX
Senior Member
Join Date: Jan 2015
Old 06-07-2022 , 12:57   Re: Chicken fight pluigin or mod
Reply With Quote #12

Code:
#include <amxmodx> #include <hamsandwich>   public plugin_init() {         RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1) }   public fwHamPlayerSpawnPost(iPlayer) {         if (is_user_alive(iPlayer)) {                 UseCommand(iPlayer)         } } public UseCommand(iPlayer) {     server_cmd("c_chicken #%d", get_user_userid(iPlayer))     return PLUGIN_HANDLED }
ZaX is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-08-2022 , 00:26   Re: Chicken fight pluigin or mod
Reply With Quote #13

Quote:
Originally Posted by Ravi81 View Post
Like this ?

PHP Code:
#include <amxmodx>
#include <hamsandwich>
 
public plugin_init() {
        
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
}
 
public 
fwHamPlayerSpawnPost(iPlayer) {
        if (
is_user_alive(iPlayer)) {
                
// player spawned
        
}


public 
UseCommand()
{
    
server_cmd("c_chicken #%d"get_user_userid(iPlayer))")
    return PLUGIN_HANDLED

but i can't compile it like that i get this error message:
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

chicken-mod.sma(16) : error 017: undefined symbol "iPlayer"
chicken-mod.sma(16 -- 17) : warning 215: expression has no effect

1 Error.
Could not locate output file chicken-mod.amx (compile failed).
sorry i'm not really good at it
No. I said to put it in your is_user_alive() check. That is to say that it needs to go inside the code that executes when the user is alive. In this case, it's where you currently have the comment "// player spawned".

Having a separate function is not required with this plugin but in the future, it could be useful if you're looking to use the function multiple times in your plugin.

If you're interested in learning more (which I can only assume since you're posting in Scripting Help), you might want to consider looking at some tutorials or other known working, simple plugins to learn the basics of programming.
__________________

Last edited by fysiks; 06-08-2022 at 22:09.
fysiks is offline
Ravi81
Junior Member
Join Date: Jun 2022
Old 06-08-2022 , 16:15   Re: Chicken fight pluigin or mod
Reply With Quote #14

it works thanks a lot for the help everyone

I'll check out the tutorial, thanks for the link

Last edited by Ravi81; 06-08-2022 at 16:17.
Ravi81 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 03:05.


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