Raised This Month: $ Target: $400
 0% 

A little help.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nixh
Member
Join Date: Nov 2013
Old 06-12-2014 , 16:36   A little help.
Reply With Quote #1

This message shows only for terrorists and its allright no need to change here anything.
PHP Code:
ShowSyncHudMsg(idhudhandler"Day: %d | Reason: %s"roundsreasons[userreason[id]]) 
But how to make that CT can see it too but with different text like this...
PHP Code:
ShowSyncHudMsg(idhudhandler"Day: %d"
Full code.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "Jail Break: Basic Info"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"

#define USERTASK 921
#define UPDATEDELAY 1.0

new static reasons[][] = {
"1.",
"2.",
"3.",
"4.",
"5.",
"6.",
"7.",
"8."
}

new 
userreason[33]
new 
roundshudhandler

public plugin_init()
{
register_plugin(PLUGINVERSIONAUTHOR)

register_event("TextMsg","restart_roundsnum""a","2&#Game_C"/*,"2&#Game_w"*/)

register_logevent("round_end"2"1=Round_End")

RegisterHam(Ham_Spawn"player""client_spawn"1)

hudhandler CreateHudSyncObj()
}

public 
round_end()
{
rounds ++
}

public 
restart_roundsnum()
{
rounds 0
}

public 
client_disconnect(id)
{
userreason[id] = -1

if(task_exists(id USERTASK))
{
remove_task(id USERTASK)
}
}

public 
client_spawn(id)
{
if(
task_exists(id USERTASK))
{
remove_task(id USERTASK)
}

if(
get_user_team(id) == 1)
{
userreason[id] = random_num(0sizeof reasons 1)

set_task(UPDATEDELAY"client_jailinfo"id USERTASK__"b")
}
}

public 
client_jailinfo(TASKID)
{
static 
id
id 
TASKID USERTASK

set_hudmessage
(025500.80.106.012.0)

ShowSyncHudMsg(idhudhandler"Day: %d | Reason: %s"roundsreasons[userreason[id]])

EDIT: Flick3rR, a thanks man i really appreciate it and you to bat.

Last edited by YamiKaitou; 06-12-2014 at 20:01.
nixh is offline
bat
Veteran Member
Join Date: Jul 2012
Old 06-12-2014 , 16:47   Re: A little help.
Reply With Quote #2

Try...
Code:
if(cs_get_user_team(id) == CS_TEAM_T)
{
   ShowSyncHudMsg(id, hudhandler, "Day: %d | Reason: %s", rounds, reasons[userreason[id]]) 
}
else
{
   ShowSyncHudMsg(id, hudhandler, "Day: %d")
}
bat is offline
Send a message via Skype™ to bat
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 06-12-2014 , 16:50   Re: A little help.
Reply With Quote #3

First you have to remove the check for the team before setting the task. In other word:
PHP Code:
public client_spawn(id)
{
if(
task_exists(id USERTASK))
{
remove_task(id USERTASK)
}

if(
get_user_team(id) == 1)
{
userreason[id] = random_num(0sizeof reasons 1)

set_task(UPDATEDELAY"client_jailinfo"id USERTASK__"b")
}

Should look like this:
PHP Code:
public client_spawn(id)
{
    if(
task_exists(id USERTASK))
    {
        
remove_task(id USERTASK)
    }
    
    
userreason[id] = random_num(0sizeof reasons 1)
    
    
set_task(UPDATEDELAY"client_jailinfo"id USERTASK__"b")
    

Then we put a check and format the message depending on user's team in the task itself. There are two ways to do what you want, on my mind.

1)
PHP Code:
public client_jailinfo(TASKID)
{
    static 
id
    id 
TASKID USERTASK

    set_hudmessage
(025500.80.106.012.0)

    new 
message[64]
    switch(
get_user_team(id))
    {
        case 
1formatex(messagecharsmax(message), "Day: %d | Reason: %s"roundsreasons[userreason[id]])
        case 
2formatex(messagecharsmax(message), "Day: %d"rounds)
    }
    
ShowSyncHudMsg(idhudhandlermessage)

2)
PHP Code:
public client_jailinfo(TASKID)
{
    static 
id
    id 
TASKID USERTASK

    set_hudmessage
(025500.80.106.012.0)

    new 
message[64]
    
formatex(messagecharsmax(message),"  | Reason: %s"reasons[userreason[id]])
    
ShowSyncHudMsg(idhudhandler"Day: %d%s"roundsget_user_team(id) == message "")

__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
wickedd
Veteran Member
Join Date: Nov 2009
Old 06-12-2014 , 18:23   Re: A little help.
Reply With Quote #4

@nixh
Don't delete or edit your original post once you solve your problem.
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd 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 21:10.


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