AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plaflag board (https://forums.alliedmods.net/showthread.php?t=321326)

yRestrict 02-05-2020 06:04

Plaflag board
 
I have a problem with this plugin,
sometimes he makes the wrong quote other times he disappears from the HUD could someone help me solve this problem
it and plate that counts how many flag were taken

PHP Code:

// Includes
#include <  amxmodx >
#include <   jctf   >

// Team
new score_Team];

// Team ( jCTF )
enum
{
    
TEAM_NONE 0,
    
TEAM_RED,
    
TEAM_BLUE,
    
TEAM_SPEC
}

public 
plugin_init( )
{
    
register_plugin"Placar""0.0.1""Developer" );

    
// Register TextMsg
    
register_event"TextMsg""event_TextMsg""a""2&#Game_C""2&#Game_w""2&#Game_will_restart_in" );

    
// Task HUD
    
set_task1.0"scoreFlag"___"b" );
}

public 
event_TextMsg( )
    
set_task3.0"taskReset" );

public 
taskReset( )
{
    
score_Team] = 0;
    
score_Team] = 0;
}

public 
jctf_flagevidtm )
{
    if( 
ev == FLAG_CAPTURED && tm == TEAM_RED )
        
score_Team] += 1;
    
    if( 
ev == FLAG_CAPTURED && tm == TEAM_BLUE )
        
score_Team] += 1;
}

public 
scoreFlag( )
{
    
set_dhudmessage255255255, -1.00.000.01.10.00.0 )
    
show_dhudmessage0"[TR] VS [CT]^n[%d] -- [%d]"score_Team], score_Team] )



Bugsy 02-05-2020 07:47

Re: Plaflag board
 
Untested

PHP Code:

// Includes
#include <  amxmodx >
#include <   jctf   >

enum Teams
{
    
TEAM_NONE 0,
    
TEAM_RED,
    
TEAM_BLUE,
    
TEAM_SPEC
}

new 
score_TeamTeams ];

public 
plugin_init( )
{
    
register_plugin"Placar""0.0.1""Developer" );

    
// Register TextMsg
    
register_event"TextMsg""event_TextMsg""a""2&#Game_C""2&#Game_w""2&#Game_will_restart_in" );

    
// Task HUD
    
set_task1.0"scoreFlag"___"b" );
}

public 
event_TextMsg( )
    
set_task3.0"taskReset" );

public 
taskReset( )
{
    
score_TeamTEAM_RED ] = 0;
    
score_TeamTEAM_BLUE ] = 0;
}

public 
jctf_flagev id tm )
{
    if( 
ev == FLAG_CAPTURED )
        
score_TeamTeams:tm ] += 1;
}

public 
scoreFlag( )
{
    
set_dhudmessage255255255, -1.00.000.01.10.00.0 )
    
show_dhudmessage0"[TR] VS [CT]^n[%d] -- [%d]"score_TeamTEAM_RED ], score_TeamTEAM_BLUE ] )



yRestrict 02-06-2020 20:35

Re: Placa plaflag
 
Quote:

Originally Posted by Bugsy (Post 2682813)
Untested

PHP Code:

// Includes
#include <  amxmodx >
#include <   jctf   >

enum Teams
{
    
TEAM_NONE 0,
    
TEAM_RED,
    
TEAM_BLUE,
    
TEAM_SPEC
}

new 
score_TeamTeams ];

public 
plugin_init( )
{
    
register_plugin"Placar""0.0.1""Developer" );

    
// Register TextMsg
    
register_event"TextMsg""event_TextMsg""a""2&#Game_C""2&#Game_w""2&#Game_will_restart_in" );

    
// Task HUD
    
set_task1.0"scoreFlag"___"b" );
}

public 
event_TextMsg( )
    
set_task3.0"taskReset" );

public 
taskReset( )
{
    
score_TeamTEAM_RED ] = 0;
    
score_TeamTEAM_BLUE ] = 0;
}

public 
jctf_flagevidtm )
{
    if( 
ev == FLAG_CAPTURED && tm == TEAM_RED )
        
score_TeamTEAM_RED ] += 1;
    
    if( 
ev == FLAG_CAPTURED && tm == TEAM_BLUE )
        
score_TeamTEAM_BLUE ] += 1;
}

public 
scoreFlag( )
{
    
set_dhudmessage255255255, -1.00.000.01.10.00.0 )
    
show_dhudmessage0"[TR] VS [CT]^n[%d] -- [%d]"score_TeamTEAM_RED ], score_TeamTEAM_BLUE ] )



===== c:\Users\maxtr\Downloads\Placar_1.sma =====
WARNING [37]: tag mismatch
WARNING [40]: tag mismatch

Bugsy 02-07-2020 06:45

Re: Plaflag board
 
I fixed the above code

yRestrict 02-07-2020 09:44

Re: Placa plaflag
 
Quote:

Originally Posted by Bugsy (Post 2683015)
I fixed the above code

but every time I try to compile it from this error how do I fix it?

Bugsy 02-07-2020 10:13

Re: Plaflag board
 
I didn't test compile since I'm on my phone. Do you get the same warning when compiling the revised code? If so I'll take a look later when I get home.

iceeedr 02-07-2020 10:59

Re: Plaflag board
 
PHP Code:

public jctf_flagevidtm )
{
    if( 
ev == FLAG_CAPTURED)
    {
        switch(
tm)
        {   
            case 
TEAM_REDscore_TeamTEAM_RED ] ++;
            case 
TEAM_BLUEscore_TeamTEAM_BLUE] ++;
        }
    }



Bugsy 02-07-2020 11:34

Re: Plaflag board
 
Not necessary to use a switch when you can pass team directly to the array as I did.

yRestrict 02-07-2020 14:41

Re: Plaflag board
 
Quote:

Originally Posted by Bugsy (Post 2683035)
I didn't test compile since I'm on my phone. Do you get the same warning when compiling the revised code? If so I'll take a look later when I get home.

that's right, I'm not able to compile plugin

yRestrict 02-07-2020 16:00

Re: Plaflag board
 
Quote:

Originally Posted by iceeedr (Post 2683039)
PHP Code:

public jctf_flagevidtm )
{
    if( 
ev == FLAG_CAPTURED)
    {
        switch(
tm)
        {   
            case 
TEAM_REDscore_TeamTEAM_RED ] ++;
            case 
TEAM_BLUEscore_TeamTEAM_RED ] ++;
        }
    }



I just made a short text using the code icedr compiled right, the sign stopped disappearing, but now it doesn't count for team CT


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

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