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

CS:GO ranking for 1v1 Arena


Post New Thread Reply   
 
Thread Tools Display Modes
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 01-05-2016 , 13:36   Re: CS:GO ranking for 1v1 Arena
Reply With Quote #11

Here we go :
1) Grab multi1v1.inc from here (original sources) :
https://github.com/splewis/csgo-mult...ipting/include
and include it in your project.
2) Hook when a player die. And store the killer and loser in two variables. (let's call it ArenaWinner and ArenaLoose)
3) Then do a simple If case with this stock Multi1v1_GetOpponent , if it returns -1, abort (return Plugin_Continue or what ever.)
4) Otherwise, if the value wasn't -1 of the above stock, do Multi1v1_GetArenaNumber(ArenaWinner) and store it inside a variable called ArenaNumber
5) then, simple do Score[ArenaWinner] += ArenaNumber; and Score[ArenaLoose] -= ArenaNumber;
6) TADA! You did it, good job ! Make sure to release it !

I did this instructions and not code, since you didn't want to. And that's alright. If you got any troubles, then feel free to post message here, ill try to answer them.

Also, you can give splewis a hudge thanks for doing this include file. Wich saved you much houres of pain and suffer.
__________________
Want to check my plugins ?
Arkarr is offline
Janek_Waleczny
Member
Join Date: Jul 2015
Location: Poland
Old 01-05-2016 , 17:18   Re: CS:GO ranking for 1v1 Arena
Reply With Quote #12

I just love you dude. Thanks for everything I will write you a PM if I have further questions.

BTW - credits will be given to both you and splewis
Janek_Waleczny is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 01-06-2016 , 13:35   Re: CS:GO ranking for 1v1 Arena
Reply With Quote #13

There we go ! The solution with little explication :
PHP Code:
#include <sourcemod>  
#include <sdktools> 
#include <cstrike> 
#include <multi1v1> //-----------> Point 1

int ScorePlayer[MAXPLAYERS+1];

public 
Plugin myinfo =  

    
name "Ranking Arena"
    
author "Janek"
    
description "Ranking na Arene. Credits:splewis, Arkarr"
    
version "1.0"
    
url "http://www.cs-serwer.pl/" 


public 
OnPluginStart() 

    
HookEvent("player_death"Event_OnPlayerDeath); //-----------> point 2 (hook event)
}  

//------------> point 2
public Action Event_OnPlayerDeath(Event event,const char[] namebool dontBroadcast)
{
    
int ArenaLooser GetClientOfUserId(event.GetInt("userid"));
    
int ArenaWinner GetClientOfUserId(event.GetInt("attacker"));
    
    
//------------> Point 3
    
if(Multi1v1_GetOpponent(ArenaWinner) == -1
        return 
Plugin_Continue;
    
    
// ------> point 4
    
int ArenaNumber Multi1v1_GetArenaNumber(ArenaWinner);

    
    
ScorePlayer[ArenaWinner] += ArenaNumber;
    
ScorePlayer[ArenaLooser] -= ArenaNumber;
    
    
PrintToChatAll("[Arena Points] %N won and got +%i points ! (%i)"ArenaWinnerArenaNumberScorePlayer[ArenaWinner]);
    
PrintToChatAll("[Arena Points] %N lost and lost -%i points ! (%i)"ArenaWinnerArenaNumberScorePlayer[ArenaLooser]);
    
    return 
Plugin_Continue;

__________________
Want to check my plugins ?
Arkarr 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 10:41.


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