AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Round End Event (https://forums.alliedmods.net/showthread.php?t=140613)

Schwabba 10-14-2010 16:13

Round End Event
 
Hi, i got a strange problem here

PHP Code:

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent"EventRoundStart"2"1=Round_Start" );
    
register_logevent"EventRoundEnd"2"1=Round_End" );


PHP Code:

public EventRoundStart( )
{
    do 
something


works fine, but

PHP Code:

public EventRoundEnd( )
{
    do 
something


doesen't work, but why?

SaM.ThE.MaN 10-14-2010 16:26

Re: Round End Event
 
Quote:

Originally Posted by Schwabba (Post 1324812)
Hi, i got a strange problem here

PHP Code:

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent"EventRoundStart"2"1=Round_Start" );
    
register_logevent"EventRoundEnd"2"1=Round_End" );


PHP Code:

public EventRoundStart( )
{
    do 
something


works fine, but

PHP Code:

public EventRoundEnd( )
{
    do 
something


doesen't work, but why?

First of all ... it should work ...
2nd of all , perhaps there is something wrong with ur code ... post it O.o

Schwabba 10-14-2010 16:31

Re: Round End Event
 
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <core>

new PLUGIN[]  = "Deathrun Manager"
new AUTHOR[]  = "Schwabba"
new VERSION[] = "1.0"

new bool:g_dr_on;
new 
g_dr_T;
new 
g_dr_T_nick[32];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
set_task(2.0,"StartBot")
    
set_task(5.0,"DRcheck",0,_,_,"b")
    
register_logevent"EventRoundStart"2"1=Round_Start" );
    
register_logevent"EventRoundEnd"2"1=Round_End" );
}

public 
StartBot()
{
    new 
BotName[] = "Pingstars.de"
    
new Bot engfunc(EngFunc_CreateFakeClientBotName)
    
dllfunc(MetaFunc_CallGameEntity"player"Bot)
    
set_pev(Botpev_flagsFL_FAKECLIENT)
    
set_pev(Botpev_model"")
    
set_pev(Botpev_viewmodel2"")
    
set_pev(Botpev_modelindex0)
    
set_pev(Botpev_renderfxkRenderFxNone)
    
set_pev(Botpev_rendermodekRenderTransAlpha)
    
set_pev(Botpev_renderamt0.0)
    
cs_set_user_team(BotCS_TEAM_T)
}

public 
DRcheck() 
{
    if(!
g_dr_on)
    {
        new 
iPlayers[32],iNum
        get_players
(iPlayersiNum);
        if (
iNum 2)
        {
            
print_color(010"^x04-=[Pingstars]=- ^x03 Deathrun ^x01 wird gestartet.")
            
g_dr_on true
            DRchange
()
        }
    }
}

public 
DRchange()
{
    
g_dr_T random(32) +1
    
if(is_user_connected(g_dr_T))
    {
        
get_user_name(g_dr_Tg_dr_T_nick31);
        
print_color(010"^x04-=[Pingstars]=- ^x03 %s ( %d ) ^x01 ist jetzt der Terrorist."g_dr_T_nickg_dr_T)
    }
    else
    {
        
DRchange()
    }
}

public 
EventRoundEnd( )
{
    if(
g_dr_on)
    {
        
DRchange()
    }
}

public 
print_color(idcidcolor, const message[], any:...)
{
    new 
msg[192]
    
vformat(msgcharsmax(msg), message5)
    
/*      //if you want to use ML, enable
    replace_all(msg, charsmax(msg), "!g", "^x04")
    replace_all(msg, charsmax(msg), "!n", "^x01")
    replace_all(msg, charsmax(msg), "!t", "^x03")*/
    
new param
    
if (!cid) return
    else 
param cid
    
new team[32]
    
get_user_team(paramteam31)
    switch (
color)
    {
        case 
0msg_teaminfo(paramteam)
        case 
1msg_teaminfo(param"TERRORIST")
        case 
2msg_teaminfo(param"CT")
        case 
3msg_teaminfo(param"SPECTATOR")
    }
    if (
idmsg_saytext(idparammsg)
    else 
msg_saytext(0parammsg)
    if (
color != 0msg_teaminfo(paramteam)
}

msg_saytext(idcidmsg[])
{
    
message_begin(id?MSG_ONE:MSG_ALLget_user_msgid("SayText"), {0,0,0}, id)
    
write_byte(cid)
    
write_string(msg)
    
message_end()
}

msg_teaminfo(idteam[])
{
    
message_begin(MSG_ONEget_user_msgid("TeamInfo"), {0,0,0}, id)
    
write_byte(id)
    
write_string(team)
    
message_end()



nikhilgupta345 10-14-2010 17:13

Re: Round End Event
 
Take out the space

EventRoundEnd( )
make it like this
EventRoundEnd()

Maybe it's thinking the space is a parameter :O

And you don't have EventRoundStart in that code :O

issen1 10-14-2010 17:20

Re: Round End Event
 
Quote:

Originally Posted by nikhilgupta345 (Post 1324859)
Take out the space

EventRoundEnd( )
make it like this
EventRoundEnd()

Maybe it's thinking the space is a parameter :O

And you don't have EventRoundStart in that code :O

The space doesn't matter.

Have you tried adding some print statements to see if you are actually jumping in the forward?

greets

Schwabba 10-14-2010 17:27

Re: Round End Event
 
Quote:

Originally Posted by issen1 (Post 1324867)
The space doesn't matter.

Have you tried adding some print statements to see if you are actually jumping in the forward?

greets

Yes, nothing happens.

issen1 10-14-2010 17:32

Re: Round End Event
 
PHP Code:

#include <amxmodx>

new PLUGIN[]  = "Deathrun Manager"
new AUTHOR[]  = "Schwabba"
new VERSION[] = "1.0"

public plugin_init(){
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent"EventRoundEnd"2"1=Round_End" );
}
public 
EventRoundEnd( )
    
client_print(0print_chat"HAHAHA"

Works fine for me.

Schwabba 10-14-2010 18:44

Re: Round End Event
 
Wow, this is weird..


EDIT:

PHP Code:

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_logevent("EventRoundEnd"2"1=Round_End" );
    
set_task(2.0,"DRcheck",0,_,_,"b")


now it works.. bah


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

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