Loop problem: sending message
#1

Hello guys, I have a war system on my server, and sometimes in my global timer (1sec) SendClientMessage is sending twice in a loop.

Here you have a screnshot: https://i.imgur.com/sEMrdvT.png

All code: https://pastebin.com/7Ai4zQMQ

If someone can help me, please!
Reply
#2

The message/s should be outside loop.
Reply
#3

Quote:
Originally Posted by Bolex_
Посмотреть сообщение
The message/s should be outside loop.
There are a loot of messages, how should I do that?
Reply
#4

Quote:
Originally Posted by None1337
Посмотреть сообщение
There are a loot of messages, how should I do that?
Drag them outside the loop and use SendClientMessageForAll if you're sending it to all players?
say for an ex if it was like
PHP код:
for( new...) 
{
    
//code
    
SendClientMessage(...
    }
//drag that send client message outside so it'd be
for(new..
{
    
//code
    
}
SendClientMessage(.. 
Reply
#5

Quote:
Originally Posted by RogueDrifter
Посмотреть сообщение
Drag them outside the loop and use SendClientMessageForAll if you're sending it to all players?
say for an ex if it was like
PHP код:
for( new...) 
{
    
//code
    
SendClientMessage(...
    }
//drag that send client message outside so it'd be
for(new..
{
    
//code
    
}
SendClientMessage(.. 
I only send the message to the two mafia groups.
In this way, I should define, aprox. I think 5-6 new strings.
Is not there another way?
Reply
#6

Quote:
Originally Posted by None1337
Посмотреть сообщение
I only send the message to the two mafia groups.
In this way, I should define, aprox. I think 5-6 new strings.
Is not there another way?
Then make the loop check for those mafias like if(PlayerInfo[playerid][pMafia]) SendClientMessage(playerid,-1,string); and i have no idea what you mean by define approx 5-6 new strings?
Reply
#7

I have already my function SendFamilyMessage(groupid, color, string[]);
Reply
#8

Copy paste will only get you so far, and you should not need to create 5-6 strings for something such as this.


If this is a timer, this is seriously overloaded. You don't need strings to be 256 chars long. You also don't need to have as many strings, as long a string, or as many variables through all of that.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)