Skip to content

Commit

Permalink
Added client checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
davenonymous committed Mar 27, 2010
1 parent 3d7393e commit 457f987
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 20 deletions.
2 changes: 0 additions & 2 deletions scripting/attributes.core.sp
Expand Up @@ -6,8 +6,6 @@
#pragma semicolon 1

#define PLUGIN_VERSION "0.1.0"
#define MAXSKILLLEVEL 10
#define ATTRIBUTESIZE 10

new Handle:g_hForwardAttributeChange;

Expand Down
10 changes: 6 additions & 4 deletions scripting/attributes.dexterity.sp
Expand Up @@ -78,10 +78,12 @@ public OnPluginEnd()

public att_OnDexterityChange(iClient, iValue, iAmount) {
g_Dexterity[iClient] = iValue;
applyClassSpeed(iClient);
if(iAmount != -1)
{
CPrintToChat(iClient, "You are now running {green}%i{default} faster.", g_Dexterity[iClient] * g_fSpeedMultiplier * 100);
if(IsClientInGame(iClient)) {
applyClassSpeed(iClient);
if(iAmount != -1)
{
CPrintToChat(iClient, "You are now running {green}%i{default} faster.", g_Dexterity[iClient] * g_fSpeedMultiplier * 100);
}
}
}

Expand Down
10 changes: 6 additions & 4 deletions scripting/attributes.dexterity.tf2.sp
Expand Up @@ -107,10 +107,12 @@ public OnPluginEnd()

public att_OnDexterityChange(iClient, iValue, iAmount) {
g_Dexterity[iClient] = iValue;
applyClassSpeed(iClient);
if(iAmount != -1)
{
CPrintToChat(iClient, "You are now running {green}%i{default} faster.", g_Dexterity[iClient] * g_fSpeedMultiplier * 100);
if(IsClientInGame(iClient)) {
applyClassSpeed(iClient);
if(iAmount != -1)
{
CPrintToChat(iClient, "You are now running {green}%i{default} faster.", g_Dexterity[iClient] * g_fSpeedMultiplier * 100);
}
}
}

Expand Down
10 changes: 6 additions & 4 deletions scripting/attributes.lifeforce.sp
Expand Up @@ -74,10 +74,12 @@ public OnPluginEnd()

public att_OnLifeforceChange(iClient, iValue, iAmount) {
g_Lifeforce[iClient] = iValue;
applyClassHealth(iClient);
if(iAmount != -1)
{
CPrintToChat(iClient, "You start with {green}%i{default} additional healthpoints.", g_Lifeforce[iClient] * g_iHealthPlus);
if(IsClientInGame(iClient)) {
applyClassHealth(iClient);
if(iAmount != -1)
{
CPrintToChat(iClient, "You start with {green}%i{default} additional healthpoints.", g_Lifeforce[iClient] * g_iHealthPlus);
}
}
}

Expand Down
10 changes: 6 additions & 4 deletions scripting/attributes.lifeforce.tf2.sp
Expand Up @@ -90,10 +90,12 @@ public OnPluginEnd()

public att_OnLifeforceChange(iClient, iValue, iAmount) {
g_Lifeforce[iClient] = iValue;
applyClassHealth(iClient);
if(iAmount != -1)
{
CPrintToChat(iClient, "You start with {green}%i{default} additional healthpoints.", g_Lifeforce[iClient] * g_iHealthPlus);
if(IsClientInGame(iClient)) {
applyClassHealth(iClient);
if(iAmount != -1)
{
CPrintToChat(iClient, "You start with {green}%i{default} additional healthpoints.", g_Lifeforce[iClient] * g_iHealthPlus);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion scripting/attributes.messages.sp
Expand Up @@ -61,7 +61,7 @@ public Event_Player_Death(Handle:event, const String:name[], bool:dontBroadcast)
}

public att_OnClientAttributeChange(iClient, iAttributeId, iValue, iAmount) {
if(att_IsEnabled())
if(att_IsEnabled() && IsClientInGame(iClient))
{
if(iAmount == -1)
CPrintToChat(iClient, "Your attribute points have been loaded.");
Expand Down
2 changes: 1 addition & 1 deletion scripting/attributes.strength.sp
Expand Up @@ -65,7 +65,7 @@ public OnClientPutInServer(client)
public att_OnStrengthChange(iClient, iValue, iAmount) {
g_Strength[iClient] = iValue;

if(iAmount != -1)
if(iAmount != -1 && IsClientInGame(iClient))
{
CPrintToChat(iClient, "You are now dealing {green}%i\%{default} more damage.", g_Strength[iClient] * g_fDmgMultiplier * 100);
}
Expand Down
2 changes: 2 additions & 0 deletions scripting/include/attributes.inc
Expand Up @@ -4,6 +4,8 @@
#define _attributes_included_

#define TATTAPIVERSION 1
#define MAXSKILLLEVEL 10
#define ATTRIBUTESIZE 10

enum attChooseResult {
att_OK,
Expand Down

0 comments on commit 457f987

Please sign in to comment.