AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   !spawn (https://forums.alliedmods.net/showthread.php?t=147304)

rodrigo286 01-07-2011 19:43

!spawn
 
I used the code of two plugins forum here to make a plugin to revive with a limit of uses, but when you get error compiles, what did I do wrong?

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new g_spawn_modeg_spawn_max
new bool:g_canspawn[33], g_used[33]
new 
Float:g_spawns[33][3], Float:g_angles[33][3]

public 
plugin_init()
{    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("dr_extra_sPawn",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
    
    
g_ztele_mode register_cvar("dr_extra_spawn_mode""0"// 0 - both teams, 1 - humans, 2 - zombies
    
g_ztele_max register_cvar("dr_extra_spawn_max""3"// how many times you can use ztele
    
        
register_clcmd("say /spawn""CmdSpawn");
    
register_clcmd("say !spawn""CmdSpawn");
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn"1)
    
}

public 
client_connect(id)
{
    
g_used[id] = 0
    g_canztele
[id] = false
}

public 
client_disconnect(id)
{
    
g_used[id] = 0
    g_canztele
[id] = false
}

public 
fw_PlayerSpawn(id)
{
    if (!
is_user_alive(id))
        return 
HAM_IGNORED
    
    g_canztele
[id] = false
    
    pev
(idpev_origing_spawns[id])
    
pev(idpev_anglesg_angles[id])
    
    
client_print(idprint_chat"[Deathrun] este server está rodando drspawn by Rodrigo286, use !spawn para renascer")
    
    return 
HAM_IGNORED
}

public 
CmdSpawn(id)
{
    if (!
is_user_alive(id))
    {
        
g_used[id] = 0
        g_canspawn
[id] = false
        
        client_print
(idprint_chat"[Deathrun] voce precisa estar morto para usar !spawn")
        
        return 
PLUGIN_HANDLED
    
}
    
    switch (
get_pcvar_num(g_spawn_mode))
    {
        case 
1:
        {
            if (
zp_get_user_human(id))
            {
                
teleport_player(id)
            
client_print(idprint_chat"[Deathrun] Voce foi revido para seu spawn.")
            
client_print(idprint_chat"[Deathrun] Voce reviveu %d de %d vezes"get_pcvar_num(g_spawn_max))
            }
        }
    }
    
    if (
get_pcvar_num(g_spawn_max) == g_used[id])
    {
        
g_canspawn[id] = false
        client_print
(idprint_chat"[Deathrun] Voce nao pode reviver novamente voce usou %d de %d vezes"get_pcvar_num(g_spawn_max))
        
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}


public 
CmdSpawn(id)
    
    
ExecuteHamB(Ham_CS_RoundRespawnid); 
}

stock teleport_player(id)
{
    
g_used[id]++
    
    
set_pev(id,pev_origing_spawns[id])
    
set_pev(idpev_anglesg_angles[id])

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(Ham_CS_RoundRespawn)
    
engfunc(EngFunc_WriteCoordg_spawns[id][0])
    
engfunc(EngFunc_WriteCoordg_spawns[id][1])
    
engfunc(EngFunc_WriteCoordg_spawns[id][2])
    
message_end()


error:

[IMG]http://img808.**************/img808/8361/plugin.png[/IMG]

Thanks!

Pantheon 01-07-2011 19:45

Re: !spawn
 
Replace
register_plugin(PLUGIN, VERSION, AUTHOR)
with
register_plugin("The Plugin Name", "The Actual Version", "The Author")

rodrigo286 01-07-2011 20:05

Re: !spawn
 
I fixed it, but now has another error

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

new g_spawn_modeg_spawn_max
new bool:g_canspawn[33], g_used[33]
new 
Float:g_spawns[33][3], Float:g_angles[33][3]

public 
plugin_init()
{    
    
register_plugin("drspawm""1.0""Rodrigo286")
    
register_cvar("dr_extra_sPawn",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
    
    
g_ztele_mode register_cvar("dr_extra_spawn_mode""0"// 0 - both teams, 1 - humans, 2 - zombies
    
g_ztele_max register_cvar("dr_extra_spawn_max""3"// how many times you can use ztele
    
        
register_clcmd("say /spawn""CmdSpawn");
    
register_clcmd("say !spawn""CmdSpawn");
    
    
RegisterHam(Ham_Spawn"player""fw_PlayerSpawn"1)
    
}

public 
client_connect(id)
{
    
g_used[id] = 0
    g_canztele
[id] = false
}

public 
client_disconnect(id)
{
    
g_used[id] = 0
    g_canztele
[id] = false
}

public 
fw_PlayerSpawn(id)
{
    if (!
is_user_alive(id))
        return 
HAM_IGNORED
    
    g_canztele
[id] = false
    
    pev
(idpev_origing_spawns[id])
    
pev(idpev_anglesg_angles[id])
    
    
client_print(idprint_chat"[Deathrun] este server está rodando drspawn by Rodrigo286, use !spawn para renascer")
    
    return 
HAM_IGNORED
}


public 
CmdSpawn(id)
{
    if (!
is_user_alive(id))
    {
        
g_used[id] = 0
        g_canspawn
[id] = false
        
        client_print
(idprint_chat"[Deathrun] voce precisa estar morto para usar !spawn")
        
        return 
PLUGIN_HANDLED
    
}
    
    switch (
get_pcvar_num(g_spawn_mode))
    {
        case 
1:
        {
            if (
zp_get_user_human(id))
            {
                
teleport_player(id)
            
client_print(idprint_chat"[Deathrun] Voce foi revido para seu spawn.")
            
client_print(idprint_chat"[Deathrun] Voce reviveu %d de %d vezes"get_pcvar_num(g_spawn_max))
            }
        }
    }
    
    if (
get_pcvar_num(g_spawn_max) == g_used[id])
    {
        
g_canspawn[id] = false
        client_print
(idprint_chat"[Deathrun] Voce nao pode reviver novamente voce usou %d de %d vezes"get_pcvar_num(g_spawn_max))
        
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE
}


public 
CmdSpawn(id)
    
    
ExecuteHamB(Ham_CS_RoundRespawnid); 
}

stock teleport_player(id)
{
    
g_used[id]++
    
    
set_pev(id,pev_origing_spawns[id])
    
set_pev(idpev_anglesg_angles[id])

    
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
    
write_byte(Ham_CS_RoundRespawn)
    
engfunc(EngFunc_WriteCoordg_spawns[id][0])
    
engfunc(EngFunc_WriteCoordg_spawns[id][1])
    
engfunc(EngFunc_WriteCoordg_spawns[id][2])
    
message_end()


[IMG]http://img703.**************/img703/1273/plugin2c.png[/IMG]

DarkGod 01-07-2011 20:14

Re: !spawn
 
Change VERSION to the same thing as you did before...?

rodrigo286 01-08-2011 12:50

Re: !spawn
 
Can anyone help me or make me a simple plugin with a command !spawn to spawn, with a limit of two uses is to deathrun.

lucas_7_94 01-08-2011 13:03

Re: !spawn
 
Who limits ?

rodrigo286 01-08-2011 13:12

Re: !spawn
 
2 usage limits, using the !spawn command the player revive but can only use this command for a maximum of two times.

lucas_7_94 01-08-2011 13:16

Re: !spawn
 
Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "author" new Limits[33] = 3 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_clcmd("say /respawn", "respawn") } public respawn(id) {     if ( Limits[id] >= 0 && !is_user_alive(id))     {         ExecuteHamB(Ham_CS_RoundRespawn, id)         Limits[id]--         client_print(id, print_chat, "[AMXX] Remaining %d Respawns", Limits[id])     } }

check no tested.

abdul-rehman 01-08-2011 13:25

Re: !spawn
 
Quote:

Originally Posted by lucas_7_94 (Post 1389115)
Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "author" new Limits[33] = 3 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_clcmd("say /respawn", "respawn") } public respawn(id) {     if ( Limits[id] >= 0 && !is_user_alive(id))     {         ExecuteHamB(Ham_CS_RoundRespawn, id)         Limits[id]--         client_print(id, print_chat, "[AMXX] Remaining %d Respawns", Limits[id])     } }

check no tested.

:arrow:
Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "author" new Limits[33] = 3 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_clcmd("say /respawn", "respawn") } public respawn(id) {     if ( Limits[id] >= 0 && !is_user_alive(id))     {         ExecuteHamB(Ham_CS_RoundRespawn, id)         Limits[id]--         client_print(id, print_chat, "[AMXX] Remaining %d Respawns", Limits[id])     } } public client_putinserver( id ) Limits[id] = 3 public client_disconnect( id ) Limits[id] = 3

lucas_7_94 01-08-2011 13:32

Re: !spawn
 
i forgot that.


All times are GMT -4. The time now is 02:11.

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