AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   help me to create a sprite plugin (https://forums.alliedmods.net/showthread.php?t=172882)

made.tn 11-27-2011 03:39

help me to create a sprite plugin
 
thanks for all who's help me

PHP Code:

#include <amxmodx>
#include <fun>

public plugin_init()
{
    
register_clcmd("say /menu""menu")
}

public 
menu(id)
{
    new 
menu menu_create("Menu Name""menu_handler")
    
    
menu_additem(menu"Give 100 hp ""1")
    
menu_additem(menu"Give 500 hp ""2")
    
menu_additem(menu"Give 1000 hp ""3")
    
    
menu_display(idmenu0)
}

public 
menu_handler(idmenuitem)
{
    new 
maxdata[64], maxnames[64], accesscallback
    
    menu_item_getinfo
(menuitemaccessmaxdatasizeof maxdata 1maxnamessizeof maxnames 1callback)
    
    new 
key str_to_num(maxdata)
    new 
health get_user_health(id)
    
    switch (
key)
    {
        case 
1:
        {
            
set_user_health(idhealth 100)
        }case 
2:
        {
            
set_user_health(idhealth 500)
        }case 
3:
        {
            
set_user_health(idhealth 1000)
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED


PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "play sound"
#define VERSION "1.0"
#define AUTHOR "made.tn"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("start",2,"1=Round_Start")
    
register_logevent("end",2,"1=Round_End")
    
register_logevent("welcome",2,"1=entered the game")
}

public 
plugin_precache() {
    
precache_sound("csound/roundstr.wav")
    
precache_sound("csound/roundend.wav")
    
precache_sound("csound/welcome.wav")
    return 
PLUGIN_CONTINUE
}

public 
start(id) {
    
set_hudmessage(025500.20, -1.003.01.21.31.4)
    
show_hudmessage(id"::Round start::")
    
client_cmd(0"spk csound/roundstr.wav")
    return 
PLUGIN_CONTINUE
}

public 
end(id) {
    
set_hudmessage(5520000.20, -1.003.01.21.31.4)
    
show_hudmessage(id"::round end::")
    
client_cmd(0"spk csound/roundend.wav")
    return 
PLUGIN_CONTINUE
}

public 
welcome(id) {
    
set_hudmessage(025500.20, -1.003.01.21.31.44)
    
show_hudmessage(id"Hello client!")
    
client_cmd(0"spk csound/welcome.wav")
    return 
PLUGIN_CONTINUE


now I'd like to help me to create a plugin:
if the round end a sprite was exected to the Alive players

PHP Code:

#include <amxmodx>
#include <amxmisc>
// if there are others include write it

#define PLUGIN "Round end effect"
#define VERSION "1.0"
#define AUTHOR "made.tn"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("endspr",2,"1=Round_End")
}

public 
plugin_precache() {
    
precache_generic("example/example.spr")
    return 
PLUGIN_CONTINUE
}


public 
endspr()
{
    
// what i do to exec this spr file "example/example.spr" to the alive Players



kiki33hun 11-27-2011 05:12

Re: help me to create a sprite plugin
 
This example to zp:
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <fakemeta_util>
#include <zp_dsohud>
#include <zombieplague>

// Win sprites dirs'
new const g_zombie_win[] = "sprites/zombie_plague/zombie_win.spr"
new const g_human_win[] = "sprites/zombie_plague/human_win.spr"

new g_maxplayers

public plugin_init()
{
    
register_plugin("[ZP] Advanced Win Msgs.""1.0""@bdul!");
    
    
// Round start event
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
    
// Retrieve max players
    
g_maxplayers get_maxplayers()
}

// Prechache the sprites
public plugin_precache()
{
    
precache_model(g_zombie_win)
    
precache_model(g_human_win)
}

// Remove win sprites on new round
public event_round_start()
{
    static 
id
    
for (id 1id <= g_maxplayersid++)
        
zp_remove_hud_sprite(id)
}

public 
zp_round_ended(win_team)
{
    
// No one won ?
    
if (win_team == WIN_NO_ONE)
        return
    
    
// Set the sprites on players HUD
    
static id
    
for (id 1id <= g_maxplayersid++)
    {
        if (
win_team == WIN_HUMANS)
            
zp_display_hud_sprite(idg_human_win0.04)
        else
            
zp_display_hud_sprite(idg_zombie_win0.05)
    }




All times are GMT -4. The time now is 08:33.

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