Raised This Month: $ Target: $400
 0% 

Need help with some plugin code.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chronic1
SourceMod Donor
Join Date: Jun 2011
Old 08-01-2011 , 12:21   Need help with some plugin code.
Reply With Quote #1

Code:
#define NUM_COLORS    7

new iColors[NUM_COLORS][3];

public OnPluginStart()
{
    HookEvent("tank_spawn", tank_spawn);

    iColors[0] = { 255, 0, 0 }; // Red
    iColors[1] = { 0, 255, 0 }; // Green
    iColors[2] = { 0, 0, 255 }; // Blue
    iColors[3] = { 255, 0, 255 }; // Pink
    iColors[4] = { 255, 155, 0 }; // Orange
    iColors[5] = { 255, 255, 0 }; // Yellow
    iColors[6] = { 0, 0, 0 }; // Black
}

public Action:tank_spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));

    new r, g, b, random = GetRandomInt(0, NUM_COLORS-1);
    r = iColors[random][0];
    g = iColors[random][1];
    b = iColors[random][2];

    SetEntityRenderMode(client, RENDER_TRANSCOLOR)
    SetEntityRenderColor(client, r, g, b, 255);
} 


Can someone edit this code so the tanks always spawn red? I changed all the colors to read { 255, 0, 0 } but it doesnt work 100%. I still get some normal colored tanks. I have 8vs8 TAAANNNK server and would like to make the tanks red all the time.

Last edited by Chronic1; 08-01-2011 at 12:25.
Chronic1 is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 08-01-2011 , 13:47   Re: Need help with some plugin code.
Reply With Quote #2

Code:
public OnPluginStart()
{
    HookEvent("tank_spawn", tank_spawn);
}

public Action:tank_spawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    new client = GetClientOfUserId(GetEventInt(event, "userid"));

    SetEntityRenderMode(client, RENDER_TRANSCOLOR)
    SetEntityRenderColor(client, 255, 0, 0, 255);
}
Note: I am NOT a coder, this is PROBABLY about 99% sure wrong. I'm just taking a shot in the dark to help.
Drixevel is offline
Chronic1
SourceMod Donor
Join Date: Jun 2011
Old 08-01-2011 , 17:47   Re: Need help with some plugin code.
Reply With Quote #3

Thanks. Its better than what i did when i changed all 7 colors to red. But some of the tanks still spawn normal colors or slightly red instead of deep blood red like they are supposed to be.
Chronic1 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 12:27.


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