Beta version
Require SDKHooks
- 50% of HP on spawn.
- Knife only race.
- White headcrab model for CT, and black for T.
Skill 1 - Power legs
This is longjump. When level skill higher, then longjump is biggest.
Skill 2 - Four legs
Low gravity.
- Level 1 - To 90%
- Level 2 - To 80%
- Level 3 - To 70%
- Level 4 - To 60%
Race code:
Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include "War3Source/War3Source_Interface"
new raceID;
public Plugin:myinfo =
{
name = "War3Source Race - Headcrab",
author = "Vladislav Dolgov",
description = "Headcrab race for War3Source.",
version = "1.0.0.0",
url = "http://elistor.ru/"
};
public OnWar3PluginReady()
{
raceID=War3_CreateRace("Headcrab", "headcrab",
"You being a headcrab!", "You being a headrab when he die or respawn.",
"Power legs", "Long jump.",
"Four legs", "Low gravity.",
"No skill", "No skill",
"No skill", "No skill");
}
public OnPluginStart()
{
HookEvent("player_spawn", Event_PlayerSpawn);
HookEvent("player_jump", Event_PlayerJump);
}
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
MarkNativeAsOptional("SDKHook");
MarkNativeAsOptional("SDKUnhook");
return APLRes_Success;
}
public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse);
}
public Action:OnWeaponCanUse(client, weapon)
{
decl String:name[64];
GetEdictClassname(weapon, name, sizeof(name));
if(StrEqual(name, "weapon_knife", false))
return Plugin_Continue;
return Plugin_Handled;
}
public OnMapStart()
{
PrecacheModel("models/headcrab.mdl", true);
PrecacheModel("models/headcrabblack.mdl", true);
}
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client > 0)
{
new race = War3_GetRace(client);
if (race == raceID)
{
SetEntityHealth(client, 50);
if(GetClientTeam(client) == 3)
SetEntityModel(client, "models/headcrab.mdl");
else
SetEntityModel(client, "models/headcrabblack.mdl");
new skill3_fourlegs = War3_GetSkillLevel(client, race, 1);
new Float:gravity = 1.00;
switch (skill3_fourlegs)
{
case 0:
gravity = 1.00;
case 1:
gravity = 0.90;
case 2:
gravity = 0.80;
case 3:
gravity = 0.70;
case 4:
gravity = 0.60;
}
War3_SetMinGravity(client, gravity);
}
}
}
public OnSkillLevelChanged(client, race, skill, oldskilllevel, newskilllevel)
{
if (client > 0)
{
if (race == raceID && skill == 1)
{
new Float:gravity = 1.00;
switch (newskilllevel)
{
case 0:
gravity = 1.00;
case 1:
gravity = 0.90;
case 2:
gravity = 0.80;
case 3:
gravity = 0.70;
case 4:
gravity = 0.60;
}
War3_SetMinGravity(client, gravity);
}
}
}
public OnRaceSelected(client, oldrace, newrace)
{
if(newrace != raceID)
{
SetEntityHealth(client, 100);
War3_SetMinGravity(client, 1.00);
}
}
public Event_PlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"userid"));
if (client > 0)
{
new race = War3_GetRace(client);
if (race == raceID)
{
new skill2_longjump = War3_GetSkillLevel(client, race, 0);
new Float:long_push = 1.00;
switch (skill2_longjump)
{
case 0:
long_push = 1.00;
case 1:
long_push = 1.05;
case 2:
long_push = 1.10;
case 3:
long_push = 1.15;
case 4:
long_push = 1.20;
}
if (skill2_longjump > 0)
{
new v_0 = FindSendPropOffs("CBasePlayer","m_vecVelocity[0]");
new v_1 = FindSendPropOffs("CBasePlayer","m_vecVelocity[1]");
new v_b = FindSendPropOffs("CBasePlayer","m_vecBaseVelocity");
new Float:finalvec[3];
finalvec[0] = GetEntDataFloat(client, v_0) * long_push / 2.0;
finalvec[1] = GetEntDataFloat(client, v_1) * long_push / 2.0;
finalvec[2] = long_push * 50.0;
SetEntDataVector(client, v_b, finalvec, true);
}
}
}
}
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include "War3Source/War3Source_Interface"
new raceID;
public Plugin:myinfo =
{
name = "War3Source Race - Headcrab",
author = "Vladislav Dolgov",
description = "Headcrab race for War3Source.",
version = "1.0.0.0",
url = "http://elistor.ru/"
};
public OnWar3PluginReady()
{
raceID=War3_CreateRace("Headcrab", "headcrab",
"You being a headcrab!", "You being a headrab when he die or respawn.",
"Power legs", "Long jump.",
"Four legs", "Low gravity.",
"No skill", "No skill",
"No skill", "No skill");
}
public OnPluginStart()
{
HookEvent("player_spawn", Event_PlayerSpawn);
HookEvent("player_jump", Event_PlayerJump);
}
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
MarkNativeAsOptional("SDKHook");
MarkNativeAsOptional("SDKUnhook");
return APLRes_Success;
}
public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_WeaponCanUse, OnWeaponCanUse);
}
public Action:OnWeaponCanUse(client, weapon)
{
decl String:name[64];
GetEdictClassname(weapon, name, sizeof(name));
if(StrEqual(name, "weapon_knife", false))
return Plugin_Continue;
return Plugin_Handled;
}
public OnMapStart()
{
PrecacheModel("models/headcrab.mdl", true);
PrecacheModel("models/headcrabblack.mdl", true);
}
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if (client > 0)
{
new race = War3_GetRace(client);
if (race == raceID)
{
SetEntityHealth(client, 50);
if(GetClientTeam(client) == 3)
SetEntityModel(client, "models/headcrab.mdl");
else
SetEntityModel(client, "models/headcrabblack.mdl");
new skill3_fourlegs = War3_GetSkillLevel(client, race, 1);
new Float:gravity = 1.00;
switch (skill3_fourlegs)
{
case 0:
gravity = 1.00;
case 1:
gravity = 0.90;
case 2:
gravity = 0.80;
case 3:
gravity = 0.70;
case 4:
gravity = 0.60;
}
War3_SetMinGravity(client, gravity);
}
}
}
public OnSkillLevelChanged(client, race, skill, oldskilllevel, newskilllevel)
{
if (client > 0)
{
if (race == raceID && skill == 1)
{
new Float:gravity = 1.00;
switch (newskilllevel)
{
case 0:
gravity = 1.00;
case 1:
gravity = 0.90;
case 2:
gravity = 0.80;
case 3:
gravity = 0.70;
case 4:
gravity = 0.60;
}
War3_SetMinGravity(client, gravity);
}
}
}
public OnRaceSelected(client, oldrace, newrace)
{
if(newrace != raceID)
{
SetEntityHealth(client, 100);
War3_SetMinGravity(client, 1.00);
}
}
public Event_PlayerJump(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event,"userid"));
if (client > 0)
{
new race = War3_GetRace(client);
if (race == raceID)
{
new skill2_longjump = War3_GetSkillLevel(client, race, 0);
new Float:long_push = 1.00;
switch (skill2_longjump)
{
case 0:
long_push = 1.00;
case 1:
long_push = 1.05;
case 2:
long_push = 1.10;
case 3:
long_push = 1.15;
case 4:
long_push = 1.20;
}
if (skill2_longjump > 0)
{
new v_0 = FindSendPropOffs("CBasePlayer","m_vecVelocity[0]");
new v_1 = FindSendPropOffs("CBasePlayer","m_vecVelocity[1]");
new v_b = FindSendPropOffs("CBasePlayer","m_vecBaseVelocity");
new Float:finalvec[3];
finalvec[0] = GetEntDataFloat(client, v_0) * long_push / 2.0;
finalvec[1] = GetEntDataFloat(client, v_1) * long_push / 2.0;
finalvec[2] = long_push * 50.0;
SetEntDataVector(client, v_b, finalvec, true);
}
}
}
}




Logged




DarkEnergy