remove trailing whitespaces from sourcecode

This commit is contained in:
2016-02-06 00:47:47 +01:00
parent 6f9558373d
commit d88e748f0e
85 changed files with 3559 additions and 3559 deletions

View File

@ -41,7 +41,7 @@ public Plugin:myinfo =
public OnPluginStart()
{
LoadTranslations("common.phrases");
RegConsoleCmd("zrtest_is_valid_class_index", IsValidClassCommand, "Returns whether the specified class index is valid or not. Usage: zrtest_is_valid_class_index <class index>");
RegConsoleCmd("zrtest_get_active_class", GetActiveClassCommand, "Gets the current class the specified player is using. Usage: zrtest_get_active_class <target>");
RegConsoleCmd("zrtest_select_class", SelectClassCommand, "Selects a class for a player. Usage: zrtest_select_class <target> <class index>");
@ -53,7 +53,7 @@ public Action:IsValidClassCommand(client, argc)
{
new classIndex = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
@ -66,7 +66,7 @@ public Action:IsValidClassCommand(client, argc)
}
ReplyToCommand(client, "Class %d is valid: %d", classIndex, ZR_IsValidClassIndex(classIndex));
return Plugin_Handled;
}
@ -74,7 +74,7 @@ public Action:GetActiveClassCommand(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
@ -87,7 +87,7 @@ public Action:GetActiveClassCommand(client, argc)
}
ReplyToCommand(client, "Active class of client %d: %d", target, ZR_GetActiveClass(target));
return Plugin_Handled;
}
@ -97,22 +97,22 @@ public Action:SelectClassCommand(client, argc)
new classIndex = -1;
new bool:applyIfPossible = true;
new bool:saveIfEnabled = true;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
target = FindTarget(client, valueString);
GetCmdArg(2, valueString, sizeof(valueString));
classIndex = StringToInt(valueString);
if (argc >= 4)
{
GetCmdArg(3, valueString, sizeof(valueString));
applyIfPossible = bool:StringToInt(valueString);
GetCmdArg(4, valueString, sizeof(valueString));
saveIfEnabled = bool:StringToInt(valueString);
}
@ -124,14 +124,14 @@ public Action:SelectClassCommand(client, argc)
}
ReplyToCommand(client, "Selected class %d for client %d. Result: %d", classIndex, target, ZR_SelectClientClass(target, classIndex, applyIfPossible, saveIfEnabled));
return Plugin_Handled;
}
public Action:GetClassCommand(client, argc)
{
new String:className[64];
if (argc >= 1)
{
GetCmdArg(1, className, sizeof(className));
@ -143,7 +143,7 @@ public Action:GetClassCommand(client, argc)
}
ReplyToCommand(client, "Class index of \"%s\": %d", className, ZR_GetClassByName(className));
return Plugin_Handled;
}
@ -152,12 +152,12 @@ public Action:GetNameCommand(client, argc)
new classIndex = -1;
new String:valueString[64];
new String:displayName[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
classIndex = StringToInt(valueString);
if (!ZR_IsValidClassIndex(classIndex))
{
ReplyToCommand(client, "Invalid class index: %d", classIndex);
@ -169,9 +169,9 @@ public Action:GetNameCommand(client, argc)
ReplyToCommand(client, "Gets class display name. Usage: zrtest_get_class_display_name <class index>");
return Plugin_Handled;
}
ZR_GetClassDisplayName(classIndex, displayName, sizeof(displayName));
ReplyToCommand(client, "Display name of class %d: \"%s\"", classIndex, displayName);
return Plugin_Handled;
}

View File

