Raised This Month: $32 Target: $400
 8% 

[Problem] Deathmatch for No more room in hell


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lobo_arg
Junior Member
Join Date: Mar 2017
Old 04-26-2017 , 20:33   [Problem] Deathmatch for No more room in hell
Reply With Quote #1

Hello everyone! I have the following problem in my pluging.
I understand that the m_iScore property is not something that the player has. It must be added. I think with prop_send. But I do not know how.
Note: the game does not work with m_ifrags.

Quote:
L 04/26/2017 - 21:15:11: [SM] Exception reported: Property "m_iScore" not found (entity 1/player)
L 04/26/2017 - 21:15:11: [SM] Blaming: deathmatch.smx
L 04/26/2017 - 21:15:11: [SM] Call stack trace:
L 04/26/2017 - 21:15:11: [SM] [0] SetEntProp
L 04/26/2017 - 21:15:11: [SM] [1] Line 26, /
How can I add the m_iScore property to the attacker / player?

Code:
#include <sourcemod>
#include <sdktools>
#include <clients>
#include <entity>

public Plugin myinfo =
{
    name = "Deathmatch",
    author = "Verideth ,edit Lobo_arg",
    description = "Deathmatch gamemode for Nmrih",
    version = "1.0",
    url = ""
};

//public Action:Event_Spawn(Handle:event, const String:name[], bool:dontBroadcast)
//{
//  
//}

public Action PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
    //Get ids

	int attacker = GetClientOfUserId(event.GetInt("attacker"));

        SetEntProp(attacker, Prop_Data, "m_iScore", GetClientFrags(attacker) + 1);
	
    //kill count
    if (attacker > 0 && IsClientInGame(attacker) && GetClientFrags(attacker) >= 5) // if having 5 kills then continue.
    {
        PrintToChatAll("**********\x03ยก%N \x04ES EL GANADOR!**********", attacker);
        CreateTimer(8.0, ForceLevel);
    }
         
    return Plugin_Continue;
}
 
public Action ForceLevel(Handle timer)
{
	decl String:maps[][] = 
	{
		"nms_favela",
		"nmo_chinatown",
		"nms_flooded",
		"nms_isolated",
		"nmo_genex",
		"nms_campfire",
		"nms_operation_halloween",
	}

    ForceChangeLevel(maps[GetRandomInt(0, 6)], "Changing because the winner has won the game!");
}
 
public OnPluginStart()
{
    HookEvent("player_death", PlayerDeath);
}
lobo_arg is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 04-27-2017 , 03:58   Re: [Problem] Deathmatch for No more room in hell
Reply With Quote #2

You need m_iFrags, not m_iScore
Spoiler
__________________

Last edited by Grey83; 04-27-2017 at 04:01.
Grey83 is offline
lobo_arg
Junior Member
Join Date: Mar 2017
Old 04-27-2017 , 18:41   Re: [Problem] Deathmatch for No more room in hell
Reply With Quote #3

Quote:
Originally Posted by Grey83 View Post
You need m_iFrags, not m_iScore
Spoiler
I use sm_dump_netprops netprops.txt in server console and in the file that is generated does not appear m_iFrags. M_iScore appears to me. How did you get that list?

Anyway try this and it did not work.

Code:
public Action PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
    //Get ids
	int client = GetClientOfUserId(event.GetInt("userid"));
	int attacker = GetClientOfUserId(event.GetInt("attacker"));
	SetEntProp(attacker, Prop_Data, "m_iFrags", GetClientFrags(attacker) + 1);
lobo_arg is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 04-27-2017 , 18:44   Re: [Problem] Deathmatch for No more room in hell
Reply With Quote #4

Show the error and show GetClientFrags
__________________
Neuro Toxin is offline
lobo_arg
Junior Member
Join Date: Mar 2017
Old 04-27-2017 , 19:04   Re: [Problem] Deathmatch for No more room in hell
Reply With Quote #5

Quote:
Originally Posted by Neuro Toxin View Post
Show the error and show GetClientFrags
This is the part where m_iFrags is. I did not throw a bug in the console. But nothing happened to kill 5 players.

