ALERT!
Click here to register with a few steps and explore all our cool stuff we have to offer!
Home
Upgrade
Credits
Help
Search
Awards
Achievements
 1793

Help with "send message to all players" in my Script

by ELSANTO1 - 07-09-2019 - 09:48 AM
#1
Hi, I have a problem when I send a message to all players. After I wrote the message on the keyboard, it opens again as many times as there are players in the session.

I use this:

int i;
for (i = 0; i <= 18; i++)
{
int id = GET_PLAYER_PED(i);
if (id > 0 && id != PLAYER_PED_ID())
{
char *defaultText;
DISPLAY_ONSCREEN_KEYBOARD(TRUE, "FMMC_KEY_TIP8", "", defaultText, "", "", "", 40);
while (UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);
char text[40];
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());
int NetHandleBuffer = 0x10070200;
NETWORK_HANDLE_FROM_PLAYER(i, &NetHandleBuffer, 13);
NETWORK_SEND_TEXT_MESSAGE(text, &NetHandleBuffer);
print("~b~Sended Message to Lobby", 3000);
}
}


Can somebody help me?

Thanks.
Reply
#2
Code:
for (int i = 0; i < 32; i++)
{
Player p_Handle = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(i);
auto handle[26];
NETWORK::NETWORK_HANDLE_FROM_PLAYER(p_Handle, &handle[0], 13);
NETWORK::NETWORK_SEND_TEXT_MESSAGE("Your Shit", &handle[0]);
}
             Elitedox Official
                 
                          
Reply
#3
(07-09-2019 - 10:42 AM)Elitedox Wrote:
Code:
for (int i = 0; i < 32; i++)
{
Player p_Handle = PLAYER::GET_PLAYER_PED_SCRIPT_INDEX(i);
auto handle[26];
NETWORK::NETWORK_HANDLE_FROM_PLAYER(p_Handle, &handle[0], 13);
NETWORK::NETWORK_SEND_TEXT_MESSAGE("Your Shit", &handle[0]);
}

I'll prove it. Thank you very much
Reply
#4
Error solved:

CODE for ModMenu SCRIPT to send a custom message to all players...

char *defaultText; //TO OPEN KEYBOARD
DISPLAY_ONSCREEN_KEYBOARD(TRUE, "FMMC_KEY_TIP8", "", defaultText, "", "", "", 40);
while (UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);
char text[40];
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());
int i;
for (i = 0; i <= 18; i++) //TO SEND MESSAGE TO ALL PLAYERS
{
int id = GET_PLAYER_PED(i);
if (id > 0 && id != PLAYER_PED_ID())
{
int NetHandleBuffer = 0x10070200;
NETWORK_HANDLE_FROM_PLAYER(i, &NetHandleBuffer, 13);
NETWORK_SEND_TEXT_MESSAGE(text, &NetHandleBuffer);
print("~b~Sended Message to Lobby", 3000);
}
}

OR

char *defaultText; //TO OPEN KEYBOARD
DISPLAY_ONSCREEN_KEYBOARD(TRUE, "FMMC_KEY_TIP8", "", defaultText, "", "", "", 40);
while (UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);
char text[40];
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());
int i;
for (i = 0; i <= 18; i++) //TO SEND MESSAGE TO ALL PLAYERS
{
Player p_Handle = GET_PLAYER_PED_SCRIPT_INDEX(i);
if (p_Handle > 0 && p_Handle != PLAYER_PED_ID())
{
int handle[26];
NETWORK_HANDLE_FROM_PLAYER(i, &handle[0], 13);
NETWORK_SEND_TEXT_MESSAGE(text, &handle[0]);*/
print("~b~Sended Message to Lobby", 3000);
}
}

-----------------------------

To use in Modmenu SPRX, I think it's changing:
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());

for

sprintf(text, "%i", GET_ONSCREEN_KEYBOARD_RESULT());

Thx to Elitedox. ;)
Reply
#5
(07-11-2019 - 05:21 PM)ELSANTO1 Wrote: Error solved:

CODE for ModMenu SCRIPT to send a custom message to all players...

char *defaultText; //TO OPEN KEYBOARD
DISPLAY_ONSCREEN_KEYBOARD(TRUE, "FMMC_KEY_TIP8", "", defaultText, "", "", "", 40);
while (UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);
char text[40];
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());
int i;
for (i = 0; i <= 18; i++) //TO SEND MESSAGE TO ALL PLAYERS
{
int id = GET_PLAYER_PED(i);
if (id > 0 && id != PLAYER_PED_ID())
{
int NetHandleBuffer = 0x10070200;
NETWORK_HANDLE_FROM_PLAYER(i, &NetHandleBuffer, 13);
NETWORK_SEND_TEXT_MESSAGE(text, &NetHandleBuffer);
print("~b~Sended Message to Lobby", 3000);
}
}

OR

char *defaultText; //TO OPEN KEYBOARD
DISPLAY_ONSCREEN_KEYBOARD(TRUE, "FMMC_KEY_TIP8", "", defaultText, "", "", "", 40);
while (UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);
char text[40];
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());
int i;
for (i = 0; i <= 18; i++) //TO SEND MESSAGE TO ALL PLAYERS
{
Player p_Handle = GET_PLAYER_PED_SCRIPT_INDEX(i);
if (p_Handle > 0 && p_Handle != PLAYER_PED_ID())
{
int handle[26];
NETWORK_HANDLE_FROM_PLAYER(i, &handle[0], 13);
NETWORK_SEND_TEXT_MESSAGE(text, &handle[0]);*/
print("~b~Sended Message to Lobby", 3000);
}
}