@ -45,7 +45,7 @@ public OnPluginStart()
{
hBlockOnTakeDamage = CreateConVar("zrtest_blockontakedamage", "0", "Block OnTakeDamage.");
hBlockTraceAttack = CreateConVar("zrtest_blocktraceattack", "0", "Block TraceAttack.");
if (!HookEventEx("player_hurt", Event_PlayerHurt))
{
LogError("Failed to hook event player_hurt.");
@ -74,15 +74,15 @@ public Action:Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroad
decl String:weapon[64];
weapon[0] = 0;
GetEventString(event, "weapon", weapon, sizeof(weapon));
decl String:msg[128];
msg[0] = 0;
Format(msg, sizeof(msg), "victim:%d | attacker:%d | hitgroup:%d | dmg:%d | dmg armor:%d | weapon:%s", victim, attacker, hitgroup, damage, damageArmor, weapon);
PrintToChat(victim, "Receive hurt event -- %s", msg);
PrintToConsole(victim, "Receive hurt event -- %s", msg);
if (attacker > 0 && attacker < MaxClients)
{
PrintToChat(attacker, "Send hurt event -- %s", msg);
@ -95,29 +95,29 @@ public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damage
/*
Here we can control whether bullets or other damage that hits the
victim's body should be allowed.
If TraceAttack is blocked, bullets will go through the body and the
attacker can't deal any damage to the victim.
By blocking OnTakeDamage we can use this to allow players to actually
hit a player without giving damage to him. This can be used as a simple
trace, for example healing the victim instead of damaging him.
*/
decl String:msg[128];
msg[0] = 0;
Format(msg, sizeof(msg), "victim:%d | attacker:%d | inflictor:%d | dmg:%0.2f | dmg type:%d | weapon ent:%d | force:%0.2f | dmg pos:%0.2f", victim, attacker, inflictor, damage, damagetype, weapon, damageForce, damagePosition);
PrintToChat(victim, "Damage taken -- %s", msg);
PrintToConsole(victim, "Damage taken -- %s", msg);
if (attacker > 0 && attacker < MaxClients)
{
PrintToChat(attacker, "Damage given -- %s", msg);
PrintToConsole(attacker, "Damage given -- %s", msg);
}
if (GetConVarBool(hBlockOnTakeDamage))
{
return Plugin_Handled;
@ -133,26 +133,26 @@ public Action:TraceAttack(victim, &attacker, &inflictor, &Float:damage, &damaget
/*
Here we can control whether bullets or other damage is allowed to hit
the player's body.
If blocked, bullets will go through the body.
OnTakeDamage decides whether damage is actually allowed.
*/
decl String:msg[128];
msg[0] = 0;
Format(msg, sizeof(msg), "victim:%d | attacker:%d | inflictor:%d | dmg:%0.2f | dmg type:%d | ammo type:%d | hitbox:%d | hitgroup: %d", victim, attacker, inflictor, damage, damagetype, ammotype, hitbox, hitgroup);
PrintToChat(victim, "Receive attack -- %s", msg);
PrintToConsole(victim, "Receive attack -- %s", msg);
if (attacker > 0 && attacker < MaxClients)
{
PrintToChat(attacker, "Attacking -- %s", msg);
PrintToConsole(attacker, "Attacking -- %s", msg);
}
if (GetConVarBool(hBlockTraceAttack))
{
return Plugin_Handled;

View File

@ -44,13 +44,13 @@ new Handle:cvarBlockHuman;
public OnPluginStart()
{
LoadTranslations("common.phrases");
RegConsoleCmd("zrtest_iszombie", IsZombieCommand, "Returns whether a player is a zombie or not. Usage: zrtest_iszombie <target>");
RegConsoleCmd("zrtest_ishuman", IsHumanCommand, "Returns whether a player is a human or not. Usage: zrtest_ishuman <target>");
RegConsoleCmd("zrtest_infect", InfectClientCommand, "Infects a player. Usage: zrtest_infect <target>");
RegConsoleCmd("zrtest_human", HumanClientCommand, "Turns a player back into a human. Usage: zrtest_human <target>");
cvarBlockInfect = CreateConVar("zrtest_block_infect", "0", "Block infection.");
cvarBlockHuman = CreateConVar("zrtest_block_human", "0", "Block turning players back into humans.");
}
@ -59,7 +59,7 @@ public Action:IsZombieCommand(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
@ -72,7 +72,7 @@ public Action:IsZombieCommand(client, argc)
}
ReplyToCommand(client, "Client %d is a zombie: %d", client, ZR_IsClientZombie(target));
return Plugin_Handled;
}
@ -80,7 +80,7 @@ public Action:IsHumanCommand(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
@ -93,7 +93,7 @@ public Action:IsHumanCommand(client, argc)
}
ReplyToCommand(client, "Client %d is a human: %d", client, ZR_IsClientHuman(target));
return Plugin_Handled;
}
@ -101,13 +101,13 @@ public Action:InfectClientCommand(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
target = FindTarget(client, valueString);
}
if (target < 0)
{
ReplyToCommand(client, "Infects a player. Usage: zrtest_infect <target>");
@ -115,7 +115,7 @@ public Action:InfectClientCommand(client, argc)
}
ZR_InfectClient(target);
return Plugin_Handled;
}
@ -123,13 +123,13 @@ public Action:HumanClientCommand(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
target = FindTarget(client, valueString);
}
if (target < 0)
{
ReplyToCommand(client, "Turns a player back into a human. Usage: zrtest_human <target>");
@ -137,7 +137,7 @@ public Action:HumanClientCommand(client, argc)
}
ZR_HumanClient(target);
return Plugin_Handled;
}
@ -148,7 +148,7 @@ public Action:ZR_OnClientInfect(&client, &attacker, &bool:motherInfect, &bool:re
PrintToChatAll("Infection blocked on client %d.", client);
return Plugin_Handled;
}
PrintToChatAll("Client %d is about to be infected. Attacker: %d, Mother zombie: %d, Respawn override: %d, Respawn: %d.", client, attacker, motherInfect, respawnOverride, respawn);
return Plugin_Continue;
}
@ -165,7 +165,7 @@ public Action:ZR_OnClientHuman(&client, &bool:respawn, &bool:protect)
PrintToChatAll("Turning human blocked on client %d.", client);
return Plugin_Handled;
}
PrintToChatAll("Client %d is about to become a human. Respawn: %d, Spawn protect: %d", client, respawn, protect);
return Plugin_Continue;
}

