Raised This Month: $ Target: $400
 0% 

Format Function Assigns To Every Key


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Minimum
Senior Member
Join Date: Jun 2006
Old 10-04-2006 , 17:20   Format Function Assigns To Every Key
Reply With Quote #1

Heres the problem. When I execute the format functions they format every key of the array. Which makes everyone see the text. And when I make it equal it just shows a random letter because it thinks its an integer. Any suggestions?

Code:
public hud_print(id,message[]) {     if(id == 0) {         new x, players[32]         get_players(players,x,"ac")         for( new i = 0;  i < x; i++ ) {             new playerindex = players[i]             format(hudmsg4[playerindex],127,"%s",hudmsg3[playerindex])             format(hudmsg3[playerindex],127,"%s",hudmsg2[playerindex])             format(hudmsg2[playerindex],127,"%s",hudmsg1[playerindex])             format(hudmsg1[playerindex],127,"%s",message)         }         return PLUGIN_HANDLED     } // Integer Stuff Pt. 1     new message2[128]     format(message2[id],127,"%s",message) // Formatting stuff     //format(hudmsg4[id],127,"%s",hudmsg3[id])     //format(hudmsg3[id],127,"%s",hudmsg2[id])     //format(hudmsg2[id],127,"%s",hudmsg1[id])     //format(hudmsg1[id],127,"%s",message) // Integer Stuff Pt. 2     hudmsg4[id] = hudmsg3[id]     hudmsg3[id] = hudmsg2[id]     hudmsg2[id] = hudmsg1[id]     hudmsg1[id] = message2[id]     return PLUGIN_HANDLED }
Minimum is offline
Send a message via AIM to Minimum Send a message via MSN to Minimum
stupok
Veteran Member
Join Date: Feb 2006
Old 10-04-2006 , 18:23   Re: Format Function Assigns To Every Key
Reply With Quote #2

I am not certain, but I think 0 is a valid number for id, but I don't know why you would do: if(id == 0)...

From the look of it, all players should receive the message since 0 is a vaild number for id, so the lines in the 'if' statement will always be executed.

I don't understand the point of have 4 different "hudmsg" when you do
Code:
hudmsg4[id] = hudmsg3[id]     hudmsg3[id] = hudmsg2[id]     hudmsg2[id] = hudmsg1[id]     hudmsg1[id] = message2[id]

What is this code supposed to do?
stupok is offline
TheNewt
Donor
Join Date: Jun 2006
Location: Where I live.
Old 10-04-2006 , 18:24   Re: Format Function Assigns To Every Key
Reply With Quote #3

0 is valid, its server if I'm not mistaken.
__________________
Quote:
toe3_ left the chat room. (G-lined (AUTO Excessive connections from a single host.))
TheNewt is offline
Minimum
Senior Member
Join Date: Jun 2006
Old 10-04-2006 , 19:12   Re: Format Function Assigns To Every Key
Reply With Quote #4

Its the text console on the bottom left.

http://minimum.gabionstudios.com/images/ts-25.jpg

When I send 0 to the function's id I make it execute the code in the if(id == 0).

Last edited by Minimum; 10-04-2006 at 19:20.
Minimum is offline
Send a message via AIM to Minimum Send a message via MSN to Minimum
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 10-04-2006 , 21:31   Re: Format Function Assigns To Every Key
Reply With Quote #5

I notice that:
Code:
new message2[128] format(message2[id],127,"%s",message)
should most likely be:
Code:
new message2[128] format(message2,127,"%s",message)

Also, how are you declaring your hudmessage1...4 variables? Based on how it seems you want to make your code act, make sure they are two-dimensional: hudmessage1[33][128] for example, otherwise you would run into the same thing as above.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 04:56.


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