AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   set_user_xxx doesn't work (https://forums.alliedmods.net/showthread.php?t=1427)

Feivel 04-26-2004 18:31

set_user_xxx doesn't work
 
I'm writing my first plugin. For matters of legiblity i've cut the unimportant parts:

#include <amxmod>
#include <amxmisc>
#include <fun>

public plugin_init() {
register_plugin("AimTrain", "1.0", "Feivel")
register_clcmd("say aim", "Start_Aim", ADMIN_VOTE, " : Starts a new aiming session")
}


public Start_Aim(id, level, cid) {
if (!cmd_access(id, level, cid, 1)) {
return PLUGIN_HANDLED
}

new player[32] = {33, ...}
new num = 0
new health = 500
client_print(id, print_center, "Starting a new Round")
get_players(player, num)
set_user_health(id, health)
/* Some Code */
return PLUGIN_HANDLED
}

as long as I leave the "set_user_health"-line away the plugin runs fine. But when i use it i get a bad load for the plugin. In fact the plugin doesen't work with no set_user_xxx-function like set_user_armor and so on.
I played a bit around with all kind of indexes, numbers, ids and whatever. But nothin helps. Even copied code from other plugins doesn't work.

Someone knows why? thanks in advance.

Nick 04-27-2004 00:43

#include <amxmodx> instead of #include <amxmod>

BAILOPAN 04-27-2004 01:58

you don't have the fun module enabled

Feivel 04-27-2004 03:08

@Nick I don't have the file amxmodx. Where can i get it and where's the difference to the "normal" amxmod?

@Bailopan How do I activate modules?

BAILOPAN 04-27-2004 04:21

www.amxmodx.org/doc

open modules.ini and remove the comments ";"

Feivel 04-27-2004 07:53

Indeed i had to declarate it in metamod's plugin.ini to. That was the fault.

Thanks for your fast help.

Hangman5386 04-27-2004 09:30

Defining modules is only needed in old AMX versions. Since most of these old versions are really outdated, I'd have a look at AMXX if I were you. :)

Feivel 04-27-2004 10:09

lol
i never noticed theres a difference between amx and amxx :D Shame on me.
Ok, this "might" be the source of many of my problems. Would be worth a try :9

IceMouse[WrG] 04-27-2004 10:12

You might also want to try to use entity_set_int(id,EV_INT_health,health), instead of the user function...

AssKicR 04-27-2004 11:34

Quote:

Originally Posted by IceMouse[WrG
]You might also want to try to use entity_set_int(id,EV_INT_health,health), instead of the user function...

eh... why =/

Feivel 04-27-2004 12:20

I'm getting the feeling that I'm to stupid for scripting... :)
At least the plugin loads. But it does nothing. Besides printing the nice text...

Thats what it looks like now:

Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <string> #include <cstrike> public plugin_init() {     register_plugin("AimTrain", "1.0", "Feivel")     register_clcmd("say aim", "Start_Aim", ADMIN_VOTE, " : Starts a new aiming session") } public Start_Aim(id, level, cid) {     if (!cmd_access(id, level, cid, 1)) {         return PLUGIN_HANDLED     }         new player[32] = {33, ...}     new num = 0     new health = 500     client_print(id, print_center, "Starting a new Round")      get_players(player, num)         set_user_health(player[0], 80)     cs_set_user_money(player[0], 8000, 1);         return PLUGIN_HANDLED   }

Instead of using player[0] (what should be the index of the first player, shouldn't it?) i tried id and direct numbers (0, 1).

Where's my fault?

AssKicR 04-27-2004 13:19

FFS USE THE tags!!!!!!!!

[cTs] Strake*ROC* 04-27-2004 20:14

I just made a plugin like this the other day, works fine....

Code:
#include <amxmod> #include <fun> /* blah blah blah some stuff here, to the point */ set_user_health(id, float(500)) set_user_armor(id, float(100))

Feivel 04-27-2004 20:42

when i write it your way (with float) i get an "tag mismatch"-warning. but at least the plugin does something. Not the right stuff but something: setting health to 0 (without dying) and inverting my movement keys...

something here seems to run terrible wrong. Maybe i should reinstall everyting.


All times are GMT -4. The time now is 23:35.

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