AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Register a death event when rounds end(help) (https://forums.alliedmods.net/showthread.php?t=277889)

wy4 o0 01-19-2016 10:44

Register a death event when rounds end(help)
 
Hi. I have a hidenseek server
Some of you knows the mod, and you know if you are TERRORIST, when round ends, and you are alive, you gain 1 frag for winning the round.

Now, i have created a mini frag based life system. When you reach 6 frags you gain 1 life by a DeathMsg event. So i want if it's possible to make an event for round ands, if I have 5 frags when the round ends to gain the life when the servers get me the frag for winning the round.

My code for that seems to be like this, but it doesn't work... like the event doesn't happens.
NOTE: The server gives me the frag when round starts/new round
You can find the hidenseeek plugin here

PHP Code:

public plugin_init(){
register_logevent("GiveALife"2"1=Round_End")  
}

public 
GiveALife() {

    new 
id read_data(1)    // Read id data !
    
new frags get_user_frags(id)
    
        if(
is_user_connected(id) && !is_user_bot(id) && is_user_alive(id) && frags == get_pcvar_num(plrfrags)  ) {
            
g_Life[id]++;
            
client_cmdid"spk woop" );
            
ColorChat(idRED"%s You gained^x04 1 life^x01 becouse you reached[^x03 %d^x01 ]^x04 frags^x01!"LIFETAGget_pcvar_num(plrfrags) )
        
    }
}


If someone wantts to help me with this, and he don't understand what I want to do, or for more lines from the entired code, just ask.
Sorry for my bad english :)

jimaway 01-19-2016 15:58

Re: Register a death event when rounds end(help)
 
Code:
new id = read_data(1)    // Read id data !
this is false. read_data() is used for reading data from messages.
that logevent isn't player specific and is only triggered once, you have to loop through all players

wy4 o0 01-20-2016 06:37

Re: Register a death event when rounds end(help)
 
Thanks dude for the suggestions, I forget that in events you should determinate all the players before executing/verifiyng something on them.
It's solved, you can close this topic.


All times are GMT -4. The time now is 09:30.

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