-----------------------------

To use in Modmenu SPRX, I think it's changing:
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());

for

sprintf(text, "%i", GET_ONSCREEN_KEYBOARD_RESULT());

Thx to Elitedox. ;)
No:
Code:
sprintf(text, "%i", GET_ONSCREEN_KEYBOARD_RESULT());
Yes:
Code:
sprintf(text, "%s", GET_ONSCREEN_KEYBOARD_RESULT());
This account is currently banned
Ban reason: Leeching and Spamming is not allowed, please read the forum Rules upon your return.
Reply
#6
(07-09-2019 - 09:48 AM)ELSANTO1 Wrote: Hi, I have a problem when I send a message to all players. After I wrote the message on the keyboard, it opens again as many times as there are players in the session.

I use this:

int i;
for (i = 0; i <= 18; i++)
{
int id = GET_PLAYER_PED(i);
if (id > 0 && id != PLAYER_PED_ID())
{
char *defaultText;
DISPLAY_ONSCREEN_KEYBOARD(TRUE, "FMMC_KEY_TIP8", "", defaultText, "", "", "", 40);
while (UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);
char text[40];
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());
int NetHandleBuffer = 0x10070200;
NETWORK_HANDLE_FROM_PLAYER(i, &NetHandleBuffer, 13);
NETWORK_SEND_TEXT_MESSAGE(text, &NetHandleBuffer);
print("~b~Sended Message to Lobby", 3000);
}
}


Can somebody help me?

Thanks.

when people ask for help with natives

lol smh
Reply
#7
(07-11-2019 - 07:21 PM)NoNameV2345 Wrote:
(07-11-2019 - 05:21 PM)ELSANTO1 Wrote: Error solved:

CODE for ModMenu SCRIPT to send a custom message to all players...

char *defaultText; //TO OPEN KEYBOARD
DISPLAY_ONSCREEN_KEYBOARD(TRUE, "FMMC_KEY_TIP8", "", defaultText, "", "", "", 40);
while (UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);
char text[40];
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());
int i;
for (i = 0; i <= 18; i++) //TO SEND MESSAGE TO ALL PLAYERS
{
int id = GET_PLAYER_PED(i);
if (id > 0 && id != PLAYER_PED_ID())
{
int NetHandleBuffer = 0x10070200;
NETWORK_HANDLE_FROM_PLAYER(i, &NetHandleBuffer, 13);
NETWORK_SEND_TEXT_MESSAGE(text, &NetHandleBuffer);
print("~b~Sended Message to Lobby", 3000);
}
}

OR

char *defaultText; //TO OPEN KEYBOARD
DISPLAY_ONSCREEN_KEYBOARD(TRUE, "FMMC_KEY_TIP8", "", defaultText, "", "", "", 40);
while (UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);
char text[40];
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());
int i;
for (i = 0; i <= 18; i++) //TO SEND MESSAGE TO ALL PLAYERS
{
Player p_Handle = GET_PLAYER_PED_SCRIPT_INDEX(i);
if (p_Handle > 0 && p_Handle != PLAYER_PED_ID())
{
int handle[26];
NETWORK_HANDLE_FROM_PLAYER(i, &handle[0], 13);
NETWORK_SEND_TEXT_MESSAGE(text, &handle[0]);*/
print("~b~Sended Message to Lobby", 3000);
}
}

-----------------------------

To use in Modmenu SPRX, I think it's changing:
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());

for

sprintf(text, "%i", GET_ONSCREEN_KEYBOARD_RESULT());

Thx to Elitedox. ;)
No:
Code:
sprintf(text, "%i", GET_ONSCREEN_KEYBOARD_RESULT());
Yes:
Code:
sprintf(text, "%s", GET_ONSCREEN_KEYBOARD_RESULT());

Ok. I make script and it doesn't use sprintf. Thanks.
Reply
#8
(07-11-2019 - 08:52 PM)magiccarpet Wrote:
(07-09-2019 - 09:48 AM)ELSANTO1 Wrote: Hi, I have a problem when I send a message to all players. After I wrote the message on the keyboard, it opens again as many times as there are players in the session.

I use this:

int i;
for (i = 0; i <= 18; i++)
{
int id = GET_PLAYER_PED(i);
if (id > 0 && id != PLAYER_PED_ID())
{
char *defaultText;
DISPLAY_ONSCREEN_KEYBOARD(TRUE, "FMMC_KEY_TIP8", "", defaultText, "", "", "", 40);
while (UPDATE_ONSCREEN_KEYBOARD() == 0) WAIT(0);
char text[40];
strcpy_s(text, GET_ONSCREEN_KEYBOARD_RESULT());
int NetHandleBuffer = 0x10070200;
NETWORK_HANDLE_FROM_PLAYER(i, &NetHandleBuffer, 13);
NETWORK_SEND_TEXT_MESSAGE(text, &NetHandleBuffer);
print("~b~Sended Message to Lobby", 3000);
}
}


Can somebody help me?

Thanks.

when people ask for help with natives

lol smh
lol smh
2021 Best Be Better Then 2020
Reply

Users browsing: 1 Guest(s)