Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /************ Includes ************/
- #include < amxmodx >
- #include < fun >
- #include < cstrike >
- #include < hamsandwich >
- /************ Defines ************/
- #define Prefix "AMXX"
- #define Timetowait 150
- /************ News ************/
- new Float: respawnchance[ 32 ]
- new bool:RoundEnd = false
- public plugin_init()
- {
- register_plugin( "reviveme", "v1.0", "RanAway" )
- // clcmd
- register_clcmd( "say /reviveme", "revive" )
- // Start / end round
- register_logevent( "EventRoundStart", 2, "1=Round_Start" )
- register_logevent( "EventEndRound", 2, "1=Round_End" )
- }
- /************ Connect ************/
- public client_putinserver( id ) respawnchance[ id ] = get_gametime()
- /************ Start / End round ************/
- public EventRoundStart( ) RoundEnd = false
- public EventEndRound( ) RoundEnd = true
- /************ Respawn chance ************/
- public revive( id )
- {
- /* if you spectator you can't use reviveme */
- if( cs_get_user_team( id ) == CS_TEAM_SPECTATOR )
- return ColorChat( id, "Spectator can't use reviveme" )
- /* if the round ended it will say to wait for the next round */
- if( RoundEnd )
- return ColorChat( id, "The ^3round ended.^1 you dont want to waste your respawn chance" )
- /* you have to be dead to use reviveme */
- if( is_user_alive( id ) )
- return ColorChat( id, "You have to be ^3dead^1 before you can attampt to respawn" )
- /* countdown from each attempt */
- else if( get_gametime() < respawnchance[ id ] + Timetowait )
- return ColorChat( id, "Sorry you can't try to respawn now. try again in ^3%d^1 seconds", floatround( respawnchance[ id ] + Timetowait - get_gametime() + 1 ) )
- switch( random_num( 1, 99 ) )
- {
- case 1..33:
- {
- new name[ 32 ]
- get_user_name( id, name, 32 )
- set_hudmessage( random( 255 ), random( 255 ), random( 255 ),-1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1 )
- show_hudmessage( 0, "%s won and has been respawned", name )
- ColorChat( id, "yay, you got ^3respawn" )
- give_item( id, "weapon_knife" )
- ExecuteHamB( Ham_CS_RoundRespawn, id )
- client_cmd( id, "spk debris/beamstart9" )
- }
- case 34..99: ColorChat( id, "Sorry, you didnt respawn this time" )
- }
- respawnchance[ id ] = get_gametime()
- return 1
- }
- /************ Color chat stock ************/
- stock ColorChat( const id, const string[], {Float, Sql, Resul,_}:...)
- {
- new msg[191], players[32], count = 1
- static len
- len = formatex(msg, charsmax(msg), "^3[^1 %s^3 ]^1 ", Prefix )
- vformat(msg[len], charsmax(msg) - len, string, 3)
- if( id )
- players[0] = id
- else
- get_players(players,count,"ch")
- for (new i = 0; i < count; i++)
- {
- if(is_user_connected(players[i]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"),_, players[i])
- write_byte(players[i])
- write_string(msg)
- message_end()
- }
- }
- return 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement