AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   NEED HELP! i need help with my sma... (https://forums.alliedmods.net/showthread.php?t=156807)

fai960820 05-12-2011 10:40

NEED HELP! i need help with my sma...
 
Code:

#include <amxmod>
new num_dead
new num_nolost
 
public dead(){
    new killer = read_data(1)
    new victim = read_data(2)
    new Killer[33]
    new Victim[33]
    get_user_name(killer, Killer,32)
    get_user_name(victim, Victim,32)
    if(get_user_team(victim) != get_user_team(killer)){
  if(get_user_money(victim) < get_pcvar_num(num_nolost)){
 set_hudmessage(255, 150, 50, 0.10, 0.5, 0, 6.0, 10.0, 0.5, 0.15, 9)
 show_hudmessage(0, "He Got No More MONEY")
}
else {
        new money = get_user_money(victim)
        set_user_money(victim, money - get_pcvar_num(num_dead))
}
    }
    return PLUGIN_CONTINUE
}
public plugin_init() { 
  register_plugin("kill Rewards","0.0","default")
  register_event("DeathMsg","dead","ade")
  num_dead = register_cvar("num_dead", "0")
num_nolost = register_cvar("num_nolost", "10000")
}

I can turn this sma into amxx, but it is not working well. Only when num_nolost is 0, or else i won't lost any money when i died. I want to set a number, when u got more money that this number, u will lost money when u are died. Please HELP! Is any part wrong, cuz i wrote it and i am a NOOB ):

Warning when i compile it:
compile: sma<18>: warning 217: loose indentation
compile: sma<30>: warning 217: loose indentation

Code:

register_event("DeathMsg","dead","ade")
And what is use of "ade" behind "dead" and somthings, there will be "5=0" "3=1" something like that. What is the use of these number?

K.K.Lv 05-12-2011 12:26

Re: NEED HELP! i need help with my sma...
 
1.amxmod ==> amxmodx
2.you should see more infomation about DeathMsg Event from here
3.use AMXX-Studio press ctrl + i indent you code !

SonicSonedit 05-12-2011 15:03

Re: NEED HELP! i need help with my sma...
 
Instead public dead hook player death with ham_killed: use Search.

fai960820 05-12-2011 19:13

Re: NEED HELP! i need help with my sma...
 
i don't know how to use ham_killed.... Sonic, can u show me what is the code please?

fysiks 05-12-2011 19:16

Re: NEED HELP! i need help with my sma...
 
If you don't need to modify anything in the death then you are just fine using DeathMsg.

Quote:

Originally Posted by fai960820 (Post 1468032)
Code:

register_event("DeathMsg","dead","ade")
And what is use of "ade" behind "dead" and somthings, there will be "5=0" "3=1" something like that. What is the use of these number?

See the documentation for register_event().

Also, you need to change "amxmod" to "amxmodx" and also include cstrike then use cs_get_user_money() and cs_set_user_money().

Other than that, it looks fine to me.

fai960820 05-12-2011 19:33

Re: NEED HELP! i need help with my sma...
 
register_event("DeathMsg","headshot","ade","3 =1","5=0")

Why the event for headshot is "3=1" "5=0"?

fysiks 05-12-2011 19:40

Re: NEED HELP! i need help with my sma...
 
Quote:

Originally Posted by fai960820 (Post 1468279)
Why the event for headshot is "3=1" "5=0"?

Where did you get that? There is no 5th argument for DeathMsg. See the link that K.K.Lv posted. "IsHeadshot" is the 3rd argument. If it is 1 and not 0 then it was a headshot kill.

fai960820 05-12-2011 21:28

Re: NEED HELP! i need help with my sma...
 
Code:

#include <amxmodx>
#include <cstrike>
new num_dead
new num_nolost
public death(){
new killer = read_data(1)
new victim = read_data(2)
new Killer[33]
new Victim[33]
get_user_name(killer, Killer,32)
get_user_name(victim, Victim,32)
 
if(get_user_team(victim) != get_user_team(killer)){
if(cs_get_user_money(victim) < get_pcvar_num(num_nolost)){
set_hudmessage(255, 150, 50, 0.10, 0.5, 0, 6.0, 10.0, 0.5, 0.15, 9)
show_hudmessage(0, "He Got No More MONEY")
}
else {
new money = cs_get_user_money(victim)
cs_set_user_money(victim, money - get_pcvar_num(num_dead))
}
}
return PLUGIN_CONTINUE
}
public plugin_init() {
register_plugin("kill Rewards","0.0","default")
register_event("DeathMsg","death","ade")
num_dead = register_cvar("num_dead", "5000")
num_nolost = register_cvar("num_nolost", "10000")
}

It is still not working....Is any thing wrong?

I get that from a sma that get bouns money when headshot, may be that sma is wrong too...

fysiks 05-12-2011 21:39

Re: NEED HELP! i need help with my sma...
 
Use only "a" and not "ade" (as 'de' and 'e' contradict eachother). See if that works. If not, you need to learn to debug: see if code is being executed at all by using client_print(0, print_chat, "message") in code that doesn't seem to be working and see if it shows up. You can also check values of variables to see if they are what you think they are.

fai960820 05-12-2011 22:07

Re: NEED HELP! i need help with my sma...
 
It works! Thx ALOT! (:


All times are GMT -4. The time now is 04:20.

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