AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Terrorist Win (https://forums.alliedmods.net/showthread.php?t=140185)

SaM.ThE.MaN 10-09-2010 13:34

Terrorist Win
 
Hi,

I wanna make a script , like when a terrorist wins , ex:

register_logevent( "EventRoundEnd", 2. "Round_End" )

if(Terrorists win)
{
// my script
}

I wanna do this at round end ... thats why i added the register_logevent so you understand :D

SaM.ThE.MaN 10-09-2010 13:47

Re: Terrorist Win
 
OH WAIT A SECOND ... sory sorry ignore the round end thing ... since if cts or Ts win .. that wont be counted as round end -.-

Edit:
PHP Code:

register_event("SendAudio""t_win""a""2&%!MRAD_terwin")
register_event("SendAudio""ct_win""a""2&%!MRAD_ctwin"

Is this how i am supposed to do it ... i mean this is how i can get it ... then
public ct_win()
{
// my script
}

IS this right?

shuttle_wave 10-09-2010 23:32

Re: Terrorist Win
 
y not hook

PHP Code:

register_message(get_user_msgid("TextMsg"),    "msgTextMsg"); 

PHP Code:

public msgTextMsg()
{
    static 
textmsg[22];
    
get_msg_arg_string(2textmsg21);
    
    
// T Win
    
if(equal(textmsg"#Terrorists_Win"))
    {
        
// ADD WATEVER FOR T HERE
    
}
    
    
// Ct Win
    
else if(equal(textmsg"#CTs_Win"))
    {    
        
// ADD WATEVER FOR CT HERE
    
}
    
    return 
PLUGIN_CONTINUE;



SaM.ThE.MaN 10-10-2010 03:38

Re: Terrorist Win
 
Well ... which one is better?

Edit: I tried using what you gave me ... but can you help me with this problem , If CTS win they get 5000 ... But i get an error ... anyways here is the error and the script :

Script:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "sam"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_message(get_user_msgid("TextMsg"),    "msgTextMsg");
}

public 
msgTextMsg(id)
{
    static 
textmsg[22];
    
get_msg_arg_string(2textmsg21);
    
    
// T Win
    
if(equal(textmsg"#Terrorists_Win"))
    {
        
// ADD WATEVER FOR CT HERE
    
}
    
    
// Ct Win
    
else if(equal(textmsg"#CTs_Win"))
    {    
        
cs_set_user_money(idcs_get_user_money(id) + 5000 )
    }
    
    return 
PLUGIN_CONTINUE;


Error:
PHP Code:

L 10/10/2010 12:03:15: [CSTRIKEPlayer out of range (77)
L 10/10/2010 12:03:15: [AMXXDisplaying debug trace (plugin "Untitled.amxx")
L 10/10/2010 12:03:15: [AMXXRun time error 10native error (native "cs_get_user_money")
L 10/10/2010 12:03:15: [AMXX]    [0Untitled.sma::msgTextMsg (line 30


reinert 10-10-2010 04:14

Re: Terrorist Win
 
Check is user alive before giving money :)

shuttle_wave 10-10-2010 04:58

Re: Terrorist Win
 
Quote:

Originally Posted by SaM.ThE.MaN (Post 1320890)
Well ... which one is better?

Edit: I tried using what you gave me ... but can you help me with this problem , If CTS win they get 5000 ... But i get an error ... anyways here is the error and the script :

Script:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "sam"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_message(get_user_msgid("TextMsg"),    "msgTextMsg");
}

public 
msgTextMsg(id)
{
    static 
textmsg[22];
    
get_msg_arg_string(2textmsg21);
    
    
// T Win
    
if(equal(textmsg"#Terrorists_Win"))
    {
        
// ADD WATEVER FOR CT HERE
    
}
    
    
// Ct Win
    
else if(equal(textmsg"#CTs_Win"))
    {    
        
cs_set_user_money(idcs_get_user_money(id) + 5000 )
    }
    
    return 
PLUGIN_CONTINUE;


Error:
PHP Code:

L 10/10/2010 12:03:15: [CSTRIKEPlayer out of range (77)
L 10/10/2010 12:03:15: [AMXXDisplaying debug trace (plugin "Untitled.amxx")
L 10/10/2010 12:03:15: [AMXXRun time error 10native error (native "cs_get_user_money")
L 10/10/2010 12:03:15: [AMXX]    [0Untitled.sma::msgTextMsg (line 30


PHP Code:

public msgTextMsg(id

:arrow:
PHP Code:

public msgTextMsg() 

loop thru the players to give them that money

shuttle_wave 10-10-2010 05:19

Re: Terrorist Win
 
PHP Code:

else if(equal(textmsg"#CTs_Win")) 
{     
    new 
iPlayers[MAX_PLAYERS], iNumplayer;
    
get_players(iPlayersiNum"a");

    for(new 
i<= iNumi++)
    {
        
player iPlayers[i];
        
        if(
cs_get_user_team(player) == CS_TEAM_CT)
        {
            
cs_set_user_money(playercs_get_user_money(player) + 5000 );
        }



SaM.ThE.MaN 10-10-2010 07:30

Re: Terrorist Win
 
Quote:

Originally Posted by shuttle_wave (Post 1320953)
PHP Code:

else if(equal(textmsg"#CTs_Win")) 
{     
    new 
iPlayers[MAX_PLAYERS], iNumplayer;
    
get_players(iPlayersiNum"a");

    for(new 
i<= iNumi++)
    {
        
player iPlayers[i];
        
        if(
cs_get_user_team(player) == CS_TEAM_CT)
        {
            
cs_set_user_money(playercs_get_user_money(player) + 5000 );
        }



We do this method so msgTextMsg() <-- We do this method cause we dont need id here , Right? So it loops through players ... its that what your doing here..?

shuttle_wave 10-10-2010 07:32

Re: Terrorist Win
 
Quote:

Originally Posted by SaM.ThE.MaN (Post 1321033)
We do this method so msgTextMsg() <-- We do this method cause we dont need id here , Right? So it loops through players ... its that what your doing here..?

yes

SaM.ThE.MaN 10-10-2010 07:35

Re: Terrorist Win
 
alright ... works thank you..


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

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