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

[SOLVED]Get player color? Red -1 | Green 822083583 | Blue 1546715135 | Alpha -2


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
klausenbusk
AlliedModders Donor
Join Date: Jan 2011
Old 04-17-2011 , 12:19   [SOLVED]Get player color? Red -1 | Green 822083583 | Blue 1546715135 | Alpha -2
Reply With Quote #1

Hello

I try to get a players color, but I just get some strange numbers
I use:
Code:
new offset = GetEntSendPropOffs(client, "m_clrRender", true);
and then:
Code:
GetEntData(client, offset) Red
GetEntData(client, offset +1) // Green
GetEntData(client, offset +2) // Blue
GetEntData(client, offset +3) // Alpha
And here are what i get:
Code:
Red -1 | Green 822083583 | Blue 1546715135 | Alpha -2
Here are the full code:
Code:
#include <sourcemod>
#pragma semicolon 1

public Plugin:myinfo =
{
    name = "Test script",
    author = "KK",
    description = "Test script",
    version = "0.1",
    url = "http://www.attack2.co.cc/"
};

public OnPluginStart()
{
    RegConsoleCmd("sm_mycolor", Command_MyColor);
}
 
public Action:Command_MyColor(client, args)
{
    new offset = GetEntSendPropOffs(client, "m_clrRender", true);
    PrintToChat(client, "You color are Red %i | Green %i | Blue %i | Alpha %i ", GetEntData(client, offset), GetEntData(client, offset + 1), GetEntData(client, offset + 2), GetEntData(client, offset + 3));
}
Edit: Solution here

Last edited by klausenbusk; 04-17-2011 at 13:08. Reason: Solved Thank Silvers
klausenbusk is offline
FoxMulder
Senior Member
Join Date: Jan 2009
Location: Orlando, FL
Old 04-17-2011 , 12:31   Re: Get player color? Red -1 | Green 822083583 | Blue 1546715135 | Alpha -2
Reply With Quote #2

Try this

PHP Code:
#include <sourcemod>
#pragma semicolon 1

new m_clrRender;

public 
Plugin:myinfo =
{
    
name "Test script",
    
author "KK",
    
description "Test script",
    
version "0.1",
    
url "http://www.attack2.co.cc/"
};

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_mycolor"Command_MyColor);
    
m_clrRender FindSendPropOffs("CTFPlayer""m_clrRender");
}
 
public 
Action:Command_MyColor(clientargs)
{
    
PrintToChat(client"You color are Red %i | Green %i | Blue %i | Alpha %i "GetEntData(clientm_clrRender1), GetEntData(clientm_clrRender 11)), GetEntData(clientm_clrRender 21), GetEntData(clientm_clrRender 31));

__________________

Last edited by FoxMulder; 04-17-2011 at 12:35.
FoxMulder is offline
klausenbusk
AlliedModders Donor
Join Date: Jan 2011
Old 04-17-2011 , 13:01   Re: Get player color? Red -1 | Green 822083583 | Blue 1546715135 | Alpha -2
Reply With Quote #3

Doesn't work, i get:
Code:
L 04/17/2011 - 19:01:41: [SM] Native "GetEntData" reported: Offset 0 is invalid
L 04/17/2011 - 19:01:41: [SM] Displaying call stack trace for plugin "test.smx":
L 04/17/2011 - 19:01:41: [SM]   [0]  Line 23, prop-beta/test.sp::Command_MyColor()
klausenbusk is offline
klausenbusk
AlliedModders Donor
Join Date: Jan 2011
Old 04-17-2011 , 13:07   Re: Get player color? Red -1 | Green 822083583 | Blue 1546715135 | Alpha -2
Reply With Quote #4

Specifying a size of GetEntDate have solved the problem Thank Silvers
PHP Code:
GetEntData(clientoffset1)
GetEntData(clientoffset 11)
GetEntData(clientoffset 21)
GetEntData(clientoffset 31
klausenbusk 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 20:33.


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