View File

@ -46,19 +46,19 @@ new bool:VelocityMonitor[MAXPLAYERS];
public OnPluginStart()
{
hKnockBackMultiplier = CreateConVar("zrtest_knockback", "4.0", "Knock back multiplier.");
if (!HookEventEx("player_hurt", Event_PlayerHurt))
{
LogError("Failed to hook event player_hurt.");
}
// If offset "m_vecVelocity[0]" can't be found, then stop the plugin.
g_iToolsVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
if (g_iToolsVelocity == -1)
{
LogError("Offset \"CBasePlayer::m_vecVelocity[0]\" was not found.");
}
RegConsoleCmd("zrtest_push_player", Command_PushPlayer, "Push a player. Usage: zrtest_push_player <x> <y> <z> [0|1 - base velocity]");
RegConsoleCmd("zrtest_parent", Command_Parent, "Prints your parent entity.");
RegConsoleCmd("zrtest_friction", Command_Friction, "Prints your floor friction multiplier.");
@ -72,25 +72,25 @@ public Action:Command_PushPlayer(client, argc)
ReplyToCommand(client, "Push a player. Usage: zrtest_push_player <x> <y> <z> [0|1 - base velocity]");
return Plugin_Handled;
}
new Float:velocity[3];
new String:buffer[32];
new bool:baseVelocity = false;
for (new i = 0; i < 3; i++)
{
GetCmdArg(i + 1, buffer, sizeof(buffer));
velocity[i] = StringToFloat(buffer);
}
if (argc > 3)
{
GetCmdArg(4, buffer, sizeof(buffer));
baseVelocity = bool:StringToInt(buffer);
}
PrintToChatAll("Applying velocity on client %d (base: %d): %0.2f | %0.2f | %0.2f", client, baseVelocity, velocity[0], velocity[1], velocity[2]);
if (baseVelocity)
{
SetBaseVelocity(client, velocity);
@ -100,7 +100,7 @@ public Action:Command_PushPlayer(client, argc)
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity);
//SetVelocity(client, velocity);
}
return Plugin_Handled;
}
@ -108,7 +108,7 @@ public Action:Command_Parent(client, argc)
{
new parent = GetParent(client);
ReplyToCommand(client, "Parent index: %d", parent);
return Plugin_Handled;
}
@ -116,7 +116,7 @@ public Action:Command_Friction(client, argc)
{
new Float:friction = GetFriction(client);
ReplyToCommand(client, "Friction: %0.2f", friction);
return Plugin_Handled;
}
@ -124,7 +124,7 @@ public Action:Command_MaxSpeed(client, argc)
{
new Float:maxSpeed = GetMaxSpeed(client);
ReplyToCommand(client, "Max speed: %0.2f", maxSpeed);
return Plugin_Handled;
}
@ -157,7 +157,7 @@ public Action:Event_PlayerHurt(Handle:event, const String:name[], bool:dontBroad
/*public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype, &weapon, Float:damageForce[3], Float:damagePosition[3])
{
KnockbackOnClientHurt(victim, attacker, Float:damage);
// Allow damage.
return Plugin_Continue;
}
@ -192,7 +192,7 @@ public PostThink(client)
/*{
PrintVelocity(client, "PostThink");
}*/
SetMaxSpeed(client, 1000.0);
}
@ -217,7 +217,7 @@ stock PrintVelocity(client, const String:prefix[])
* @param client The client index. (zombie)
* @param attacker The attacker index. (human)
* @param weapon The weapon used.
* @param hitgroup Hitgroup attacker has damaged.
* @param hitgroup Hitgroup attacker has damaged.
* @param dmg_health Damage done.
*/
KnockbackOnClientHurt(client, attacker, Float:dmg_health)
@ -227,29 +227,29 @@ KnockbackOnClientHurt(client, attacker, Float:dmg_health)
{
return;
}
// Get zombie knockback value.
new Float:knockback = GetConVarFloat(hKnockBackMultiplier);
new Float:clientloc[3];
new Float:attackerloc[3];
GetClientAbsOrigin(client, clientloc);
// Get attackers eye position.
GetClientEyePosition(attacker, attackerloc);
// Get attackers eye angles.
new Float:attackerang[3];
GetClientEyeAngles(attacker, attackerang);
// Calculate knockback end-vector.
TR_TraceRayFilter(attackerloc, attackerang, MASK_ALL, RayType_Infinite, KnockbackTRFilter);
TR_GetEndPosition(clientloc);
// Apply damage knockback multiplier.
knockback *= dmg_health;
// Apply knockback.
PrintToChat(attacker, "Applying knock back: %0.2f", knockback);
VelocityMonitor[client] = true;
@ -258,34 +258,34 @@ KnockbackOnClientHurt(client, attacker, Float:dmg_health)
/**
* Sets velocity on a player.
*
*
* @param client The client index.
* @param startpoint The starting coordinate to push from.
* @param endpoint The ending coordinate to push towards.
* @param magnitude Magnitude of the push.
*/
*/
KnockbackSetVelocity(client, const Float:startpoint[3], const Float:endpoint[3], Float:magnitude)
{
// Create vector from the given starting and ending points.
new Float:vector[3];
MakeVectorFromPoints(startpoint, endpoint, vector);
// Normalize the vector (equal magnitude at varying distances).
NormalizeVector(vector, vector);
// Changes by zephyrus:
//new flags = GetEntityFlags(client);
//if(flags & FL_ONGROUND)
// vector[2]=0.5;
// Apply the magnitude by scaling the vector (multiplying each of its components).
ScaleVector(vector, magnitude);
// Changes by zephyrus:
//if(flags & FL_ONGROUND)
// if(vector[2]>350.0)
// vector[2]=350.0;
new flags = GetEntityFlags(client);
if (flags & FL_ONGROUND)
{
@ -294,7 +294,7 @@ KnockbackSetVelocity(client, const Float:startpoint[3], const Float:endpoint[3],
vector[2] = 251.0;
}
}
// ADD the given vector to the client's current velocity.
PrintToChatAll("Applying velocity on client %d: %0.2f | %0.2f | %0.2f", client, vector[0], vector[1], vector[2]);
ToolsClientVelocity(client, vector);
@ -318,37 +318,37 @@ stock ToolsClientVelocity(client, Float:vecVelocity[3], bool:apply = true, bool:
{
vecVelocity[x] = GetEntDataFloat(client, g_iToolsVelocity + (x*4));
}
// Stop here.
return;
}
// If stack is true, then add client's velocity.
if (stack)
{
// Get client's velocity.
new Float:vecClientVelocity[3];
// x = vector component.
for (new x = 0; x < 3; x++)
{
vecClientVelocity[x] = GetEntDataFloat(client, g_iToolsVelocity + (x*4));
}
AddVectors(vecClientVelocity, vecVelocity, vecVelocity);
}
// Apply velocity on client.
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vecVelocity);
}
/**
* Trace Ray forward, used as a filter to continue tracing if told so. (See sdktools_trace.inc)
*
*
* @param entity The entity index.
* @param contentsMask The contents mask.
* @return True to allow hit, false to continue tracing.
*/
* @return True to allow hit, false to continue tracing.
*/
public bool:KnockbackTRFilter(entity, contentsMask)
{
// If entity is a player, continue tracing.
@ -356,7 +356,7 @@ public bool:KnockbackTRFilter(entity, contentsMask)
{
return false;
}
// Allow hit.
return true;
}

