AlliedModders Donor
|
09-04-2013
, 20:24
[solved] Tank same coordinate
|
#1
|
Hello,
i found this plugin but doesn't work's....
I do not want to use confogl
same map :
Tank spawn: [17%]
Tank spawn: [21%]
PHP Code:
#pragma semicolon 1
#include <sourcemod> #include <sdktools>
#define DEBUG_BS 0
#define MAX_TANKS 5 #define MAX_WITCHES 5
const NUM_OF_SURVIVORS = 4; const TEAM_SURVIVOR = 2; const TEAM_INFECTED = 3;
//Survivor indexing stuff new iSurvivorIndex[NUM_OF_SURVIVORS] = 0;
SI_BuildIndex() { if (!IsServerProcessing()) {return;} new ifoundsurvivors = 0; decl char; // Make sure kicked survivors don't freak us out. for(new i = 0; i < NUM_OF_SURVIVORS;i++) iSurvivorIndex[i]=0; for (new client = 1; client <= MaxClients; client++) { if (ifoundsurvivors == NUM_OF_SURVIVORS) { break; } if (!IsClientInGame(client) || GetClientTeam(client) != 2) { continue; } char = GetEntProp(client,Prop_Send,"m_survivorCharacter"); ifoundsurvivors++; if (char > 3 || char < 0) { continue; } iSurvivorIndex[char] = 0; if (!IsPlayerAlive(client)) { continue; } iSurvivorIndex[char] = client; } }
public SI_BuildIndexDelay_Event(Handle:event, const String:name[], bool:dontBroadcast) { CreateTimer(0.3, SI_BuildIndex_Timer); }
public Action:SI_BuildIndex_Timer(Handle:timer) { SI_BuildIndex(); }
public SI_BuildIndex_Event(Handle:event, const String:name[], bool:dontBroadcast) { SI_BuildIndex(); }
GetSurvivorIndex(index) { if (index < 0 || index > 3) { return 0; } return iSurvivorIndex[index]; }
//Map data functions and stuff new Handle:kMIData = INVALID_HANDLE;
stock GetMapValueInt(const String:key[], defvalue=0) { return KvGetNum(kMIData, key, defvalue); } stock Float:GetMapValueFloat(const String:key[], Float:defvalue=0.0) { return KvGetFloat(kMIData, key, defvalue); } stock GetMapValueVector(const String:key[], Float:vector[3], Float:defvalue[3]=NULL_VECTOR) { KvGetVector(kMIData, key, vector, defvalue); }
//The actual boss spawning stuff new bool:BS_bIsFirstRound = true; new bool:BS_bDeleteWitches = false; new bool:BS_bFinaleStarted = false; new bool:BS_bExpectTankSpawn = false;
new BS_iTankCount[2]; new BS_iWitchCount[2];
new Float:BS_fTankSpawn[MAX_TANKS][3]; new Float:BS_fWitchSpawn[MAX_WITCHES][2][3];
new String:BS_sMap[64];
public BS_OnModuleStart() { HookEvent("tank_spawn", BS_TankSpawn); HookEvent("witch_spawn", BS_WitchSpawn); HookEvent("round_end", BS_RoundEnd, EventHookMode_PostNoCopy); HookEvent("finale_start", BS_FinaleStart, EventHookMode_PostNoCopy); }
public BS_OnMapStart() { BS_bIsFirstRound = true; BS_bFinaleStarted = false; BS_bExpectTankSpawn = false; BS_iTankCount[0] = 0; BS_iTankCount[1] = 0; BS_iWitchCount[0] = 0; BS_iWitchCount[1] = 0; GetCurrentMap(BS_sMap, sizeof(BS_sMap)); }
public Action:BS_WitchSpawn(Handle:event, const String:name[], bool:dontBroadcast) { new iWitch = GetEventInt(event, "witchid"); if (BS_bDeleteWitches) { // Used to delete round2 extra witches, which spawn on round start instead of by flow AcceptEntityInput(iWitch, "Kill"); return; } // Can't track more witches if our witch array is full if (BS_iWitchCount[!BS_bIsFirstRound] >= MAX_WITCHES) return; if (BS_bIsFirstRound) { // If it's the first round, track our witch. GetEntPropVector(iWitch, Prop_Send, "m_vecOrigin", BS_fWitchSpawn[BS_iWitchCount[0]][0]); GetEntPropVector(iWitch, Prop_Send, "m_angRotation", BS_fWitchSpawn[BS_iWitchCount[0]][1]); BS_iWitchCount[0]++; } else if (BS_iWitchCount[0] > BS_iWitchCount[1]) { // Until we have found the same number of witches as from round1, teleport them to round1 locations TeleportEntity(iWitch, BS_fWitchSpawn[BS_iWitchCount[1]][0], BS_fWitchSpawn[BS_iWitchCount[1]][1], NULL_VECTOR); BS_iWitchCount[1]++; } }
//Doesn't seem to do anything here /*Action:BS_OnTankSpawn_Forward() { BS_bExpectTankSpawn = true; return Plugin_Continue; }*/
public Action:BS_TankSpawn(Handle:event, const String:name[], bool:dontBroadcast) { // Don't touch tanks on finale events if (BS_bFinaleStarted) return; // Stop if this isn't the first tank_spawn for this tank if(!BS_bExpectTankSpawn) return; BS_bExpectTankSpawn = false; // Don't track tank spawns on c5m5 or tank can spawn behind other team. if(StrEqual(BS_sMap, "c5m5_bridge") || StrEqual(BS_sMap, "c8m1_apartment")) return; new iTankClient = GetClientOfUserId(GetEventInt(event, "userid")); if (GetMapValueInt("tank_z_fix")) FixZDistance(iTankClient); // fix stuck tank spawns, ex c1m1 // If we reach MAX_TANKS, we don't have any room to store their locations if (BS_iTankCount[!BS_bIsFirstRound] >= MAX_TANKS) return; if (BS_bIsFirstRound) { GetClientAbsOrigin(iTankClient, BS_fTankSpawn[BS_iTankCount[0]]);
BS_iTankCount[0]++; } else if (BS_iTankCount[0] > BS_iTankCount[1]) { TeleportEntity(iTankClient, BS_fTankSpawn[BS_iTankCount[1]], NULL_VECTOR, NULL_VECTOR);
BS_iTankCount[1]++; } }
public Action:BS_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast) { BS_bIsFirstRound = false; BS_bFinaleStarted = false; if(StrEqual(BS_sMap, "c6m1_riverbank")) { BS_bDeleteWitches = false; } else { BS_bDeleteWitches = true; CreateTimer(5.0, BS_WitchTimerReset); } }
public Action:BS_FinaleStart(Handle:event, const String:name[], bool:dontBroadcast) BS_bFinaleStarted = true;
public Action:BS_WitchTimerReset(Handle:timer) { BS_bDeleteWitches = false; }
FixZDistance(iTankClient) { decl Float:TankLocation[3]; decl Float:TempSurvivorLocation[3]; decl index; GetClientAbsOrigin(iTankClient, TankLocation); for (new i = 0; i < NUM_OF_SURVIVORS; i++) { new Float:distance = GetMapValueFloat("max_tank_z", 99999999999999.9); index = GetSurvivorIndex(i); if (index != 0 && IsValidEntity(index)) { GetClientAbsOrigin(index, TempSurvivorLocation); if (FloatAbs(TempSurvivorLocation[2] - TankLocation[2]) > distance) { new Float:WarpToLocation[3]; GetMapValueVector("tank_warpto", WarpToLocation); if (!GetVectorLength(WarpToLocation, true)) { LogMessage("[BS] tank_warpto missing from mapinfo.txt"); return; } TeleportEntity(iTankClient, WarpToLocation, NULL_VECTOR, NULL_VECTOR); } } } }
Could you correct for it to work ?
Sincerely,
Last edited by eric0279; 09-06-2013 at 08:49.
|
|