Quote:
Originally Posted by Ravi81
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.
__________________