AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [....] (https://forums.alliedmods.net/showthread.php?t=140010)

Erdener 10-08-2010 06:02

[....]
 
[....]

Arkshine 10-08-2010 06:15

Re: [HELP] Don't Compile
 
Ham_PlayerAddItem -> Ham_AddPlayerItem

hornet 10-08-2010 06:17

Re: [HELP] Don't Compile
 
EDIT: I was going to suggest a missing bracket somewhere in the plugin which I experience sometimes quite frequently :S

hornet 10-08-2010 06:31

Re: [HELP] Don't Compile
 
Quote:

Your plugin successfully compiled!
What dyou mean - how did it fail?

Arkshine 10-08-2010 06:31

Re: [HELP] Don't Compile
 
It doesn't fail, it compiles. It's just a warning because the plugin is not properly indented. You can ignore.

SaM.ThE.MaN 10-08-2010 06:35

Re: [HELP] Don't Compile
 
There you go ... no warnings or errors , I would like to tell you , loose indentations arent much of a big deal , dont worry about them ... they are just little warnings

PHP Code:

#include <amxmodx>
#include <cstrike>
#include <fun>
#include <hamsandwich>

new const PLUGIN[] = "Jailbreak Days Vote"
new const VERSION[] = "1.0"
new const AUTHOR[] = "Wrecked"

new const prefix[] = "!g[Jailbreak]!y"

#define DAYS        7
#define VOTE_TIME    6.0
#define TASKID        1996
#define START_TASKID    1998

new iVotes[DAYS]

new const 
DAYSNAMES[DAYS][] =
{
    
"Zombie Day",
    
"Cage Day",
    
"Free Day",
    
"Spartan Day",
    
"War Day",
    
"Knife Day",
    
"Other Day"
}

new 
iVoteAmount

new bool:b_DayChosen

new bool:b_NoWep

new menu

public plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR // :avast:
    
    
register_event"HLTV""EVENT_NewRound""a""1=0""2=0" // new round, no freezetime
    
    
RegisterHamHam_Spawn"player""HAM_Spawn_Post")
    
RegisterHamHam_AddPlayerItem"player""HAM_Add_Item_Pre")
    
    
set_task7.0"EVENT_NewRound"START_TASKID // since HLTV isn't called on mapstart
}

public 
HAM_Add_Item_PreidiEnt )
{
    if( 
cs_get_user_teamid ) == CS_TEAM_T && b_NoWep && b_DayChosen )
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;
}

public 
HAM_Spawn_Postid )
{
    if( !
is_user_aliveid ) || !b_DayChosen )
        return 
HAM_IGNORED;
        
    new 
bigger 0
    
    
for( new 1DAYSi++ ) // thanks seta
    
{
        if( 
iVotes[i] > iVotes[bigger] )
        {
            
bigger i
        
}
    }
    
    
EXEC_DayActionidbigger )
    
    return 
HAM_IGNORED;
}

public 
EVENT_NewRound()
{
    
b_DayChosen false
    b_NoWep 
false
    remove_task
TASKID )
    
remove_taskSTART_TASKID )
    
    for( new 
0sizeofiVotes ); i++ )
    {
        
iVotes[i] = 0
    
}
    
    
menu menu_create"What day will today be?""MENU_Handler" )
    
    for( new 
0DAYSz++ )
    {
        new 
menuitem[64]
        new 
number[10]
        
formatexmenuitem63"%s"DAYSNAMES[z] )
        
formatexnumber9"%d")
        
        
menu_additemmenumenuitemnumber)
    }
    
    
menu_setpropmenuMPROP_EXITMEXIT_ALL )
    
    new 
iPlayers[32]
    new 
iNum
    
    get_players
iPlayersiNum )
    
    new 
id
    
    
for( new 0iNumi++ )
    {
        
id iPlayers[i]
        
        if( 
cs_get_user_teamid ) == CS_TEAM_CT )
        {
            
menu_displayidmenu)
            
            
iVoteAmount++
        }
    }
    
    
UPDATE_Hud()
    
    
set_taskVOTE_TIME"TASK_GetDay"TASKID )
}

public 
MENU_Handleridmenuitem )
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroymenu )
        
        return 
PLUGIN_HANDLED;
    }
    
    new 
name[64]
    new 
data[6]
    new 
access
    
new callback
    
    menu_item_getinfo
menuitemaccessdata5name63callback )
    
    new 
choice str_to_numdata )
    
    
iVotes[choice-1]++
    
iVoteAmount--
    
    
menu_destroymenu )
    
    
UPDATE_Hud()
    
    return 
PLUGIN_HANDLED;
}

