Raised This Month: $51 Target: $400
 12% 

ViP Kill Money Error "m_iAccount" not found


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BulgarPL
Member
Join Date: Dec 2015
Old 12-04-2016 , 08:05   ViP Kill Money Error "m_iAccount" not found
Reply With Quote #1

Hello. (Sorry my bad ENG)

Im using on my serwer a simple plugin for give More money to the vip players (Kill, HS, Plant etc).

It works fine but i have these logs:

Code:
L 12/04/2016 - 14:00:42: [SM] Exception reported: Property "m_iAccount" not found (entity 0/worldspawn)
L 12/04/2016 - 14:00:42: [SM] Blaming: bulgarvip.smx
L 12/04/2016 - 14:00:42: [SM] Call stack trace:
L 12/04/2016 - 14:00:42: [SM]   [0] GetEntProp
L 12/04/2016 - 14:00:42: [SM]   [1] Line 43, bulgarvip.sp::Event_PlayerDeath
How to fix that?

Here is my plugin:

Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <clientprefs>
#include <colors>
#include <sdkhooks>

#pragma semicolon 1

public Plugin:myinfo = 
{
    name = "VIP Modules LINK",
    author = "BulgaR",
    description = "Dodatki dla VIP",
    version = "2.0",
    url = "LINK"
}

new Handle:Bombplanted;
new Handle:Bombdefused;
new Handle:Headshot_money;
new Handle:Kill_money;

public OnPluginStart()
{
    CreateConVar("sm_vip_version", "2.0", "BulgaR VIP", FCVAR_NOTIFY);
    
    Bombplanted = CreateConVar("vip_bomb_planted", "0", "Ilosc $ za podlozenie bomby", FCVAR_NOTIFY);
    Bombdefused = CreateConVar("vip_bomb_defused", "0", "Ilosc $ za rozbrojenie bomby", FCVAR_NOTIFY);
    Headshot_money = CreateConVar("vip_headshot_money", "0", "Ilosc $ za Headshot", FCVAR_NOTIFY);
    Kill_money = CreateConVar("vip_kill_money", "0", "Ilosc $ za fraga", FCVAR_NOTIFY);
    
    AutoExecConfig(true, "vip_bulgar");
    
    HookEvent("player_death", Event_PlayerDeath);
    HookEvent("bomb_planted", Event_BombPlanted);
    HookEvent("bomb_defused", Event_BombDefused);
}

public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
    new money = GetEntProp(attacker, Prop_Send, "m_iAccount");
    new g_headshot_money = GetConVarInt(Headshot_money);
    new g_kill_money = GetConVarInt(Kill_money);
    
    new bool:headshot = GetEventBool(event, "headshot");
    if (IsPlayerGenericAdmin(attacker))
    {
        if(headshot)
        {
            SetEntProp(attacker, Prop_Send, "m_iAccount", money + g_headshot_money);
        }
        else
        {
            SetEntProp(attacker, Prop_Send, "m_iAccount", money + g_kill_money);
        }
    }
}

public Event_BombPlanted(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    new money = GetEntProp(client, Prop_Send, "m_iAccount");
    new g_bombplanted = GetConVarInt(Bombplanted);
    
    if (IsPlayerGenericAdmin(client))
    {
        SetEntProp(client, Prop_Send, "m_iAccount", money + g_bombplanted);    
    }
}

public Event_BombDefused(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));
    new money = GetEntProp(client, Prop_Send, "m_iAccount");
    new g_bombdefused = GetConVarInt(Bombdefused);
    
    if (IsPlayerGenericAdmin(client))
    {
        SetEntProp(client, Prop_Send, "m_iAccount", money + g_bombdefused);
    }
}

bool:IsPlayerGenericAdmin(client)
{
    if (!CheckCommandAccess(client, "sm_vip", 0, true)) return false;    
    {
        return true;

    }
}

Last edited by BulgarPL; 12-04-2016 at 09:11.
BulgarPL is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-04-2016 , 08:47   Re: ViP Kill Money Error "m_iAccount" not found
Reply With Quote #2

You gotta make sure attacker is a valid player index
__________________
8guawong is offline
BulgarPL
Member
Join Date: Dec 2015
Old 12-04-2016 , 09:09   Re: ViP Kill Money Error "m_iAccount" not found
Reply With Quote #3

Quote:
Originally Posted by 8guawong View Post
You gotta make sure attacker is a valid player index
How can i do that? I am not yet so advanced in sourcemod
BulgarPL is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 12-04-2016 , 09:33   Re: ViP Kill Money Error "m_iAccount" not found
Reply With Quote #4

