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

[CSGO] Need some help with SoccerMod-plugin remake


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
BlackHawk1337
Junior Member
Join Date: Jan 2013
Old 03-09-2016 , 16:10   [CSGO] Need some help with SoccerMod-plugin remake
Reply With Quote #1

Hey there! I'm just started my experience with SourcePawn and Sourcemod as well and I've got some problems right now. Its too hard for me to get rid of them, but I'm sure you guys can easily solve them.

First of all, this is the original plugin
I just wanna to upgrade one of this plugin's function.
So, I have my own football-based map. If a player(for example CT) scores a goal then all enemy team(T) will be killed by trigger_hurt. In plugin there are function which give "1" frag(1 point) for the goal-scoring player. But all the players who were killed by the trigger_hurt gets "-1" frag in their statistic. And this is what I want to change.
There are a piece of code with this function(goalscorer):
Spoiler

1. I want to give a "1" frag(point) to the all dead players. Thats is because if someone from the dead players have already scored a goal early, he then won't lost his own goal statistic(frags).
Hope you understand my idea.
2. I want to remove a possibility to gain a frag when you're scoring an own goal.
There are the original piece of code with this function:
Spoiler


This piece of code seems understandable but what means this string: "LastAttackerUser != -1"?

Also I has prepared a solutions for my own questions.
1.
Spoiler

I'm using "player_hurt" event because on my map there are only one way that you can die and this is "trigger_hurt". Maybe there are more easier solution with the "player_death" just let me know about it. So, the main problem is here: what do I need to type instead of "***"?
Do I need to make an another hook-function like "public Action:OnEntityTakeDamage" or what?
Can't solve this by myself :c
2.
Spoiler

There I dont know how to let the plugin know that the LastAttackerUser is dead :c

Thats all for now, hope you can understand my poor English c;

P.S. Almost forgot bout it. How can I check this plugin for working in CS:GO? Is there any methods to check it except just putting my plugin at the server?

Last edited by BlackHawk1337; 03-09-2016 at 16:30.
BlackHawk1337 is offline
Blowst
Senior Member
Join Date: Feb 2011
Location: Korea, Republic of
Old 03-11-2016 , 23:26   Re: [CSGO] Need some help with SoccerMod-plugin remake
Reply With Quote #2

if(LastAttackerUser != -1) means "if there's LastAttackerUser" take look the code one more time and think about it.

u'll get it easyly.

Spoiler


in OnEntityCreated, the edict should be the soccerball if you want to make soccer mod scorer.

So, LastAttackerUser will be the index of the player who kicked soccerball recently.



PHP Code:
public OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeath);
    
HookEvent("round_end"Event_RoundEnd);
}

public 
Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
        new 
client GetClientOfUserId(GetEventInt(event"userid")); // this is *** wut u wanted!

        
new FragsForDead GetClientFrags(client); // Let's get the frags of dead person(client).
        
new nFragsForDead FragsForDead 1// <client's frags>+1
        
SetClientFrags(clientnFragsForDead); // It should be 'client' not 'LastAttackerUser' if u want sensible way for this.
}

public 
Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
        
// WELL... I DON'T KNOW Y U WANT TO GIVE MINUS SCORE TO FRAGGER...
        
if( IsPlayerAlive(LastAttackerUser) ) // Is the fragger alive?
        
{
            
FragsForDead GetClientFrags (LastAttackerUser); // Get Fragger's score
            
nFragsForDead FragsForDead 2// give an own-scorer "-1" frag in his stats
            
SetClientFrags(LastAttackerUsernFragsForDead);
        }

Y did I Hook round_end and set fragger's score on it:

'cuz player_death fired when every single player dies.

for example,
there's 5 players on CT and also 5 players on T.
when a T player make a goal, all of CT players die.
then player_death fired 5 times. ('cuz 5 players died!)

I thought u want to set fragger's score just one time.
__________________
Sorry about my poor English


Last edited by Blowst; 03-20-2016 at 05:21.
Blowst is offline
Addicted.
AlliedModders Donor
Join Date: Dec 2013
Location: 0xA9D0DC
Old 03-14-2016 , 07:41   Re: [CSGO] Need some help with SoccerMod-plugin remake
Reply With Quote #3

Quote:
Originally Posted by Blowst View Post
if(LastAttackerUser != -1) means "if there's no LastAttackerUser" take look the code one more time and think about it.
You should take a look at the code one more time
Addicted. is offline
Blowst
Senior Member
Join Date: Feb 2011
Location: Korea, Republic of
Old 03-20-2016 , 05:22   Re: [CSGO] Need some help with SoccerMod-plugin remake
Reply With Quote #4

Quote:
Originally Posted by oaaron99 View Post
You should take a look at the code one more time
God, u right, edited. thx
__________________
Sorry about my poor English

Blowst is offline
Reply


Thread Tools
Display Modes

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:44.


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