Jump to content
assignment_ind Existing user? Sign In

Sign In



person_add Sign Up
Go-Code.pl - Support SourceMod i Pluginy CS:GO

Recommended Posts

 

 

  • Lubię to! 6
  • Dobry pomysł! 1

Share this post


Link to post
Share on other sites
#include <sourcemod>


/*define HITGROUP_GENERIC  0
 #define HITGROUP_HEAD    1
 #define HITGROUP_CHEST    2
 #define HITGROUP_STOMACH  3
 #define HITGROUP_LEFTARM   4
 #define HITGROUP_RIGHTARM   5
 #define HITGROUP_LEFTLEG    6
 #define HITGROUP_RIGHTLEG   7*/

char hitgroup[][] =  {
	"Generic", 
	"Head", 
	"Chest", 
	"Stomach", 
	"LeftArm", 
	"RightArm", 
	"LeftLeg", 
	"RightLeg"
};

public void OnPluginStart() {
	HookEvent("player_hurt", PlayerDamage, EventHookMode_Post);
}

public Action PlayerDamage(Event event, char[] name, bool dontBroadcast) {
	int dmg = event.GetInt("dmg_health");
	int client = GetClientOfUserId(event.GetInt("attacker"));
	int hg = event.GetInt("hitgoup");
	
	PrintCenterText(client, "<font color ='#42b9f5'>Ubral si mu: %d</font>\n<font color ='#63f542'>Trafil si ho: %s</font>", dmg, hitgroup[hg]);
}

Hi
I did tren plugin according to video tutorial but but my bugs here is screanshot:

 

20191005185751_1.jpg

 

and I also supply an extract from the error log:

L 10/05/2019 - 18:48:27: [SM] Blaming: test.smx
L 10/05/2019 - 18:48:27: [SM] Call stack trace:
L 10/05/2019 - 18:48:27: [SM]   [0] PrintCenterText
L 10/05/2019 - 18:48:27: [SM]   [1] Line 33, D:\pluginy a tak dalej\source\sourcemod\scripting\test.sp::PlayerDamage
L 10/05/2019 - 18:50:44: [SM] Exception reported: Client index 0 is invalid

 

 

 

  • Lubię to! 1

Share this post


Link to post
Share on other sites

 

Find and replace

int hg = event.GetInt("hitgoup");

change to

 

int hg = event.GetInt("hitgroup");

 

Edited by szogun
  • Lubię to! 2

Share this post


Link to post
Share on other sites

ok well thank you

Share this post


Link to post
Share on other sites

and one more thing I tried to remake it just for vip works like he's just throwing me one error in the error log:

 

L 10/06/2019 - 12:25:17: [SM] Blaming: test.smx
L 10/06/2019 - 12:25:17: [SM] Call stack trace:
L 10/06/2019 - 12:25:17: [SM]   [1] Line 50, test.sp::PlayerDamage
L 10/06/2019 - 12:25:18: [SM] Exception reported: Client index 0 is invalid

 

here is the line:

 

    if (GetUserFlagBits(client) && ADMFLAG_CUSTOM4)
    
    
    PrintCenterText(client, "<font color='#42b9f5'>Ubral si mu: %d</font>\n<font color='#63f542'>Trafil si mu: %s</font>", dmg, hitgroup[hg]);

Edited by laibach

Share this post


Link to post
Share on other sites
2 godziny temu, laibach napisał:

and one more thing I tried to remake it just for vip works like he's just throwing me one error in the error log:

 

L 10/06/2019 - 12:25:17: [SM] Blaming: test.smx
L 10/06/2019 - 12:25:17: [SM] Call stack trace:
L 10/06/2019 - 12:25:17: [SM]   [1] Line 50, test.sp::PlayerDamage
L 10/06/2019 - 12:25:18: [SM] Exception reported: Client index 0 is invalid

 

here is the line:

 

    if (GetUserFlagBits(client) && ADMFLAG_CUSTOM4)
    
    
    PrintCenterText(client, "<font color='#42b9f5'>Ubral si mu: %d</font>\n<font color='#63f542'>Trafil si mu: %s</font>", dmg, hitgroup[hg]);


public Action Player_Hurt(Event event, const char[] name, bool dontBroadcast)
{
  if(client <= 0) return Plugin_Continue;

//code
}