PHP Code:
stock bool:IsClientValid(client)
{
    if(
client && client <= MaxClients && IsClientInGame(client))
    {
        return 
true;
    }
    return 
false;

__________________
8guawong is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 12-04-2016 , 12:44   Re: ViP Kill Money Error "m_iAccount" not found
Reply With Quote #5

better
PHP Code:
stock bool:IsClientValid(client)
{
    return (
client <= MaxClients && IsClientInGame(client));

__________________

Last edited by Grey83; 12-04-2016 at 12:44.
Grey83 is offline
BulgarPL
Member
Join Date: Dec 2015
Old 12-05-2016 , 08:30   Re: ViP Kill Money Error "m_iAccount" not found
Reply With Quote #6

Its stil not working fine.

L 12/05/2016 - 14:209: [SM] Exception reported: Property "m_iAccount" not found (entity 0/worldspawn)
L 12/05/2016 - 14:209: [SM] Blaming: bulgarvip.smx
L 12/05/2016 - 14:209: [SM] Call stack trace:
L 12/05/2016 - 14:209: [SM] [0] GetEntProp
L 12/05/2016 - 14:209: [SM] [1] Line 43, bulgarvip.sp::Event_PlayerDeath
BulgarPL is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 12-05-2016 , 10:09   Re: ViP Kill Money Error "m_iAccount" not found
Reply With Quote #7

Do a global variable int g_iAcconunt = -1
And OnPluginStart add:
PHP Code:
g_iAccount FindSendPropOffs("CCSPlayer""m_iAccount"); 
And to add/get money use these stacks:
PHP Code:
public void SetMoney(int clientint amount)
{
    if (
g_iAccount != -1)
        
SetEntData(clientg_iAccountamount);
}  

public 
void GetMoney(int client)
{
    if (
g_iAccount != -1)
        return 
GetEntData(clientg_iAccount);

    return 
0;

__________________


Max-Play.pl - the best polish servers
CamerDisco is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 12-05-2016 , 10:17   Re: ViP Kill Money Error "m_iAccount" not found
Reply With Quote #8

CamerDisco, perhaps you meant
PHP Code:
public int GetMoney(int client)
{
    if (
g_iAccount != -1)
        return 
GetEntData(clientg_iAccount);

    return 
0;

?
__________________
Grey83 is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 12-05-2016 , 10:33   Re: ViP Kill Money Error "m_iAccount" not found
Reply With Quote #9

I think it doesn't matter, but yes it see better, he could do it without stacks, but it's more comfortable.
__________________


Max-Play.pl - the best polish servers
CamerDisco is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 12-05-2016 , 10:34   Re: ViP Kill Money Error "m_iAccount" not found
Reply With Quote #10

BulgarPL, try this:
PHP Code:
#include <sourcemod>
#include <sdktools>
//#include <cstrike>
//#include <clientprefs>
//#include <colors>
//#include <sdkhooks>

#pragma semicolon 1

#define PLUGIN_VERSION "2.0.1"

new Handle:Bombplanted;
new 
Handle:Bombdefused;
new 
Handle:Headshot_money;
new 
Handle:Kill_money;

enum
{
    
kill,
    
headshot,
    
defused,
    
planted
}

public 
Plugin:myinfo 
{
    
name        "VIP Modules LINK",
    
author        "BulgaR",
    
description    "Dodatki dla VIP",
    
version        PLUGIN_VERSION,
    
url            "LINK"
}

public 
OnPluginStart()
{
    
CreateConVar("sm_vip_version"PLUGIN_VERSION"BulgaR VIP"FCVAR_NOTIFY|FCVAR_DONTRECORD|FCVAR_SPONLY);

    
Bombplanted CreateConVar("vip_bomb_planted""0""Ilosc $ za podlozenie bomby"FCVAR_NOTIFYtrue0.0);
    
Bombdefused CreateConVar("vip_bomb_defused""0""Ilosc $ za rozbrojenie bomby"FCVAR_NOTIFYtrue0.0);
    
Headshot_money CreateConVar("vip_headshot_money""0""Ilosc $ za Headshot"FCVAR_NOTIFYtrue0.0);
    
Kill_money CreateConVar("vip_kill_money""0""Ilosc $ za fraga"FCVAR_NOTIFYtrue0.0);

    
AutoExecConfig(true"vip_bulgar");

    
HookEvent("player_death"Event_PlayerDeath);
    
HookEvent("bomb_planted"Event_BombPlanted);
    
HookEvent("bomb_defused"Event_BombDefused);
}

public 
Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    
SetMoney(GetClientOfUserId(GetEventInt(event"attacker")), GetEventBool(event"headshot") ? headshot kill);
}

public 
Event_BombPlanted(Handle:event, const String:name[], bool:dontBroadcast)
{
    
SetMoney(GetClientOfUserId(GetEventInt(event"userid")), planted);
}

public 
Event_BombDefused(Handle:event, const String:name[], bool:dontBroadcast)
{
    
SetMoney(GetClientOfUserId(GetEventInt(event"userid")), defused);
}

SetMoney(clientaward)
{
    if(
client && CheckCommandAccess(client"sm_vip"0true))
    {
        new 
money GetEntProp(clientProp_Send"m_iAccount");
        switch(
award)
        {
            case 
kill:        money += GetConVarInt(Kill_money);
            case 
headshot:    money += GetConVarInt(Headshot_money);
            case 
defused:    money += GetConVarInt(Bombdefused);
            case 
planted:    money += GetConVarInt(Bombplanted);
        }
        
SetEntProp(clientProp_Send"m_iAccount"money);
    }

__________________

Last edited by Grey83; 12-05-2016 at 10:51.
Grey83 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode