TimedMsg - Nothing happens
#1

I added the following code by myself to be able to write timed messages without needing many public timers....

Its coded this way (TimerMsg gets called first):
Код:
public TimerMsg(playerid,string[],color,time,param)
{
	SetTimerEx("TimedMessage",time,0,"isii",playerid,string,color,param);
	return 1;
}

public TimedMessage(playerid,string[],color,param) //einfacher als diese dummen Timer, die sich ggseitig aufrufen...
{
	SendClientMessage(playerid,color,string);
	switch(param) //um auch custom aktionen auszufьhren
	{
//   case 0: if param isnt needed
	  case 1: //action
	  case 2: //action
		case 3: //action
		case 4: //action
	}
	return 1;
}
Now the messages doesnt gets shown, either the actions are done....

Can you pls tell me the wrong part of the script ?

Cheers,
Trooper
Reply
#2

Nothing is wrong here. Strings just don't work in timers...
Reply
#3

Any other method ?
Reply
#4

Quote:
Originally Posted by ZeeX
Nothing is wrong here. Strings just don't work in timers...
They do work but are bugged, but as said in one recent post of me, you fix it but using format().
pawn Код:
public TimedMessage(playerid,string[],color,param) //einfacher als diese dummen Timer, die sich ggseitig aufrufen...
{
  new repaired_string[128];
  format(repaired_string, sizeof repaired_string, string);
  SendClientMessage(playerid,color,repaired_string);
Reply
#5

Thanks.
But there are several issues with this function.

To not have to export a string, i worked on it.

Now i call the functions like this:
Код:
    		SetTimerEx("TimedMsg",1500,0,"iii",playerid,1,1); //first = action, 2nd = message
		  SetTimerEx("TimedMsg",3000,0,"iii",playerid,0,2);
		  SetTimerEx("TimedMsg",4500,0,"iii",playerid,0,3);
		  SetTimerEx("TimedMsg",6000,0,"iii",playerid,2,4);
		  SetTimerEx("TimedMsg",7500,0,"iii",playerid,0,5);
		  SetTimerEx("TimedMsg",9000,0,"iii",playerid,0,6);
		  SetTimerEx("TimedMsg",10500,0,"iii",playerid,3,7);
      SetTimerEx("TimedMsg",12000,0,"iii",playerid,2,8);
		  SetTimerEx("TimedMsg",13500,0,"iii",playerid,0,9);
		  SetTimerEx("TimedMsg",15000,0,"iii",playerid,2,10);
		  SetTimerEx("TimedMsg",17000,0,"iii",playerid,0,11);
		  SetTimerEx("TimedMsg",17000,0,"iii",playerid,4,12);
with

Код:
public TimedMessage(playerid,param1,param2) 
{
	printf("TimedMessage:%d,%d,%d",playerid,param1,param2);
  new formatmsg[128];
	switch(param2)
	{
	  case 1:format(formatmsg,128,//msg
	  case 2:format(formatmsg,128,//msg
		case 3:format(formatmsg,128,//msg
		case 4:format(formatmsg,128,//msg
		case 5:format(formatmsg,128,//msg
		case 6:format(formatmsg,128,//msg
		case 7:format(formatmsg,128,//msg
		case 8:format(formatmsg,128,//msg
		case 9:format(formatmsg,128,//msg
		case 10:format(formatmsg,128,//msg
		case 11:format(formatmsg,128,//msg
		case 12:format(formatmsg,128,//msg
	}
	SendClientMessage(playerid,COLOR_ORANGE,formatmsg);
	switch(param1) 
	{
	  case 1: ApplyAnimation(playerid,"ped","phone_in",4,0,0,0,1,0);
	  case 2: ApplyAnimation(playerid,"ped","phone_talk",4,0,0,0,1,0);
		case 3: ConnectNPC("miss1_agent","miss1_agent");
		case 4:
		{
		  //some actions
		}
	}
	return 1;
}
The Problem is:
The "printf" at the beginning gets called NEVER !
Even i wait for 2 minutes, nothing appears....
ANy suggestions, ideas ?
Reply
#6

You don't call the right function.

Also i've just realized that SetTimerEx is bugged with strings if there is already another SetTimerEx running, they become confused...Anyway, i suggest you use the good old SetTimer, what you did here with all those timers is really ugly. There are probably betters ways of doing what you want.
Reply
#7

I moreless think you haven`t looked the code :P
I use no strings....

And i use the good oldd SetTimer
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)