public 
TASK_GetDay()
{
    new 
bigger 0;
    
    for( new 
1DAYSi++ ) // thanks Seta
    
{
        if( 
iVotes[i] > iVotes[bigger] )
        {
            
bigger i
        
}
    }
    
    
EXEC_DayAction0bigger )
}

EXEC_DayActionplriValue )
{
    
b_DayChosen true
    
    
new iPlayers[32]
    
    new 
iNum 1
    
    
if( plr )
    {
        
iPlayers[0] = plr
    
}
    else
    {
        
get_playersiPlayersiNum )
    }
    
    new 
id
    
    
switch( iValue )
    {
        case 
1// zombie
        
{
            for( new 
0iNumi++ )
            {
                
id iPlayers[i]
                
                if( 
cs_get_user_teamid ) == CS_TEAM_T && is_user_aliveid ) )
                {
                    
set_user_healthid2000 )
                }
            }
        
            
            
b_NoWep true
            ChatColor
plr plr 0"%s Today is a!g zombie day!y! All terrorists get!g 2000!y HP!"prefix )
        }
        
        case 
2// cage
        
{
            
ChatColorplr plr 0"%s Everyone get to the!g cage!y and listen to orders! It's a!g cage day!"prefix )
            
b_NoWep false
        
}
        
        case 
3// free
        
{
            
ChatColorplr plr 0"%s Today is a!g free day!"prefix )
            
b_NoWep false
        
}
        
        case 
4// spartan
        
{
            for( new 
0iNumi++ )
            {
                
id iPlayers[i]
                
                if( 
cs_get_user_teamid ) == CS_TEAM_T && is_user_aliveid ) )
                {
                    
strip_user_weaponsid )
                    
                    
give_itemid"weapon_deagle" )
                    
cs_set_user_bpammoidCSW_DEAGLE35 )
                    
                    
give_itemid"weapon_shield" )
                }
            }
            
            
ChatColorplr plr 0"%s Today is a!g spartan day!y!"prefix )
            
b_NoWep true
        
}
        
        case 
5// war
        
{
            for( new 
0iNumi++ )
            {
                
id iPlayers[i]
        
                if( 
is_user_aliveid ) )
        {
            
strip_user_weaponsid )
                
            new 
iWep give_itemid"weapon_m3" )
                
            
cs_set_weapon_ammoiWep32 // 32, right?
        
}
            }
            
            
ChatColorplr plr 0"%s Today is a!g war day!y!"prefix )
            
b_NoWep true
        
}
        
        case 
6// knife
        
{
            for( new 
0iNumi++ )
            {
                
id iPlayers[i]
                
                if( 
is_user_aliveid ) )
        {
            
strip_user_weaponsid )
            
            if( 
cs_get_user_teamid ) == CS_TEAM_CT )
            {
                
give_itemid"weapon_knife" // requested by chris
                
set_user_healthid1000 )
            }
        }
            }
            
            
ChatColorplr plr 0"%s Today is a!g knife day!y!"prefix )
            
b_NoWep true
        
}
        
        case 
7// other
        
{
            
ChatColorplr plr 0"%s Today is an!g other day!y!"prefix )
            
b_NoWep false
        
}
    }
}

stock UPDATE_Hud()
{
    new 
message[256]
    new 
iLen
    
    iLen 
+= formatexmessagecharsmaxmessage ) - iLen"%s v%s by %s^n^n"PLUGINVERSIONAUTHOR )
    for( new 
0DAYSi++ )
    {    
        
iLen += formatexmessage[iLen], charsmaxmessage ) - iLen"%s [%d Vote%s]^n"DAYSNAMES[i], iVotes[i], ( iVotes[i] == ) ? "" "s" )
    }
    
iLen += formatexmessage[iLen], charsmaxmessage ) - iLen"^nRemaining Votes: %d"iVoteAmount )
    
    
set_hudmessage2552552550.560.0206.02.0 )
    
show_hudmessage0"%s"message )
}

stock ChatColorid, const input[], any:... )
{
    new 
count 1;
    new 
players[32];
    static 
msg[191];
    
vformat(msg190input3);
    
    
replace_all(msg190"!g""^4"); // Green Color
    
replace_all(msg190"!y""^1"); // Default Color
    
replace_all(msg190"!team""^3"); // Team Color
    
replace_all(msg190"!team2""^0"); // Team2 Color
    
    
if (id)
    
players[0] = id
    else
    
get_players(playerscount"ch");
    
    for (new 
0counti++)
    {
        if (
is_user_connected(players[i]))
        {
            
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i]);
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
        }
    }



YamiKaitou 10-08-2010 09:01

Re: [HELP] Don't Compile
 
Please don't blank your posts as it can potentially assist other users if they encounter the same issue


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

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