AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   kills to win (https://forums.alliedmods.net/showthread.php?t=55093)

flyeni6 05-13-2007 12:25

kills to win
 
im running FFA mode in CSDM.
im tring to make it so that when a person gets 50 kills and event will happen like a hud will appear "YOU WIN" or someting else.

how do i do that?

Alka 05-13-2007 12:52

Re: kills to win
 
somehting like this =>>
Code:

#include <amxmodx>
#include <csx>
#include <fakemeta>
 
#define PLUGIN ""
#define VERSION ""
#define AUTHOR ""
 
new kills[32]
 
public plugin_init() {
 
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_forward(FM_PlayerPreThink,"fm_playerprethink",0)
}
 
public client_death(killer,victim,weapon,hitplace,tk)
{
    kills[killer] += 1
}
 
public fm_playerprethink(id)
{
    if(kills[id] == 50)
    {
            set_hudmessage(id, 0,255, 0.33, 0.87, 1, 6.0, 6.0, 0.1, 0.1, -1 );
            show_hudmessage(id,"Wow you made 50 kills! 0.o");
    }
}


flyeni6 05-13-2007 13:07

Re: kills to win
 
thank u alka
lol i cant give u anymore karma.
it wont let me

flyeni6 05-13-2007 13:51

Re: kills to win
 
no im not trying to use csx.

like when someone gets 50 kills then the gm will restart
and everyones kills will restart

how do you do this?

Alka 05-13-2007 14:56

Re: kills to win
 
try this :)
Code:

#include <amxmodx>
#include <fun>
 
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Author"
 
new kills[32]
 
public plugin_init() {
 
    register_plugin(PLUGIN, VERSION, AUTHOR)
    register_event("DeathMsg", "p_death", "a")
}
 
public p_death()
{
        new killer = read_data(1)
 
        if (killerid == 0)
            return 0;
 
        kills[killer] += 1
 
        if(kills[id] == 50)
        {
            server_cmd("sv_restart 1")
            set_user_frags(0,0)
            kills[id] =0;
        }
}


XxAvalanchexX 05-13-2007 14:58

Re: kills to win
 
Don't check kills in prethink, check kills only when they are updated.

Alka 05-13-2007 15:02

Re: kills to win
 
Thanks..now should work...:D

flyeni6 05-13-2007 15:30

Re: kills to win
 
i tried compiling it and this is what it gave me
Code:

/home/groups/amxmodx/tmp3/textryCigB.sma(20) : error 017: undefined symbol "killerid"
/home/groups/amxmodx/tmp3/textryCigB.sma(25) : error 017: undefined symbol "id"
/home/groups/amxmodx/tmp3/textryCigB.sma(29) : error 017: undefined symbol "id"
/home/groups/amxmodx/tmp3/textryCigB.sma(29) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/textryCigB.sma(31) : warning 209: function "p_death" should return a value

3 Errors.
Could not locate output file /home/groups/amxmodx/public_html/websc3/textryCigB.amx (compile failed).


Deviance 05-13-2007 15:48

Re: kills to win
 
Code:

#include <amxmodx>

#define Plugin "50 kills"
#define Version "1.0"
#define Author "Doombringer"

public plugin_init()
{
        register_plugin(Plugin, Version, Author)
        register_event("DeathMsg", "hook_death", "a")
}

public hook_death()
{
        new killer = read_data(1)
        if(get_user_frags(killer) >= 50)
        {
                new name[32]
                get_user_name(killer, name, 31)
               
                set_hudmessage(0, 255, 0, -1.0, 0.36, 0, 6.0, 12.0)
                show_hudmessage(0, "%s has made 50 kills!^nRestarting...", name)
               
                server_cmd("sv_restart 1")
        }
}


flyeni6 05-13-2007 16:23

Re: kills to win
 
thx but how do you make it so that once you reach 50 kills
it will restart.

not when u get 51


All times are GMT -4. The time now is 10:32.

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