AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   deagle giver help (https://forums.alliedmods.net/showthread.php?t=49332)

adam3232 01-01-2007 22:56

deagle giver help
 
i am in the process of trying to make a plugin that gives every one deagles when they join and its not working can some one tell me what i have done rong?
Code:

#include <amxmodx>
#include <fun>
#include <engine>
 
//
 
public plugin_init()
{
 register_plugin("Dealge Giver","1.0","adam3232")
}
public client_putinserver(id)
{
 give_item(0,"14")
}


Mini_Midget 01-01-2007 23:07

Re: deagle giver help
 
client_putinserver(id)
is called when a player is connected in the server
You want an event which is called on spawn i believe.
Try this (untested)
PHP Code:

#include <amxmodx>
#include <fun>
#include <engine>
 
public plugin_init()
{
    
register_event("ResetHUD""event_hud_reset""be")
    
register_clcmd("fullupdate""clcmd_fullupdate"
    
register_event("TextMsg""event_restart_attempt""a""2=#Game_will_restart_in")
}

public 
clcmd_fullupdate() {
    return 
PLUGIN_HANDLED
}

public 
event_restart_attempt() {
    new 
players[32], num
    get_players
(playersnum"a")
    for (new 
inum; ++i)
        
g_restart_attempt[players[i]] = true
}

public 
event_hud_reset(id) {
    if (
g_restart_attempt[id]) {
        
g_restart_attempt[id] = false
        
return
    }

    
event_player_spawn(id)
}

// this function is called on player spawn
public event_player_spawn(id) {
    
give_item(0,"weapon_deagle")


Read this if you still having problems
http://forums.alliedmods.net/showthread.php?t=42159

SweatyBanana 01-02-2007 00:30

Re: deagle giver help
 
Quote:

Originally Posted by Mini_Midget (Post 422618)
client_putinserver(id)
is called when a player is connected in the server
You want an event which is called on spawn i believe.
Try this (untested)
PHP Code:

#include <amxmodx>
#include <fun>
#include <engine>
 
public plugin_init()
{
    
register_event("ResetHUD""event_hud_reset""be")
    
register_clcmd("fullupdate""clcmd_fullupdate"
    
register_event("TextMsg""event_restart_attempt""a""2=#Game_will_restart_in")
}

public 
clcmd_fullupdate() {
    return 
PLUGIN_HANDLED
}

public 
event_restart_attempt() {
    new 
players[32], num
    get_players
(playersnum"a")
    for (new 
inum; ++i)
        
g_restart_attempt[players[i]] = true
}

public 
event_hud_reset(id) {
    if (
g_restart_attempt[id]) {
        
g_restart_attempt[id] = false
        
return
    }

    
event_player_spawn(id)
}

// this function is called on player spawn
public event_player_spawn(id) {
    
give_item(0,"weapon_deagle")


Read this if you still having problems
http://forums.alliedmods.net/showthread.php?t=42159


give_item is in the fun module by the way.


All times are GMT -4. The time now is 22:27.

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