1 registered members (TipmyPip),
18,633
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
STRING* Array
#356530
02/02/11 17:14
02/02/11 17:14
|
Joined: Dec 2010
Posts: 63
Ceryni
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2010
Posts: 63
|
hi, i have aproblem i wanted to create a chat. therefor i created a STRING* chatmsgs[5]; . now i do this
function receive_chat_msg(var sender, STRING* msg)
{
STRING* save_string = "#100"; //stores the msg string, because it's only 1 frame available
str_cpy(save_string,msg);
str_cpy(chatmsgs[4],chatmsgs[3]);
str_cpy(chatmsgs[3],chatmsgs[2]);
str_cpy(chatmsgs[2],chatmsgs[1]);
str_cpy(chatmsgs[1],chatmsgs[0]);
str_cpy(chatmsgs[0],save_string);
}
whenever i write a new mesage a error occure that tehres a error in this funtion. annybody knows help?
|
|
|
Re: STRING* Array
[Re: Ceryni]
#356532
02/02/11 17:28
02/02/11 17:28
|
Joined: Jan 2011
Posts: 120 United States
Logan
Member
|
Member
Joined: Jan 2011
Posts: 120
United States
|
You have to initialize STRING*s before using str_cpy, I think... I have had the engine yell at me similarly when I fail to do so. So set them all to "" in your main function or a startup function.
int i;
for(i=0; i<5; i++)
chatmsgs[i] = "";
|
|
|
Re: STRING* Array
[Re: Ceryni]
#356540
02/02/11 17:48
02/02/11 17:48
|
Joined: Dec 2010
Posts: 63
Ceryni
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2010
Posts: 63
|
hi, i tryed this but than it shoutsdown when it should display the messages otherwise the are all (null). thats the panel
PANEL* chat_panel=
{
digits(0,0,"%s",*,1,chatmsgs[4]);
digits(0,50,"%s",*,1,chatmsgs[3]);
digits(0,100,"%s",*,1,chatmsgs[2]);
digits(0,150,"%s",*,1,chatmsgs[1]);
digits(0,200,"%s",*,1,chatmsgs[0]);
}
|
|
|
Re: STRING* Array
[Re: Ceryni]
#356547
02/02/11 18:17
02/02/11 18:17
|
Joined: Dec 2010
Posts: 63
Ceryni
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2010
Posts: 63
|
theres no error message by the engine it is the windows send or dont send error.
i use anet so when the server is started and the client connects so that the panel is displayed at the client the message apears when i comment the show flag so nothing is displayed everything else works fine
same with str_create and str_create dont become red like other functions
Last edited by Ceryni; 02/02/11 18:55.
|
|
|
Re: STRING* Array
[Re: Ceryni]
#356588
02/02/11 20:34
02/02/11 20:34
|
Joined: Dec 2010
Posts: 63
Ceryni
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2010
Posts: 63
|
str_create dont become red like all other function do i have to include another file maybe?
Last edited by Ceryni; 02/03/11 06:44.
|
|
|
Re: STRING* Array
[Re: Ceryni]
#356663
02/03/11 10:07
02/03/11 10:07
|
Joined: Dec 2010
Posts: 63
Ceryni
OP
Junior Member
|
OP
Junior Member
Joined: Dec 2010
Posts: 63
|
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|