Senior Member
Join Date: Jan 2013
Location: at home
|
12-20-2015
, 09:53
Re: [CS:GO] Last player of a team ?
|
#15
|
PHP Code:
#include <sourcemod> #include <cstrike> #include <clientprefs> #include <sdktools> #include <sdkhooks>
#pragma semicolon 1
#define PLUGIN_VERSION "X" #define MAX_FILE_LEN 80
new Handle:cvarAmount;
public Plugin:myinfo = { name = "Privat", author = "Mado", description = "none", version = PLUGIN_VERSION, url = "." };
public OnPluginStart() { cvarAmount = CreateConVar("sm_survivor_maxhp", "400", "Survivor's MAX health", FCVAR_PLUGIN, true, 1.0, false, _); HookEvent("player_death", EventPlayerDeath); }
public OnMapStart() { AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/belt.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/belt.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/belt_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/eyes.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/eyes.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/gloves.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/gloves.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/gloves_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hands.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hands.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hands_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hair.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hair.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/hair_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/head_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/magnum.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/magnum.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/magnum_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/pants.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/pants.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/pants_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shirt.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shirt.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shirt_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shoes.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shoes.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/shoes_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/upperbody.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/upperbody.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/walkingdead/rickgrimes/upperbody_n.vtf");
AddFileToDownloadsTable("models/player/custom_player/walkingdead/rickgrimes/rick_v2.dx90.vtx"); AddFileToDownloadsTable("models/player/custom_player/walkingdead/rickgrimes/rick_v2.mdl"); AddFileToDownloadsTable("models/player/custom_player/walkingdead/rickgrimes/rick_v2.phy"); AddFileToDownloadsTable("models/player/custom_player/walkingdead/rickgrimes/rick_v2.vvd");
PrecacheModel("models/player/custom_player/walkingdead/rickgrimes/rick_v2.mdl");
AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/body.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/body.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/body_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/body_s.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/hat.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/hat.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/hat_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/hat_s.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/head.vmt"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/head.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/head_n.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/head_s.vtf"); AddFileToDownloadsTable("materials/models/player/custom_player/zombie/revenant/head_glow.vtf");
AddFileToDownloadsTable("models/player/custom_player/zombie/revenant/revenant_v2.mdl"); AddFileToDownloadsTable("models/player/custom_player/zombie/revenant/revenant_v2.dx90.vtx"); AddFileToDownloadsTable("models/player/custom_player/zombie/revenant/revenant_v2.phy"); AddFileToDownloadsTable("models/player/custom_player/zombie/revenant/revenant_v2.vvd"); AddFileToDownloadsTable("models/player/custom_player/zombie/revenant/revenant_arms.mdl"); AddFileToDownloadsTable("models/player/custom_player/zombie/revenant/revenant_arms.dx90.vtx"); AddFileToDownloadsTable("models/player/custom_player/zombie/revenant/revenant_arms.vvd");
PrecacheModel("models/player/custom_player/zombie/revenant/revenant_v2.mdl"); }
public EventPlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { new victimId = GetEventInt(event, "userid");
new victimClient = GetClientOfUserId(victimId);
new killedTeam = GetClientTeam(victimClient);
new playersConnected = GetMaxClients();
new lastManId = 0; for (new i = 1; i < playersConnected; i++) { if(IsClientInGame(i)) { if(killedTeam==GetClientTeam(i) && IsPlayerAlive(i)) { if(lastManId) { lastManId = -1; } else { lastManId = i; } } } }
if(lastManId > 0) { new String:clientname[64]; GetClientName(lastManId, clientname, sizeof(clientname)); new MaxHealth = GetConVarInt(cvarAmount); SetEntData(lastManId, FindDataMapOffs(lastManId, "m_iMaxHealth"), MaxHealth, 4, true); SetEntData(lastManId, FindDataMapOffs(lastManId, "m_iHealth"), MaxHealth, 4, true); SetEntityHealth(lastManId, 400); if(GetClientTeam(lastManId) == CS_TEAM_T) { PrintHintTextToAll("<font color='#ff0000'><b>%s is now Kage!</b></font>", clientname); SetEntityModel(lastManId, "models/player/custom_player/zombie/revenant/revenant_v2.mdl"); SetEntProp(lastManId, Prop_Send, "m_ArmorValue", 100, 4); SetEntProp(lastManId, Prop_Send, "m_bHasHelmet", 1); SetEntityGravity(lastManId, 0.3); SetEntPropFloat(lastManId, Prop_Data, "m_flLaggedMovementValue", 2.5); } if(GetClientTeam(lastManId) == CS_TEAM_CT) { PrintHintTextToAll("<font color='#00ffff'><b>%s is now Psycho!</b></font>", clientname); SetEntityModel(lastManId, "models/player/custom_player/walkingdead/rickgrimes/rick_v2.mdl"); SetEntProp(lastManId, Prop_Send, "m_ArmorValue", 100, 4); SetEntityGravity(lastManId, 0.6); SetEntPropFloat(lastManId, Prop_Data, "m_flLaggedMovementValue", 1.6); ClientCommand(lastManId, "drop"); ClientCommand(lastManId, "drop"); FakeClientCommand(lastManId, "drop"); FakeClientCommand(lastManId, "drop"); GivePlayerItem(lastManId, "weapon_xm1014"); CreateTimer(0.5, Timer_Weapon, _, TIMER_DATA_HNDL_CLOSE); } } }
public Action:Timer_Weapon(Handle:Timer, lastManId) { GivePlayerItem(lastManId, "weapon_xm1014"); }
THAT'S IT, FINALLY, I DID IT.
MOM, GET THE CAMERA :*
Edit: I can't force the CT to drop the weapon and pick XM1014...
and the model doesn't work for T, but it's ok...
Edit#2: I removed T model and I used stock StripAllWeapons(lastManId) to remove current weapons and then give XM1014
__________________
Last edited by valio_skull; 12-20-2015 at 10:36.
|
|