then how do i get this to compile the one that came with amxx .20 rc6 sucks ......WILL SOMEONE compile this for me IN .20
Code:
#include <amxmod>
#include <ns2amx>
#include <ns2amx-fun>
#define SPAWN_DELAY 4.0 // Per player in seconds
#define MAX_MULTIPLIER 6 // Maximum multiplier * SPAWN_DELAY (2*8+5=21 max spawn time)
#define HUD_CHANNEL 1 // 1-4 Used for the time to spawn info text. May clash with other plugins.
#define MARINE 1
#define ALIEN 2
#define FREE_LOOK 3
#define DEAD_RESPAWNABLE 3
new sysname[95] = "Cheesy's Respawn System"
enum {
PLAYERCLASS_NONE = 0,
PLAYERCLASS_ALIVE_MARINE,
PLAYERCLASS_ALIVE_HEAVY_MARINE,
PLAYERCLASS_ALIVE_LEVEL1,
PLAYERCLASS_ALIVE_LEVEL2,
PLAYERCLASS_ALIVE_LEVEL3,
PLAYERCLASS_ALIVE_LEVEL4,
PLAYERCLASS_ALIVE_LEVEL5,
PLAYERCLASS_ALIVE_DIGESTING,
PLAYERCLASS_ALIVE_GESTATING,
PLAYERCLASS_DEAD_MARINE,
PLAYERCLASS_DEAD_ALIEN,
PLAYERCLASS_COMMANDER,
PLAYERCLASS_REINFORCING,
PLAYERCLASS_SPECTATOR
}
enum {
PLAYMODE_UNDEFINED = 0,
PLAYMODE_READYROOM = 1,
PLAYMODE_PLAYING = 2,
PLAYMODE_AWAITINGREINFORCEMENT = 3, // Player is dead and waiting in line to get back in
PLAYMODE_REINFORCING = 4, // Player is in the process of coming back into the game
PLAYMODE_OBSERVER = 5
}
new g_maxplayers
new Float:g_qstarttime[3], Float:g_spawntime[3]
new bool:g_spawning[3], bool:g_spawning2[3]
new g_ScoreInfo[33][7]
new g_msgScoreInfo, g_msgHudText2
new Float:g_lasttimenotify
new g_is_combat = -1
public plugin_init() {
register_plugin("Cheesy's Respawn System", "1.4c", "Cheesy Peteza")
register_cvar("cheesysrespawn_version", "1.4c", FCVAR_SERVER)
if ( is_combat() ) {
g_maxplayers = get_maxplayers()
g_msgScoreInfo = get_user_msgid("ScoreInfo")
g_msgHudText2 = get_user_msgid("HudText2")
register_event("ResetHUD", "playerSpawned", "b")
register_event("ScoreInfo","editScoreInfo","ab")
register_msgedit("HudText2", "editHudText2")
register_msgedit("SayText", "editSayText")
set_task(0.25, "checkStatus",_,_,_,"b")
}
}
public checkStatus() {
new numinqueue[3]
for (new id = 1; id <= g_maxplayers; ++id) { // Stop people spawning and count how many there is in the queue
if ( is_user_alive(id) || !is_entity(id) )
continue
new team = pev(id, pev_team)
if ( g_spawning[team] || (team != MARINE && team != ALIEN) )
continue
++numinqueue[team]
}
for (new team = 1; team <= 2; ++team) {
if (numinqueue[team] > 0) {
numinqueue[team] = clamp(numinqueue[team], 1, MAX_MULTIPLIER)
if (g_qstarttime[team] == 0.0)
g_qstarttime[team] = get_gametime()
new Float:spawndelay = ( numinqueue[team] -1 ) * SPAWN_DELAY + 5
g_spawntime[team] = (g_qstarttime[team] + spawndelay) - get_gametime() + 2.5
// Have to add 2.5 to the end here otherwise as soon as a player
// died he'd spawn straight away, and waves wouldn't happen
if ( g_spawntime[team] <= 5.0 ) // Takes 5 seconds for NS to spawn a player after
spawnPlayers(team) // setting their class to REINFORCING
}
}
if ( get_gametime() - g_lasttimenotify >= 0.75) { // Show time till spawn message once every 3/4 second
g_lasttimenotify = get_gametime()
displaySpawnTime(numinqueue)
}
return PLUGIN_HANDLED
}
spawnPlayers(team) {
g_spawning[team] = true // Stop checking for dead players were in the middle of spawning people
/*set_task(5.0, "teamSpawnedReset", 24338+team)*/ // Just incase for some reason we don't detect people spawning, this
// is a backup that kicks in after 5 seconds if the team doesn't spawn.
for (new id = 1; id <= g_maxplayers; ++id) {
if (pev(id, pev_team) != team) continue
if (is_user_alive(id)) continue
if ( pev(id, pev_deadflag) > 0 ) { // OBSERVER is what we set them to
set_pev(id, pev_playerclass, PLAYMODE_REINFORCING) // so they don't spawn.
sendReinforcing(id) // Update the scoreboard with "Reinforcing".
set_task(0.1, "sendReinforcingTT", id) // Weird I have to call this function externally.
} // I don't think AMXMod can handle sending 2
} // messages in the same function.
}
public playerSpawned(id) { // For detecting when a team has actually spawned after being set to REINFORCING class.
if (g_ScoreInfo[id][5] == 0) return PLUGIN_HANDLED // They just came from the ready room, ignore them.
new model[64]
pev(id, pev_model, model, 63)
if ( !equal("models/player.mdl", model) )
return PLUGIN_HANDLED // Fix for a possible exploit
new team = pev(id, pev_team)
if (!g_spawning[team]) return PLUGIN_HANDLED
if (g_spawning2[team]) return PLUGIN_HANDLED // Only set_task once, but give people time to spawn too
g_spawning2[team] = true
set_task(0.2, "teamSpawnedReset", team) // Give people time to spawn
remove_task(24338+team) // Disable the backup system
/* if (pev(id,pev_health) < 1.0 ) playerSpawned(id)*/
return PLUGIN_HANDLED
}
public teamSpawnedReset(team) {
if (team > 24338) team -= 24338 // For the backup system
g_qstarttime[team] = 0.0
g_spawning[team] = false // Enable checking for dead players again, the spawning is over.
g_spawning2[team] = false
}
public displaySpawnTime(numinqueue[]) { // Display time to spawn info to dead players.
for (new id = 1; id <= g_maxplayers; ++id) {
if ( pev(id, pev_deadflag) != DEAD_RESPAWNABLE ) continue
new team = pev(id, pev_team)
if ( team != MARINE && team != ALIEN )
continue
new deadtime[7]
format(deadtime, 6, " + %.0f", SPAWN_DELAY)
new calctext[128] = "5"
for (new i; i < ( numinqueue[team] -1 ); ++i)
add(calctext, 127, deadtime) // calctext = "5 + 2 + 2 + 2 + 2"
new hudtext[256]
if ( g_spawning[team] )
if (pev(id, pev_playerclass) == PLAYMODE_REINFORCING) {
format(hudtext, 255, "%s^n^nTime till spawn: Spawning^n(%.0f seconds per dead player) [max %d secs]",
sysname, SPAWN_DELAY, floatround((MAX_MULTIPLIER-1)*SPAWN_DELAY+5))
} else {
format(hudtext, 255, "%s^n^nTime till spawn: Waiting for next wave^n(%.0f seconds per dead player) [max %d secs]",
sysname, SPAWN_DELAY, floatround((MAX_MULTIPLIER-1)*SPAWN_DELAY+5))
}
else
format(hudtext, 255, "%s^n^nTime till spawn: %0.f^n(%.0f seconds per dead player) [max %d secs]^n%s",
sysname, g_spawntime[team]-2, SPAWN_DELAY, floatround((MAX_MULTIPLIER-1)*SPAWN_DELAY+5), calctext)
new is_marine = (team == MARINE)
set_hudmessage(is_marine?0:160, is_marine?75:100, is_marine?100:0, 0.1, 0.1, 0, 0.0, 60.0, 0.0, 0.0, HUD_CHANNEL)
show_hudmessage(id, hudtext)
}
}
public editScoreInfo() { // Replace Scoreboard "Reinforcing" with "DEAD" we will send "Reinforcing" ourselves.
new id = read_data(1)
for (new i; i<6; ++i)
g_ScoreInfo[id][i] = read_data(i+2)
}
public sendReinforcing(id) { // Update the Score board with the "Reinforcing"
message_begin(MSG_ALL, g_msgScoreInfo)
write_byte ( id )
write_short ( g_ScoreInfo[id][0] )
write_short ( g_ScoreInfo[id][1] )
write_short ( g_ScoreInfo[id][2] )
write_byte ( PLAYERCLASS_REINFORCING )
write_short ( g_ScoreInfo[id][4] )
write_short ( g_ScoreInfo[id][5] )
message_end()
}
public editHudText2() { // Change "You are Spawning..." to "You are in a queue for reinforcing..."
new id = msg_dest() // if they aren't actual about to spawn.
new text[32]
msg_data(1, text, 31)
if (!equal(text, "ReinforcingMessage")) return PLUGIN_CONTINUE
if (!is_entity(id)) return PLUGIN_CONTINUE
new team = pev(id, pev_team)
if (!g_spawning[team])
msg_set_s(1, "ReinforcementMessage")
return PLUGIN_CONTINUE
}
public sendReinforcingTT(id) {
message_begin(MSG_ONE, g_msgHudText2,_,id)
write_string("ReinforcingMessage")
write_byte(1)
message_end()
}
public server_frame() { // Because we changed the players class they can view both teams in spectator mode. Here we fix that.
for (new id=1; id <= g_maxplayers; ++id) {
if ( pev(id, pev_deadflag) != DEAD_RESPAWNABLE ) continue
new viewingid = pev(id, pev_iuser2)
if (viewingid == 0) continue
if ( pev(viewingid, pev_team) == pev(id, pev_team) ) continue
if ( pev(id, pev_team) == 0 ) continue // Ignore Spectators
new team[32], players[32], num
get_user_team(id, team, 31)
get_players(players, num, "ae", team)
if (num) {
set_pev(id, pev_iuser2, players[random_num(0,num-1)]) // Make them look at someone on their team.
} else {
set_pev(id, pev_iuser1, FREE_LOOK) // Nobody to look at, look at the wall.
set_pev(id, pev_iuser2, 0)
}
}
return PLUGIN_HANDLED
}
public editSayText() { // Need to manually block team chat messages from going to the other team due to player class changes
new text[256]
msg_data(2, text, 255)
if (contain(text, "(TEAM)") != -1) {
new fromid = msg_data(1)
new toid = msg_dest()
if ( pev(fromid, pev_team) != pev(toid, pev_team) )
return PLUGIN_HANDLED
}
return PLUGIN_CONTINUE
}
public keyvalue() {
switch (g_is_combat) {
case -1: {
new mapname[4]
get_mapname(mapname, 3)
if (equal(mapname, "co_")) g_is_combat = 1
else g_is_combat = 0
}
case 0: return
case 1: {
new classname[32], key[32], value[32]
copy_keyvalue(classname, 31, key, 31, value, 31)
if (equal(key, "maxspawndistance")) {
set_keyvalue("maxspawndistance","9999")
}
}
}
}