View File

@ -44,10 +44,10 @@ new Handle:cvarAllSuicide;
public OnPluginStart()
{
LoadTranslations("common.phrases");
RegConsoleCmd("zrtest_killed_by_world", KilledByWorldCommand, "Gets or sets the killed by world value. Usage: zrtest_killed_by_world <target> [1|0]");
RegConsoleCmd("zrtest_respawn", RespawnClientCommand, "Respawn a player. Usage: zrtest_respawn <target>");
cvarBlockRespawn = CreateConVar("zrtest_block_respawn", "0", "Block respawning.");
cvarAllSuicide = CreateConVar("zrtest_all_suicide", "0", "Treat all deaths as suicide.");
}
@ -56,19 +56,19 @@ public Action:KilledByWorldCommand(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
target = FindTarget(client, valueString);
}
if (target <= 0)
{
ReplyToCommand(client, "Gets or sets the killed by world value. Usage: zrtest_killed_by_world <target> [value]");
return Plugin_Handled;
}
if (argc > 1)
{
// Set value.
@ -80,7 +80,7 @@ public Action:KilledByWorldCommand(client, argc)
// Print value.
ReplyToCommand(client, "Killed by world: %d", ZR_GetKilledByWorld(target));
}
return Plugin_Handled;
}
@ -88,13 +88,13 @@ public Action:RespawnClientCommand(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
target = FindTarget(client, valueString);
}
if (target < 0)
{
ReplyToCommand(client, "Respawn a player. Usage: zrtest_respawn <target>");
@ -102,7 +102,7 @@ public Action:RespawnClientCommand(client, argc)
}
ZR_RespawnClient(target, ZR_Repsawn_Default);
return Plugin_Handled;
}
@ -113,16 +113,16 @@ public Action:ZR_OnClientRespawn(&client, &ZR_RespawnCondition:condition)
PrintToChatAll("Respawn blocked on client %d.", client);
return Plugin_Handled;
}
PrintToChatAll("Client %d is about to respawn. Condition: %d", client, condition);
if (GetConVarBool(cvarAllSuicide))
{
// Set client suicide.
ZR_SetKilledByWorld(client, true);
PrintToChatAll("Client %d is marked as suicide victim.");
}
return Plugin_Continue;
}