Code:
public Action PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
    //Get ids
	int attacker = GetClientOfUserId(event.GetInt("attacker"));
        SetEntProp(attacker, Prop_Data, "m_iFrags", GetClientFrags(attacker) + 1);
	
    //kill count
    if (attacker > 0 && IsClientInGame(attacker) && GetClientFrags(attacker) >= 5) // if having 5 kills then continue.
    {
        PrintToChatAll("**********\x03ยก%N \x04ES EL GANADOR!**********", attacker);
        CreateTimer(8.0, ForceLevel);
    }
         
    return Plugin_Continue;
}
lobo_arg is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 04-28-2017 , 05:40   Re: [Problem] Deathmatch for No more room in hell
Reply With Quote #6

Quote:
Originally Posted by lobo_arg View Post
I use sm_dump_netprops netprops.txt
it's from datamaps

You need something like that:
PHP Code:
public Action PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    if (
attacker && IsClientInGame(attacker) && attacker != GetClientOfUserId(event.GetInt("userid")))
    {
        
int frags GetEntProp(attackerProp_Data"m_iFrags") + 1;
        
SetEntProp(attackerProp_Data"m_iFrags"frags);

        if (
frags >= 5// if having 5 kills then continue.
        
{
            
PrintToChatAll("**********\x03ยก%N \x04ES EL GANADOR!**********"attacker);
            
CreateTimer(8.0ForceLevel);
        }
    }

    return 
Plugin_Continue;

__________________

Last edited by Grey83; 04-28-2017 at 06:13.
Grey83 is offline
lobo_arg
Junior Member
Join Date: Mar 2017
Old 04-28-2017 , 19:16   Re: [Problem] Deathmatch for No more room in hell
Reply With Quote #7

Quote:
Originally Posted by Grey83 View Post
it's from datamaps

You need something like that:
PHP Code:
public Action PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    if (
attacker && IsClientInGame(attacker) && attacker != GetClientOfUserId(event.GetInt("userid")))
    {
        
int frags GetEntProp(attackerProp_Data"m_iFrags") + 1;
        
SetEntProp(attackerProp_Data"m_iFrags"frags);

        if (
frags >= 5// if having 5 kills then continue.
        
{
            
PrintToChatAll("**********\x03ยก%N \x04ES EL GANADOR!**********"attacker);
            
CreateTimer(8.0ForceLevel);
        }
    }

    return 
Plugin_Continue;

I did not work. I show you how I did it.
Code:
#include <sourcemod>
#include <sdktools>
#include <clients>
#include <entity>

public Plugin myinfo =
{
    name = "Deathmatch",
    author = "Verideth ,edit Lobo_arg",
    description = "Deathmatch gamemode for Nmrih",
    version = "1.0",
    url = ""
};

public OnPluginStart()
{
    HookEvent("player_death", PlayerDeath);
}

public Action PlayerDeath(Event event, const char[] name, bool dontBroadcast)
{
    int attacker = GetClientOfUserId(event.GetInt("attacker"));
    if (attacker && IsClientInGame(attacker) && attacker != GetClientOfUserId(event.GetInt("userid")))
    {
        int frags = GetEntProp(attacker, Prop_Data, "m_iFrags") + 1;
        SetEntProp(attacker, Prop_Data, "m_iFrags", frags);

        if (frags >= 5) // if having 5 kills then continue.
        {
            PrintToChatAll("**********\x03ยก%N \x04ES EL GANADOR!**********", attacker);
            CreateTimer(8.0, ForceLevel);
        }
    }

    return Plugin_Continue;
}  
 
public Action ForceLevel(Handle timer)
{
	decl String:maps[][] = 
	{
		"nms_favela",
		"nmo_chinatown",
		"nms_flooded",
		"nms_isolated",
		"nmo_genex",
		"nms_campfire",
		"nms_operation_halloween",
	}

    ForceChangeLevel(maps[GetRandomInt(0, 6)], "Changing because the winner has won the game!");
}
lobo_arg is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 04-29-2017 , 02:11   Re: [Problem] Deathmatch for No more room in hell
Reply With Quote #8

PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sdktools>

int iMapsNum;
static const 
char sMaps[][] = {
    
"nms_favela",
    
"nmo_chinatown",
    
"nms_flooded",
    
"nms_isolated",
    
"nmo_genex",
    
"nms_campfire",
    
"nms_operation_halloween"};

public 
Plugin myinfo =
{
    
name        "Deathmatch",
    
author        "Verideth, edit Lobo_arg",
    
description    "Deathmatch gamemode for NMRiH",
    
version        "1.0",
    
url            "https://forums.alliedmods.net/showthread.php?p=2516714"
};

public 
void OnPluginStart()
{
    
HookEvent("player_death"PlayerDeath);
    
iMapsNum sizeof(sMaps) - 1;
}

public 
Action PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    if (
attacker && IsClientInGame(attacker) && attacker != GetClientOfUserId(event.GetInt("userid")))
    {
        
int frags GetEntProp(attackerProp_Data"m_iFrags") + 1;
        
SetEntProp(attackerProp_Data"m_iFrags"frags);

        if (
frags >= 5// if having 5 kills then continue.
        
{
            
PrintToChatAll("**********\x03ยก%N \x04ES EL GANADOR!**********"attacker);
            
CreateTimer(8.0ForceLevel);
        }
    }

    return 
Plugin_Continue;
}

public 
Action ForceLevel(Handle timer)
{
    
ForceChangeLevel(sMaps[GetRandomInt(0iMapsNum)], "Changing because the winner has won the game!");

__________________
Grey83 is offline
lobo_arg
Junior Member
Join Date: Mar 2017
Old 04-29-2017 , 19:10   Re: [Problem] Deathmatch for No more room in hell
Reply With Quote #9

Quote:
Originally Posted by Grey83 View Post
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sdktools>

int iMapsNum;
static const 
char sMaps[][] = {
    
"nms_favela",
    
"nmo_chinatown",
    
"nms_flooded",
    
"nms_isolated",
    
"nmo_genex",
    
"nms_campfire",
    
"nms_operation_halloween"};

public 
Plugin myinfo =
{
    
name        "Deathmatch",
    
author        "Verideth, edit Lobo_arg",
    
description    "Deathmatch gamemode for NMRiH",
    
version        "1.0",
    
url            "https://forums.alliedmods.net/showthread.php?p=2516714"
};

public 
void OnPluginStart()
{
    
HookEvent("player_death"PlayerDeath);
    
iMapsNum sizeof(sMaps) - 1;
}

public 
Action PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
int attacker GetClientOfUserId(event.GetInt("attacker"));
    if (
attacker && IsClientInGame(attacker) && attacker != GetClientOfUserId(event.GetInt("userid")))
    {
        
int frags GetEntProp(attackerProp_Data"m_iFrags") + 1;
        
SetEntProp(attackerProp_Data"m_iFrags"frags);

        if (
frags >= 5// if having 5 kills then continue.
        
{
            
PrintToChatAll("**********\x03ยก%N \x04ES EL GANADOR!**********"attacker);
            
CreateTimer(8.0ForceLevel);
        }
    }

    return 
Plugin_Continue;
}

public 
Action ForceLevel(Handle timer)
{
    
ForceChangeLevel(sMaps[GetRandomInt(0iMapsNum)], "Changing because the winner has won the game!");

Compiling it with http://www.sourcemod.net/compiler.php would throw me errors. So use https://spider.limetech.io/ and compile well. I tried it but it did not work.
lobo_arg is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 04-29-2017 , 19:33   Re: [Problem] Deathmatch for No more room in hell
Reply With Quote #10

lobo_arg, what exactly does not work?
Quote:
Compiling it with http://www.sourcemod.net/compiler.php would throw me errors.
Bkz it can compile code for SM1.7 maximum.
Code written for SM1.8+
__________________
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 00:03.


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