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

Solved [CS:GO] Pass a data from datapack to a menu.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 03-19-2018 , 11:16   [CS:GO] Pass a data from datapack to a menu.
Reply With Quote #1

PHP Code:
public Action PlayerDeath(Handle event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(GetEventInt(event"userid"));
    
int attacker GetClientOfUserId(GetEventInt(event"attacker"));

    if(
GetClientTeam(attacker) == CS_TEAM_CT && GetClientTeam(victim) == CS_TEAM_T)
    {
        
Handle somestuff CreateDataPack(); 
        
WritePackCell(somestuffvictim)
        
ReasonMenu(attacker);
    }

How can I pass this datapack to a menu handler.
__________________

Last edited by PinHeaDi; 03-20-2018 at 07:51.
PinHeaDi is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 03-19-2018 , 11:31   Re: [CS:GO] Pass a data from datapack to a menu.
Reply With Quote #2

something like this:

PHP Code:
public Action PlayerDeath(Handle event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(GetEventInt(event"userid"));
    
int attacker GetClientOfUserId(GetEventInt(event"attacker"));

    if(
GetClientTeam(attacker) == CS_TEAM_CT && GetClientTeam(victim) == CS_TEAM_T)
    {
        
Handle somestuff CreateDataPack(); 
        
WritePackCell(somestuffvictim)
        
ReasonMenu(attackersomestuff);
    }
}

void ReasonMenu(int attackerHandle somestuff)
{
    
ResetPack(somestuff);
    
int victim ReadPackCell(somestuff);
    
// ...

__________________
coding & free software
shanapu is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 03-19-2018 , 11:46   Re: [CS:GO] Pass a data from datapack to a menu.
Reply With Quote #3

I need to pass that on the actual actions of the menu.
__________________
PinHeaDi is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 03-19-2018 , 11:53   Re: [CS:GO] Pass a data from datapack to a menu.
Reply With Quote #4

Quote:
Originally Posted by PinHeaDi View Post
I need to pass that on the actual actions of the menu.
use a global array
__________________
8guawong is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 03-19-2018 , 11:55   Re: [CS:GO] Pass a data from datapack to a menu.
Reply With Quote #5

Well that's the problem I don't know how, that's way im looking for help.
__________________
PinHeaDi is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 03-19-2018 , 11:58   Re: [CS:GO] Pass a data from datapack to a menu.
Reply With Quote #6

Quote:
Originally Posted by PinHeaDi View Post
Well that's the problem I don't know how, that's way im looking for help.
well we don't know that just by looking at your title / post

PHP Code:
int g_iVictim[MAXPLAYERS+1]

public 
Action PlayerDeath(Handle event, const char[] namebool dontBroadcast)
{
    
int victim GetClientOfUserId(GetEventInt(event"userid"));
    
int attacker GetClientOfUserId(GetEventInt(event"attacker"));

    if(
GetClientTeam(attacker) == CS_TEAM_CT && GetClientTeam(victim) == CS_TEAM_T)
    {
        
g_iVictim[attacker] = victim;
        
ReasonMenu(attacker);
    }

then use that in your menu callback
__________________
8guawong is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 03-19-2018 , 12:10   Re: [CS:GO] Pass a data from datapack to a menu.
Reply With Quote #7

It works, but it prints that I killed the console.

PHP Code:
CPrintToChatAll("%N уби %N с причина: Не е изпълнил заповедта на командира."attackerg_iVictim
__________________

Last edited by PinHeaDi; 03-19-2018 at 12:11.
PinHeaDi is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 03-19-2018 , 12:42   Re: [CS:GO] Pass a data from datapack to a menu.
Reply With Quote #8

Quote:
Originally Posted by PinHeaDi View Post
It works, but it prints that I killed the console.

PHP Code:
CPrintToChatAll("%N уби %N с причина: Не е изпълнил заповедта на командира."attackerg_iVictim
show whole code
__________________
8guawong is offline
PinHeaDi
Senior Member
Join Date: Jul 2013
Location: Bulgaria
Old 03-19-2018 , 12:49   Re: [CS:GO] Pass a data from datapack to a menu.
Reply With Quote #9

PHP Code:
{
int victim GetClientOfUserId(GetEventInt(event"userid"));
    
int attacker GetClientOfUserId(GetEventInt(event"attacker"));

    if(
GetClientTeam(attacker) == CS_TEAM_CT && GetClientTeam(victim) == CS_TEAM_T && !MyJailbreak_IsEventDayRunning())
    {
        
g_iVictim GetClientOfUserId(GetEventInt(event"userid"));
        
ReasonMenu(attacker);
    } 
Nvm, that worked.
__________________

Last edited by PinHeaDi; 03-19-2018 at 13:23.
PinHeaDi is offline
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 03-19-2018 , 13:23   Re: [CS:GO] Pass a data from datapack to a menu.
Reply With Quote #10

g_iVictim is an array.
Dr!fter 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 17:28.


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