Share this post


Link to post
Share on other sites

and where do I put it exactly I'm new to this so I don't know

Share this post


Link to post
Share on other sites
42 minuty temu, laibach napisał:

and where do I put it exactly I'm new to this so I don't know


Add this before PrintCenterText

Share this post


Link to post
Share on other sites
dond compile:

#include <sourcemod>


/*define HITGROUP_GENERIC  0
 #define HITGROUP_HEAD    1
 #define HITGROUP_CHEST    2
 #define HITGROUP_STOMACH  3
 #define HITGROUP_LEFTARM   4
 #define HITGROUP_RIGHTARM   5
 #define HITGROUP_LEFTLEG    6
 #define HITGROUP_RIGHTLEG   7*/

char hitgroup[][] =  {
    "Generic", 
    "Head", 
    "Chest", 
    "Stomach", 
    "LeftArm", 
    "RightArm", 
    "LeftLeg", 
    "RightLeg"
};

public void OnPluginStart() {
    HookEvent("player_hurt", PlayerDamage, EventHookMode_Post);
}

public Action PlayerDamage(Event event, char[] name, bool dontBroadcast) {
    int dmg = event.GetInt("dmg_health");
    int client = GetClientOfUserId(event.GetInt("attacker"));
    int hg = event.GetInt("hitgoup");
    

    
    PrintCenterText(client, "<font color ='#42b9f5'>Ubral si mu: %d</font>\n<font color ='#63f542'>Trafil si ho: %s</font>", dmg, hitgroup[hg]);
    
    public Action Player_Hurt(Event event, const char[] name, bool dontBroadcast) {
  if(client <= 0) return Plugin_Continue;

 if (GetUserFlagBits(client) && ADMFLAG_CUSTOM4)
} 
}

 

error:

D:\pluginy a tak dalej\source\sourcemod\scripting\test.sp(37) : error 029: invalid expression, assumed zero
D:\pluginy a tak dalej\source\sourcemod\scripting\test.sp(37) : error 001: expected token: ";", but found "("
D:\pluginy a tak dalej\source\sourcemod\scripting\test.sp(37) : error 174: symbol 'Event' is a type and cannot be used as a value
D:\pluginy a tak dalej\source\sourcemod\scripting\test.sp(37) : fatal error 190: too many error messages on one line
Done

 

Share this post


Link to post
Share on other sites

@laibach

 

Spoiler

#include <sourcemod>


/*define HITGROUP_GENERIC  0
 #define HITGROUP_HEAD    1
 #define HITGROUP_CHEST    2
 #define HITGROUP_STOMACH  3
 #define HITGROUP_LEFTARM   4
 #define HITGROUP_RIGHTARM   5
 #define HITGROUP_LEFTLEG    6
 #define HITGROUP_RIGHTLEG   7*/

char hitgroup[][] =  {
	"Generic", 
	"Head", 
	"Chest", 
	"Stomach", 
	"LeftArm", 
	"RightArm", 
	"LeftLeg", 
	"RightLeg"
};

public void OnPluginStart() {
	HookEvent("player_hurt", PlayerDamage, EventHookMode_Post);
}

public Action PlayerDamage(Event event, char[] name, bool dontBroadcast) {
	int client = GetClientOfUserId(event.GetInt("attacker"));
	if (client <= 0)return Plugin_Continue;
	
	int hg = event.GetInt("hitgroup");
	int dmg = event.GetInt("dmg_health");
	
	if (GetUserFlagBits(client) & ADMFLAG_CUSTOM4) {
		PrintCenterText(client, "<font color ='#42b9f5'>Ubral si mu: %d</font>\n<font color ='#63f542'>Trafil si ho: %s</font>", dmg, hitgroup[hg]);
	}
	
	return Plugin_Continue;
} 

 

 

Edited by Brum Brum

Share this post


Link to post
Share on other sites

Remember to change:

int hg = event.GetInt("hitgoup");

to:

int hg = event.GetInt("hitgroup");

The whole thing should look like that:

Spoiler

#include <sourcemod>

