Senior Member
|
11-18-2011
, 18:14
Re: improvement mode
|
#6
|
Quote:
Originally Posted by rhelgeby
If I understand you correctly, you want people to actually cross the finish line (and stay there) in escape map to win, instead of just avoiding being infected? It's an interesting idea.
This is theoretically possible, but it requires some work by the server admin to configure this. Initially, a plugin can't detect where the finish line in a map is. However, if the map has a named trigger volume (brush entity), a plugin can search for this trigger and hook its events, so that it knows which players that are inside it (and when they enter/leave).
If such triggers doesn't exist, they can be made by the server admin to define the safe zone in the escape map. This is the tricky part, because defining such volumes if far from user friendly and require some understanding of 3D-volumes. It's both possible to define fake and real triggers. The existing volumetric features in ZR use fake triggers.
An optimal solution would actually be to design a "standard" for escape map elements, such as the finish line. This standard would simply just be predefined names for trigger volumes in the map that ZR would find and use.
I'm not sure if I understand your second request. Do you want players to respawn where they died (teleported back)? This could work, but there are some risks. We don't know if the place they died is safe to go back to. This is possibly something that could be solved with this escape map "standard" idea, where there are one or more zones in the map that ZR could safely teleport players to.
|
1. The ZE escape option is very simple possibility. Create a console command flagged as a cheat that once executed simply ends the round with the human's victory. Then have the mapper create a trigger_once and have it execute a console command with that command.
2. The respawn option has already been made. I made a plugin that(although a little buggy) will set it so that unless you kill the zombie with a headshot, the zombie will respawn where he died.
This plugin(below) also features a few other things, also are a little buggy. Note: It says in the author's notes that I removed headshot only mode... all I did was merely comment out the parts for that feature.
Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#pragma semicolon 1
#define MAXPLAYERS 64
#define PLUGIN_VERSION "0.6"
#define TEAM_T 2
#define TEAM_CT 3
/*
* Author Notes:
* 1. Terrorist respawn
check death of teammate
if respawns are left,
start timer, 5 second respawn
2. create array for players and ammount of respawns left.
3. if death != headshot, respawn player, zombify them and teleport them to previous position.
*
*
* version .14 :
* * removed headshot only mode.
*
*/
//new Handle:cvarrespawncount = INVALID_HANDLE;
//new Handle:cvarrespawntime = INVALID_HANDLE;
//new Handle:cvarheadshots = INVALID_HANDLE;
new RespawnCount[MAXPLAYERS+1];
//new Float:ZombieDeathLoc[MAXPLAYERS+1][3];
//new bool:Zombiehashead[MAXPLAYERS+1];
//new bool:ZombieDied[MAXPLAYERS+1];
new PlayerWeapon[MAXPLAYERS+1][2][3];
new bool:latespawn, bool: PlayerisSwapping[MAXPLAYERS+1];
public Plugin:myinfo =
{
name = "Zombiemod Addon",
author = "InstantDeath",
description = "Adds many features",
version = PLUGIN_VERSION,
url = "http://www.xpgaming.net"
}
public OnPluginStart()
{
CreateConVar("sm_zombiemodaddons_version", PLUGIN_VERSION, "Zombiemod Addons version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
//cvarheadshots = CreateConVar("sm_zombie_headshotsonly", "1", "If set to 1, the zombie will only lose a life by headshot.");
RegConsoleCmd("swap_primary", Command_SwapPrimary);
//HookEvent("player_death", Event_PlayerDeath);
//HookEvent("player_spawn", Event_PlayerSpawn);
//HookEvent("round_end", RoundEndEvent);
//HookEvent("player_death", BeforePlayerDeath, EventHookMode_Pre);
//HookEvent("round_freeze_end",RoundFreezeEndEvent);
//HookEvent("player_team", OnPlayerChangeTeam);
//HookEvent("player_spawn", OnPlayerSpawn);
}
public Action:OnPlayerSpawn(Handle:event,const String:name[],bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"userid")); // Get clients index
new ClientTeam = GetClientTeam(client);
if(ClientTeam == TEAM_CT)
{
new weaponid = GetPlayerWeaponSlot(client, 1);
SetEntityRenderFx(client, RENDERFX_FADE_FAST);
if(weaponid != -1)
SetEntityRenderFx(weaponid, RENDERFX_FADE_FAST);
SetEntProp(client, Prop_Data, "m_takedamage", 0, 1);
CreateTimer(5.1,EndSpawnProtect, client,TIMER_FLAG_NO_MAPCHANGE);
}
}
public Action:EndSpawnProtect(Handle:timer, any:index)
{
new weaponid = GetPlayerWeaponSlot(index, 1);
SetEntityRenderFx(index, RENDERFX_NONE);
if(weaponid != -1)
SetEntityRenderFx(weaponid, RENDERFX_NONE);
SetEntProp(index, Prop_Data, "m_takedamage", 2, 1);
return Plugin_Stop;
}
public Action:RoundFreezeEndEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
latespawn = false;
CreateTimer(30.0,PlayerLateSpawn,TIMER_FLAG_NO_MAPCHANGE);
}
public OnClientPutInServer(client)
{
if(client != 0 && latespawn)
{
RespawnCount[client] = 2;
}
else if(client != 0 && !latespawn)
{
RespawnCount[client] = 0;
}
for(new a = 0; a <= 3; a++)
{
PlayerWeapon[client][0][a] = -1;
PlayerWeapon[client][1][a] = -1;
}
}
public Action:PlayerLateSpawn(Handle:timer)
{
latespawn = true;
return Plugin_Stop;
}
public Action:RespawnClient(Handle:timer, any:index)
{
new userid = GetClientUserId(index);
new teamindex = GetClientTeam(index);
if(teamindex == TEAM_T)
{
CS_RespawnPlayer(index);
ServerCommand("zombie_player #%d", userid);
}
else
CS_RespawnPlayer(index);
return Plugin_Handled;
}
public Action:ZombieRespawnClient(Handle:timer, any:index)
{
new userid = GetClientUserId(index);
CS_RespawnPlayer(index);
ServerCommand("zombie_player #%d", userid);
return Plugin_Handled;
}
public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new teamindex = GetClientTeam(client);
new String: Weapon[32];
new attacker = GetEventInt(event, "attacker");
GetEventString(event, "weapon", Weapon, sizeof(Weapon));
/* zombie_claws_of_death
if(teamindex == TEAM_T)
{
if(GetEventInt(event, "attacker") == 0)
return Plugin_Continue;
//ZombieDied[client] = true;
if(ZombieRespawnCount[client] > 0 && !roundend)
{
//Zombiehashead[client] = false;
ZombieRespawnCount[client] = ZombieRespawnCount[client] - 1;
CreateTimer(respawntime,ZombieRespawn, client,TIMER_FLAG_NO_MAPCHANGE);
}
}*/
if(StrEqual(Weapon, "zombie_claws_of_death", true) || attacker == 0 || attacker == client)
return Plugin_Continue;
// check teams
new TeamTcount = GetTeamClientCount(TEAM_T), TeamCTcount = GetTeamClientCount(TEAM_CT);
if(TeamTcount > TeamCTcount)
{
if(teamindex == TEAM_T)
{
CS_SwitchTeam(client, TEAM_CT);
CreateTimer(3.0,RespawnClient, client,TIMER_FLAG_NO_MAPCHANGE);
}
else
CreateTimer(3.0,RespawnClient, client,TIMER_FLAG_NO_MAPCHANGE);
}
else if(TeamTcount < TeamCTcount)
{
if(teamindex == TEAM_CT)
{
CS_SwitchTeam(client, TEAM_T);
CreateTimer(3.0,RespawnClient, client,TIMER_FLAG_NO_MAPCHANGE);
}
else
CreateTimer(3.0,RespawnClient, client,TIMER_FLAG_NO_MAPCHANGE);
}
else
CreateTimer(3.0,RespawnClient, client,TIMER_FLAG_NO_MAPCHANGE);
return Plugin_Continue;
}
public Action:BeforePlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
// get players entity ids
new victim = GetClientOfUserId(GetEventInt(event, "userid"));
new String:weaponname[32];
if(IsClientInGame(victim))
{
if(PlayerWeapon[victim][0][0] != -1)
{
GetWeaponByID(PlayerWeapon[victim][0][0], weaponname, sizeof(weaponname));
GivePlayerItem(victim, weaponname);
PlayerWeapon[victim][0][0] = -1;
PlayerWeapon[victim][0][1] = -1;
PlayerWeapon[victim][0][2] = -1;
//PrintToConsole(client, "Weapon: %s", weaponname);
}
if(PlayerWeapon[victim][1][0] != -1)
{
GetWeaponByID(PlayerWeapon[victim][1][0], weaponname, sizeof(weaponname));
GivePlayerItem(victim, weaponname);
PlayerWeapon[victim][1][0] = -1;
PlayerWeapon[victim][1][1] = -1;
PlayerWeapon[victim][1][2] = -1;
}
PlayerisSwapping[victim] = false;
}
return Plugin_Continue;
}
public Action:OnPlayerChangeTeam(Handle:event,const String:name[],bool:dontBroadcast)
{
new userid = GetEventInt(event,"userid");
new client = GetClientOfUserId(userid); // Get clients index
new team = GetEventInt(event, "team");
if(IsClientInGame(client))
{
if(!IsPlayerAlive(client) && team > 1)
{
if(RespawnCount[client] > 0)
{
CreateTimer(1.0,ZombieRespawnClient, client,TIMER_FLAG_NO_MAPCHANGE);
RespawnCount[client]--;
}
}
}
return Plugin_Continue;
}
//transfers weapon to and from backpack
public Action:TimedWeaponSwap(Handle: timer, any:client)
{
new String:weaponname[32];
new weaponid;
//PrintToConsole(client, "[SM] Ran TimedWeaponSwap");
weaponid = GetPlayerWeaponSlot(client, 0);
if(PlayerWeapon[client][0][0] != -1)
{
//PrintToConsole(client, "[SM] backpack is not empty");
GetWeaponByID(PlayerWeapon[client][0][0], weaponname, sizeof(weaponname));
GivePlayerItem(client, weaponname);
//PrintToConsole(client, "Weapon: %s", weaponname);
weaponid = GetPlayerWeaponSlot(client, 0);
SetPrimaryAmmo(client, weaponid, PlayerWeapon[client][0][1]);
GetEdictClassname(weaponid, weaponname, sizeof(weaponname));
SetWeaponAmmo(client, GetWeaponAmmoOffset(weaponname), PlayerWeapon[client][0][2]);
PlayerWeapon[client][0][0] = PlayerWeapon[client][1][0];
PlayerWeapon[client][0][1] = PlayerWeapon[client][1][1];
PlayerWeapon[client][0][2] = PlayerWeapon[client][1][2];
PlayerWeapon[client][1][0] = -1;
PlayerWeapon[client][1][1] = -1;
PlayerWeapon[client][1][2] = -1;
PlayerisSwapping[client] = false;
}
else if(PlayerWeapon[client][0][0] == -1)
{
if(PlayerWeapon[client][1][0] != -1)
{
PlayerWeapon[client][0][0] = PlayerWeapon[client][1][0];
PlayerWeapon[client][0][1] = PlayerWeapon[client][1][1];
PlayerWeapon[client][0][2] = PlayerWeapon[client][1][2];
PlayerWeapon[client][1][0] = -1;
PlayerWeapon[client][1][1] = -1;
PlayerWeapon[client][1][2] = -1;
//PrintToConsole(client, "[SM] backpack is not empty");
GetWeaponByID(PlayerWeapon[client][0][0], weaponname, sizeof(weaponname));
GivePlayerItem(client, weaponname);
//PrintToConsole(client, "Weapon: %s", weaponname);
weaponid = GetPlayerWeaponSlot(client, 0);
SetPrimaryAmmo(client, weaponid, PlayerWeapon[client][0][1]);
GetEdictClassname(weaponid, weaponname, sizeof(weaponname));
SetWeaponAmmo(client, GetWeaponAmmoOffset(weaponname), PlayerWeapon[client][0][2]);
PlayerWeapon[client][0][0] = -1;
PlayerWeapon[client][0][1] = -1;
PlayerWeapon[client][0][2] = -1;
}
}
return Plugin_Stop;
}
public Action:Command_SwapPrimary(client, args)
{
new weaponid, clip1, clip2;
new String: weaponname[32];
new colors[3];
if(PlayerisSwapping[client])
return Plugin_Handled;
weaponid = GetPlayerWeaponSlot(client, 0);
if(weaponid != -1)
{
colors[0] = 225;
colors[1] = 10;
colors[2] = 0;
if(PlayerWeapon[client][0][0] != -1)
{
clip1 = GetPrimaryAmmo(client, weaponid);
GetEdictClassname(weaponid, weaponname, sizeof(weaponname));
clip2 = GetWeaponAmmo(client, GetWeaponAmmoOffset(weaponname));
//PrintToConsole(client, "Got Primary Ammo: %d", clip1);
//PrintToConsole(client, "Got Secondary Ammo: %d", clip2);
//PrintToConsole(client, "Weapon: %s", weaponname);
RemovePlayerItem(client, weaponid);
weaponid = GetWeaponidByName(weaponname);
PlayerWeapon[client][1][0] = weaponid;
PlayerWeapon[client][1][1] = clip1;
PlayerWeapon[client][1][2] = clip2;
SendDialogToOne(client, colors, "Swapping primary weapons, please wait.");
PlayerisSwapping[client] = true;
CreateTimer(1.1,TimedWeaponSwap, client,TIMER_FLAG_NO_MAPCHANGE);
weaponid = GetPlayerWeaponSlot(client, 1);
if(weaponid != -1)
{
ClientCommand(client, "slot2");
}
else
{
ClientCommand(client, "slot3");
}
}
//PrintToConsole(client, "weapon Entity index: %d", weaponid);
if(PlayerWeapon[client][0][0] == -1)
{
if(PlayerWeapon[client][1][0] == -1)
{
clip1 = GetPrimaryAmmo(client, weaponid);
GetEdictClassname(weaponid, weaponname, sizeof(weaponname));
clip2 = GetWeaponAmmo(client, GetWeaponAmmoOffset(weaponname));
//PrintToConsole(client, "Got Primary Ammo: %d", clip1);
//PrintToConsole(client, "Got Secondary Ammo: %d", clip2);
//PrintToConsole(client, "Weapon: %s", weaponname);
RemovePlayerItem(client, weaponid);
weaponid = GetWeaponidByName(weaponname);
PlayerWeapon[client][0][0] = weaponid;
PlayerWeapon[client][0][1] = clip1;
PlayerWeapon[client][0][2] = clip2;
SendDialogToOne(client, colors, "Your primary weapon was placed in your backpack.");
PlayerisSwapping[client] = false;
weaponid = GetPlayerWeaponSlot(client, 1);
if(weaponid != -1)
{
ClientCommand(client, "slot2");
}
else
{
ClientCommand(client, "slot3");
}
}
}
}
else if(PlayerWeapon[client][0][0] != -1)
{
PlayerisSwapping[client] = false;
GetWeaponByID(PlayerWeapon[client][0][0], weaponname, sizeof(weaponname));
GivePlayerItem(client, weaponname);
//PrintToConsole(client, "Weapon: %s", weaponname);
weaponid = GetPlayerWeaponSlot(client, 0);
SetPrimaryAmmo(client, weaponid, PlayerWeapon[client][0][1]);
GetEdictClassname(weaponid, weaponname, sizeof(weaponname));
SetWeaponAmmo(client, GetWeaponAmmoOffset(weaponname), PlayerWeapon[client][0][2]);
PlayerWeapon[client][0][0] = -1;
PlayerWeapon[client][0][1] = -1;
PlayerWeapon[client][0][2] = -1;
}
return Plugin_Handled;
}
public GetWeaponidByName(String:Weapon[])
{
if(StrEqual(Weapon, "weapon_ak47", false))
{
return 0;
}
else if(StrEqual(Weapon, "weapon_aug", false))
{
return 1;
}
else if(StrEqual(Weapon, "weapon_awp", false))
{
return 2;
}
else if(StrEqual(Weapon, "weapon_deagle", false))
{
return 3;
}
else if(StrEqual(Weapon, "weapon_elite", false))
{
return 4;
}
else if(StrEqual(Weapon, "weapon_famas", false))
{
return 5;
}
else if(StrEqual(Weapon, "weapon_fiveseven", false))
{
return 6;
}
else if(StrEqual(Weapon, "weapon_flashbang", false))
{
return 7;
}
else if(StrEqual(Weapon, "weapon_g3sg1", false))
{
return 8;
}
else if(StrEqual(Weapon, "weapon_galil", false))
{
return 9;
}
else if(StrEqual(Weapon, "weapon_glock", false))
{
return 10;
}
else if(StrEqual(Weapon, "weapon_hegrenade", false))
{
return 11;
}
else if(StrEqual(Weapon, "weapon_knife", false))
{
return 12;
}
else if(StrEqual(Weapon, "weapon_m249", false))
{
return 13;
}
else if(StrEqual(Weapon, "weapon_m3", false))
{
return 14;
}
else if(StrEqual(Weapon, "weapon_m4a1", false))
{
return 15;
}
else if(StrEqual(Weapon, "weapon_mac10", false))
{
return 16;
}
else if(StrEqual(Weapon, "weapon_mp5navy", false))
{
return 17;
}
else if(StrEqual(Weapon, "weapon_p228", false))
{
return 18;
}
else if(StrEqual(Weapon, "weapon_p90", false))
{
return 19;
}
else if(StrEqual(Weapon, "weapon_scout", false))
{
return 20;
}
else if(StrEqual(Weapon, "weapon_sg550", false))
{
return 21;
}
else if(StrEqual(Weapon, "weapon_sg552", false))
{
return 22;
}
else if(StrEqual(Weapon, "weapon_smokegrenade_projectile", false))
{
return 23;
}
else if(StrEqual(Weapon, "weapon_tmp", false))
{
return 24;
}
else if(StrEqual(Weapon, "weapon_ump45", false))
{
return 25;
}
else if(StrEqual(Weapon, "weapon_usp", false))
{
return 26;
}
else if(StrEqual(Weapon, "weapon_xm1014", false))
{
return 27;
}
else if(StrEqual(Weapon, "weapon_c4", false))
{
return 28;
}
else
return -1;
}
public GetWeaponByID(weaponid, String:WeaponName[], maxlen)
{
if(weaponid == 0)
{
strcopy(WeaponName, maxlen, "weapon_ak47");
}
else if(weaponid == 1)
{
strcopy(WeaponName, maxlen, "weapon_aug");
}
else if(weaponid == 2)
{
strcopy(WeaponName, maxlen, "weapon_awp");
}
else if(weaponid == 3)
{
strcopy(WeaponName, maxlen, "weapon_deagle");
}
else if(weaponid == 4)
{
strcopy(WeaponName, maxlen, "weapon_elite");
}
else if(weaponid == 5)
{
strcopy(WeaponName, maxlen, "weapon_famas");
}
else if(weaponid == 6)
{
strcopy(WeaponName, maxlen, "weapon_fiveseven");
}
else if(weaponid == 7)
{
strcopy(WeaponName, maxlen, "weapon_flashbang");
}
else if(weaponid == 8)
{
strcopy(WeaponName, maxlen, "weapon_g3sg1");
}
else if(weaponid == 9)
{
strcopy(WeaponName, maxlen, "weapon_galil");
}
else if(weaponid == 10)
{
strcopy(WeaponName, maxlen, "weapon_glock");
}
else if(weaponid == 11)
{
strcopy(WeaponName, maxlen, "weapon_hegrenade");
}
else if(weaponid == 12)
{
strcopy(WeaponName, maxlen, "weapon_knife");
}
else if(weaponid == 13)
{
strcopy(WeaponName, maxlen, "weapon_m249");
}
else if(weaponid == 14)
{
strcopy(WeaponName, maxlen, "weapon_m3");
}
else if(weaponid == 15)
{
strcopy(WeaponName, maxlen, "weapon_m4a1");
}
else if(weaponid == 16)
{
strcopy(WeaponName, maxlen, "weapon_mac10");
}
else if(weaponid == 17)
{
strcopy(WeaponName, maxlen, "weapon_mp5navy");
}
else if(weaponid == 18)
{
strcopy(WeaponName, maxlen, "weapon_p228");
}
else if(weaponid == 19)
{
strcopy(WeaponName, maxlen, "weapon_p90");
}
else if(weaponid == 20)
{
strcopy(WeaponName, maxlen, "weapon_scout");
}
else if(weaponid == 21)
{
strcopy(WeaponName, maxlen, "weapon_sg550");
}
else if(weaponid == 22)
{
strcopy(WeaponName, maxlen, "weapon_sg552");
}
else if(weaponid == 23)
{
strcopy(WeaponName, maxlen, "weapon_smokegrenade");
}
else if(weaponid == 24)
{
strcopy(WeaponName, maxlen, "weapon_tmp");
}
else if(weaponid == 25)
{
strcopy(WeaponName, maxlen, "weapon_ump45");
}
else if(weaponid == 26)
{
strcopy(WeaponName, maxlen, "weapon_usp");
}
else if(weaponid == 27)
{
strcopy(WeaponName, maxlen, "weapon_xm1014");
}
else if(weaponid == 28)
{
strcopy(WeaponName, maxlen, "weapon_c4");
}
}
public GetWeaponAmmoOffset(String:Weapon[])
{
if(StrEqual(Weapon, "weapon_deagle", false))
{
return 1;
}
else if(StrEqual(Weapon, "weapon_ak47", false) || StrEqual(Weapon, "weapon_aug", false) || StrEqual(Weapon, "weapon_g3sg1", false) || StrEqual(Weapon, "weapon_scout", false))
{
return 2;
}
else if(StrEqual(Weapon, "weapon_famas", false) || StrEqual(Weapon, "weapon_galil", false) || StrEqual(Weapon, "weapon_m4a1", false) || StrEqual(Weapon, "weapon_sg550", false) || StrEqual(Weapon, "weapon_sg552", false))
{
return 3;
}
else if(StrEqual(Weapon, "weapon_m249", false))
{
return 4;
}
else if(StrEqual(Weapon, "weapon_awp", false))
{
return 5;
}
else if(StrEqual(Weapon, "weapon_elite", false) || StrEqual(Weapon, "weapon_glock", false) || StrEqual(Weapon, "weapon_mp5navy", false) || StrEqual(Weapon, "weapon_tmp", false))
{
return 6;
}
else if(StrEqual(Weapon, "weapon_xm1014", false) || StrEqual(Weapon, "weapon_m3", false))
{
return 7;
}
else if(StrEqual(Weapon, "weapon_mac10", false) || StrEqual(Weapon, "weapon_ump45", false) || StrEqual(Weapon, "weapon_usp", false))
{
return 8;
}
else if(StrEqual(Weapon, "weapon_p228", false))
{
return 9;
}
else if(StrEqual(Weapon, "weapon_fiveseven", false) || StrEqual(Weapon, "weapon_p90", false))
{
return 10;
}
else if(StrEqual(Weapon, "weapon_hegrenade", false))
{
return 11;
}
else if(StrEqual(Weapon, "weapon_flashbang", false))
{
return 12;
}
else if(StrEqual(Weapon, "weapon_smokegrenade", false))
{
return 13;
}
return -1;
}
SendDialogToOne(client, color[3], String:text[], any:...)
{
new String:message[100];
VFormat(message, sizeof(message), text, 4);
new Handle:kv = CreateKeyValues("Stuff", "title", message);
KvSetColor(kv, "color", color[0], color[1], color[2], 255);
KvSetNum(kv, "level", 2);
KvSetNum(kv, "time", 2);
CreateDialog(client, kv, DialogType_Msg);
CloseHandle(kv);
}
stock GetWeaponAmmo(client, slot)
{
new ammoOffset = FindSendPropInfo("CCSPlayer", "m_iAmmo");
return GetEntData(client, ammoOffset+(slot*4));
}
stock SetWeaponAmmo(client, slot, ammo)
{
new ammoOffset = FindSendPropInfo("CCSPlayer", "m_iAmmo");
return SetEntData(client, ammoOffset+(slot*4), ammo);
}
stock GetPrimaryAmmo(client, weap)
{
//new myweapons = FindSendPropInfo("CCSPlayer", "m_hMyWeapons");
//new weap = GetEntDataEnt2(client, myweapons+ (slot*4));
if(IsValidEntity(weap))
return GetEntData(weap, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"));
return 0;
}
stock SetPrimaryAmmo(client, weap, ammo)
{
//new myweapons = FindSendPropInfo("CCSPlayer", "m_hMyWeapons");
//new weap = GetEntDataEnt2(client, myweapons+ (slot*4));
if(IsValidEntity(weap))
return SetEntData(weap, FindSendPropInfo("CBaseCombatWeapon", "m_iClip1"), ammo);
return 0;
}
/*
public RoundEndEvent(Handle:event,const String:name[],bool:dontBroadcast)
{
//round has started
roundend = true;
new maxclients = GetMaxClients();
for (new i = 1; i < maxclients; i++)
{
ZombieDied[i] = false;
}
}
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
new teamindex = GetClientTeam(client);
if(teamindex == TEAM_T)
{
if(ZombieDied[client])
{
if(Zombiehashead[client])
{
TeleportEntity(client, ZombieDeathLoc[client], NULL_VECTOR, NULL_VECTOR);
}
}
}
if(teamindex == TEAM_CT)
{
roundend = false;
}
}
public Action:ZombieRespawn(Handle:timer, any:index)
{
if(roundend)
return Plugin_Handled;
new userid = GetClientUserId(index);
ServerCommand("sm_respawn #%d", userid);
ServerCommand("zombie_player #%d", userid);
PrintToChat(index, "[SM] You have %d lives left.", ZombieRespawnCount[index]);
return Plugin_Handled;
}
SetClientDeaths(client, deaths)
{
SetEntProp(client, Prop_Data, "m_iDeaths", deaths);
}
*/
This plugin actually contains the backpack script that I separated and put into a separate plugin(which is very ideal for Zombiemod i might add).
__________________
Last edited by InstantDeath; 11-18-2011 at 18:21.
|
|