View File

@ -44,19 +44,19 @@ new m_hMyWeapons;
public OnPluginStart()
{
LoadTranslations("common.phrases");
m_hActiveWeapon = FindSendPropInfo("CBasePlayer", "m_hActiveWeapon");
if (m_hActiveWeapon == -1)
{
LogError("Can't find CBasePlayer::m_hActiveWeapon");
}
m_hMyWeapons = FindSendPropOffs("CBasePlayer", "m_hMyWeapons");
if (m_hMyWeapons == -1)
{
LogError("Can't find CBasePlayer::m_hMyWeapons");
}
RegConsoleCmd("zrtest_weaponslots", Command_ListWeaponSlots, "Lists weapon slots. Usage: zrtest_weaponslots [target]");
RegConsoleCmd("zrtest_weaponlist", Command_ListWeapons, "Lists all weapons. Usage: zrtest_weaponlist [target]");
RegConsoleCmd("zrtest_knife", Command_Knife, "Gives a knife. Usage: zrtest_knife [target]");
@ -67,19 +67,19 @@ public Action:Command_ListWeaponSlots(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
target = FindTarget(client, valueString);
}
if (target <= 0)
{
ReplyToCommand(client, "Lists weapon slots. Usage: zrtest_weaponlist [target]");
return Plugin_Handled;
}
if (argc >= 1)
{
ListWeaponSlots(target, client);
@ -88,7 +88,7 @@ public Action:Command_ListWeaponSlots(client, argc)
{
ListWeaponSlots(client, client);
}
return Plugin_Handled;
}
@ -96,19 +96,19 @@ public Action:Command_ListWeapons(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
target = FindTarget(client, valueString);
}
if (target <= 0)
{
ReplyToCommand(client, "Lists all weapon. Usage: zrtest_weaponlist [target]");
return Plugin_Handled;
}
if (argc >= 1)
{
ListWeapons(target, client);
@ -117,7 +117,7 @@ public Action:Command_ListWeapons(client, argc)
{
ListWeapons(client, client);
}
return Plugin_Handled;
}
@ -125,19 +125,19 @@ public Action:Command_Knife(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
target = FindTarget(client, valueString);
}
if (target <= 0)
{
ReplyToCommand(client, "Gives a knife. Usage: zrtest_knife [target]");
return Plugin_Handled;
}
if (argc >= 1)
{
GiveKnife(target);
@ -146,7 +146,7 @@ public Action:Command_Knife(client, argc)
{
GiveKnife(client);
}
return Plugin_Handled;
}
@ -154,19 +154,19 @@ public Action:Command_RemoveWeapons(client, argc)
{
new target = -1;
new String:valueString[64];
if (argc >= 1)
{
GetCmdArg(1, valueString, sizeof(valueString));
target = FindTarget(client, valueString);
}
if (target <= 0)
{
ReplyToCommand(client, "Removes all weapons. Usage: zrtest_removeweapons [target]");
return Plugin_Handled;
}
if (argc >= 1)
{
RemoveAllClientWeapons(target, client);
@ -175,7 +175,7 @@ public Action:Command_RemoveWeapons(client, argc)
{
RemoveAllClientWeapons(client, client);
}
return Plugin_Handled;
}
@ -189,21 +189,21 @@ public Action:Command_RemoveWeapons(client, argc)
ListWeaponSlots(client, observer, count = 10)
{
ReplyToCommand(observer, "Slot:\tEntity:\tClassname:");
// Loop through slots.
for (new slot = 0; slot < count; slot++)
{
new weapon = GetPlayerWeaponSlot(client, slot);
if (weapon < 0)
{
ReplyToCommand(observer, "%d\t(empty/invalid)", slot);
continue;
}
new String:classname[64];
GetEntityClassname(weapon, classname, sizeof(classname));
ReplyToCommand(observer, "%d\t%d\t%s", slot, weapon, classname);
}
}
@ -217,28 +217,28 @@ ListWeaponSlots(client, observer, count = 10)
ListWeapons(client, observer)
{
ReplyToCommand(observer, "Offset:\tEntity:\tClassname:");
// Loop through entries in m_hMyWeapons.
for(new offset = 0; offset < 128; offset += 4) // +4 to skip to next entry in array.
{
new weapon = GetEntDataEnt2(client, m_hMyWeapons + offset);
if (weapon < 0)
{
ReplyToCommand(observer, "%d\t(empty/invalid)", offset);
continue;
}
new String:classname[64];
GetEntityClassname(weapon, classname, sizeof(classname));
ReplyToCommand(observer, "%d\t%d\t%s", offset, weapon, classname);
}
}
/**
* Remove all weapons.
*
*
* @param client Source client.
* @param observer Client that will receive output.
* @param count Optional. Number of slots to list.
@ -249,16 +249,16 @@ RemoveAllClientWeapons(client, observer, count = 5)
for (new slot = 0; slot < count; slot++)
{
new weapon = GetPlayerWeaponSlot(client, slot);
// Remove all weapons in this slot.
while (weapon > 0)
{
// Remove weapon entity.
RemovePlayerItem(client, weapon);
AcceptEntityInput(weapon, "Kill");
ReplyToCommand(observer, "Removed weapon in slot %d.", slot);
// Get next weapon in this slot, if any.
weapon = GetPlayerWeaponSlot(client, slot);
}