/*
    #define HITGROUP_GENERIC     0
    #define HITGROUP_HEAD     1
    #define HITGROUP_CHEST     2
    #define HITGROUP_STOMACH     3
    #define HITGROUP_LEFTARM     4
    #define HITGROUP_RIGHTARM     5
    #define HITGROUP_LEFTLEG     6
    #define HITGROUP_RIGHTLEG     7
*/

char hitgroup[][] =  {
    "Generic", 
    "Head", 
    "Chest", 
    "Stomach", 
    "LeftArm", 
    "RightArm", 
    "LeftLeg", 
    "RightLeg"
};

public void OnPluginStart() {
    HookEvent("player_hurt", PlayerDamage, EventHookMode_Post);
}

public Action PlayerDamage(Event event, char[] name, bool dontBroadcast) {
    int dmg = event.GetInt("dmg_health");
    int client = GetClientOfUserId(event.GetInt("attacker"));
    int hg = event.GetInt("hitgroup");
    
    PrintCenterText(client, "<font color ='#42b9f5'>Ubral si mu: %d</font>\n<font color ='#63f542'>Trafil si ho: %s</font>", dmg, hitgroup[hg]);
    
    public Action Player_Hurt(Event event, const char[] name, bool dontBroadcast) {
        if (client <= 0) {
            return Plugin_Continue;
        }
    }
}

 

 

Edited by Wengiel

Share this post


Link to post
Share on other sites
18 godzin temu, Wengiel napisał:

Remember to change:


int hg = event.GetInt("hitgoup");

to:


int hg = event.GetInt("hitgroup");

The whole thing should look like that:

 
Hej! Skorzystałeś z linku lub pobrałeś załącznik? Uhonoruj naszą pracę poprzez rejestrację na forum i rośnij razem z nami! Pokaż ukrytą zawartość


#include <sourcemod>

/*
    #define HITGROUP_GENERIC     0
    #define HITGROUP_HEAD     1
    #define HITGROUP_CHEST     2
    #define HITGROUP_STOMACH     3
    #define HITGROUP_LEFTARM     4
    #define HITGROUP_RIGHTARM     5
    #define HITGROUP_LEFTLEG     6
    #define HITGROUP_RIGHTLEG     7
*/

char hitgroup[][] =  {
    "Generic", 
    "Head", 
    "Chest", 
    "Stomach", 
    "LeftArm", 
    "RightArm", 
    "LeftLeg", 
    "RightLeg"
};

public void OnPluginStart() {
    HookEvent("player_hurt", PlayerDamage, EventHookMode_Post);
}

public Action PlayerDamage(Event event, char[] name, bool dontBroadcast) {
    int dmg = event.GetInt("dmg_health");
    int client = GetClientOfUserId(event.GetInt("attacker"));
    int hg = event.GetInt("hitgroup");
    
    PrintCenterText(client, "<font color ='#42b9f5'>Ubral si mu: %d</font>\n<font color ='#63f542'>Trafil si ho: %s</font>", dmg, hitgroup[hg]);
    
    public Action Player_Hurt(Event event, const char[] name, bool dontBroadcast) {
        if (client <= 0) {
            return Plugin_Continue;
        }
    }
}

plugin.sp(15) : error 029: invalid expression, assumed zero

plugin.sp(23) : error 010: invalid function or declaration

plugin.sp(28) : error 010: invalid function or declaration

plugin.sp(36) : error 029: invalid expression, assumed zero

plugin.sp(36) : error 001: expected token: ";", but found "("

plugin.sp(36) : error 174: symbol 'Event' is a type and cannot be used as a value

plugin.sp(36) : fatal error 190: too many error messages on one line

 

Unable to compile

Edited by laibach

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.


O NAS Jesteśmy społecznością łączącą ludzi, którzy dzielą pasję poznawania CS:GO od strony programistycznej. Posiadamy duże zaplecze merytoryczne i zawsze cieszymy się, gdy dołączają do nas osoby gotowe do nauki. Gwarantujemy, że z odrobiną wytrwałości i otwartym umysłem bardzo szybko napiszesz swój pierwszy plugin. Zapraszamy! 🙂
Szablon wykonany z dużą ilością przez cyberpixelz / Mesharsky / Sitefuture
Forum dumnie napędzane przez: Invision Power Services, Inc.
×
×
  • Create New...