Raised This Month: $ Target: $400
 0% 

[SOLVED] Colorprint stock gives some weird results in certain cases


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jon
Veteran Member
Join Date: Dec 2007
Old 06-20-2008 , 14:45   [SOLVED] Colorprint stock gives some weird results in certain cases
Reply With Quote #1

I've looked into teame06's ColorChat snippet and tried to modify it so the color is cvar controlled, not by case:

Code:
#include <amxmodx> enum Color {     YELLOW = 1, // Yellow     GREEN, // Green Color     TEAM_COLOR, // Red, grey, blue     GREY, // grey     RED, // Red     BLUE, // Blue } new TeamInfo; new SayText; new MaxSlots; new cvar_num; new cvar_string; new cvar_test; new TeamName[][] = {     "",     "TERRORIST",     "CT",     "SPECTATOR" } new bool:IsConnected[33]; public plugin_init() {     register_plugin("Cs Color Chat Function Test", "1.2", "teame06");     register_clcmd("say /test", "cmd_test")     cvar_test    = register_cvar("test_color", "red")     cvar_num    = register_cvar("test_num", "3")     cvar_string    = register_cvar("test_string", "hello")         TeamInfo = get_user_msgid("TeamInfo");     SayText = get_user_msgid("SayText");     MaxSlots = get_maxplayers(); } public cmd_test(id) {     print_color(id, "DEBUG")         new string[32];     get_pcvar_string(cvar_string, string, 31)         print_color(id, "%s %d", string, get_pcvar_num(cvar_num)) } public client_putinserver(id)     IsConnected[id] = true; public client_disconnect(id)     IsConnected[id] = false; public print_color(id, const msg[], any:...) {     static message[256];     new colortype[32];     get_pcvar_string(cvar_test, colortype, 31)         if(equal(colortype, "yellow"))         message[0] = 0x01;             else if(equal(colortype, "green"))         message[0] = 0x04;             else         message[0] = 0x03;     vformat(message[1], 251, msg, 2);         // Make sure message is not longer than 192 character. Will crash the server.     message[192] = '^0';     new team, ColorChange, index, MSG_Type;         if(!id)     {         index = FindPlayer();         MSG_Type = MSG_ALL;         }         else     {         MSG_Type = MSG_ONE;         index = id;     }         team = get_user_team(index);        ColorChange = ColorSelection(index, MSG_Type, colortype);     ShowColorMessage(index, MSG_Type, message);             if(ColorChange)         Team_Info(index, MSG_Type, TeamName[team]);     } ShowColorMessage(id, type, message[]) {     message_begin(type, SayText, _, id);     write_byte(id)            write_string(message);     message_end();    } Team_Info(id, type, team[]) {     message_begin(type, TeamInfo, _, id);     write_byte(id);     write_string(team);     message_end();     return 1; } ColorSelection(index, type, const colortype[]) {     if(equal(colortype, "red"))         return Team_Info(index, type, TeamName[1]);             if(equal(colortype, "blue"))         return Team_Info(index, type, TeamName[2]);             if(equal(colortype, "grey"))         return Team_Info(index, type, TeamName[0]);         return 0; } FindPlayer() {     new i = -1;     while(i <= MaxSlots)     {         if(IsConnected[++i])         {             return i;         }     }     return -1; }

print_color(id, "Hello") is working fine.

But print_color(id, "Hello %d", get_pcvar_num(number)) gives me "Hello 'the number as it should be only - 1'"

And print_color(id, "%s Hello %d", string, get_pcvar_num(number)) gives me wrong number, no string and is all bizarre

What have I done wrong?

and btw, how to enable scrolling in the pawn tags?

Last edited by Jon; 06-23-2008 at 10:59.
Jon is offline
Old 06-23-2008, 10:58
Jon
This message has been deleted by Exolent[jNr]. Reason: Create your own topic.
TheTimo007
Member
Join Date: Oct 2010
Location: Estonia
Old 10-10-2010 , 06:21   Re: [SOLVED] Colorprint stock gives some weird results in certain cases
Reply With Quote #2

Jon can u make a plugin, that admins have green name and blue text. And swear filter works too with this admin colors? plz
TheTimo007 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 14:53.


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