SA-MP Forums

Go Back   SA-MP Forums > SA-MP > Bug Reports

Reply
 
Thread Tools Display Modes
Old 18/06/2018, 01:33 PM   #11
Ultraz
Huge Clucker
 
Ultraz's Avatar
 
Join Date: Aug 2016
Location: Egypt
Posts: 259
Reputation: 22
Default Re: PSA: OnFilterScript* Events Not Thread Safe

Quote:
Originally Posted by [HLF]Southclaw View Post
  • IRC - Use Incognito's IRC plugin and create loadfs/unloadfs commands
  • Discord - Use maddinat0r's Discord plugin and create loadfs/unloadfs commands
  • WebSockets - Use my Requests plugin and connect with a webapp or mobile app
You said that using RCON console ingame have a bad effect then saying using IRC and making !loadfs/unloadfs would be better, Ultraz IRC System where i used to create !rcon command so what differs IRC from Ingame console? both of them have the same callbacks in which they're using SendRconCommand
Code:
IRCCMD:rcon(botid, channel[], user[], host[], params[])
{
    // Check if the user is at least an op in the channel
    if (IRC_IsOwner(botid, channel, user))
    {
        // Check if the user entered any text
        if (!isnull(params))
        {
            // Check if the user did not enter any invalid commands
            if (strcmp(params, "exit", true) != 0 && strfind(params, "loadfs irc", true) == -1)
            {
                new msg[128];
                format(msg, sizeof(msg), "RCON command %s has been executed.", params);
                IRC_GroupSay(groupID, channel, msg);
                SendRconCommand(params); // same as Ingame console
            }
        }
    }
    return 1;
}
I just want to understand the difference between them.
Ultraz is offline   Reply With Quote
Old 18/06/2018, 02:02 PM   #12
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,672
Reputation: 3220
Default Re: PSA: OnFilterScript* Events Not Thread Safe

The SA:MP console doesn't use "SendRconCommand", it has a separate thread listening for user input (typed directly in to the console window). The main difference is that plugins go through pawn, and thus operate in pawn's thread - which is safe. The console has its own thread and thus operate elsewhere - which is bad.
Y_Less is offline   Reply With Quote
Old 18/06/2018, 02:29 PM   #13
[HLF]Southclaw
Godfather
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 5,014
Reputation: 1581
Default Re: PSA: OnFilterScript* Events Not Thread Safe

This also means OnRconCommand is probably executed from the console thread too.
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is online now   Reply With Quote
Old 18/06/2018, 03:02 PM   #14
Sew_Sumi
Banned
 
Join Date: Jun 2008
Location: Azerbaijan
Posts: 6,435
Reputation: 525
Default Re: PSA: OnFilterScript* Events Not Thread Safe

Quote:
Originally Posted by Spmn View Post
... Which is still safe.
Which is why it's just odd that this comes up. This was only in the past few weeks, and I even think it was because there was a question about filterscripts, or something related to the launching of them.
Sew_Sumi is offline   Reply With Quote
Old 18/06/2018, 04:28 PM   #15
Ultraz
Huge Clucker
 
Ultraz's Avatar
 
Join Date: Aug 2016
Location: Egypt
Posts: 259
Reputation: 22
Default Re: PSA: OnFilterScript* Events Not Thread Safe

Quote:
Originally Posted by [HLF]Southclaw View Post
This also means OnRconCommand is probably executed from the console thread too.
Y_Less said that Ingame console have it's own thread so where we can find it? i looked in all includes which is given by the SA-MP server package and didn't find the /rcon command.
Ultraz is offline   Reply With Quote
Old 18/06/2018, 04:41 PM   #16
jlalt
Banned
 
Join Date: Oct 2014
Location: Iran
Posts: 1,286
Reputation: 366
Default Re: PSA: OnFilterScript* Events Not Thread Safe

Quote:
Originally Posted by Ultraz View Post
Y_Less said that Ingame console have it's own thread so where we can find it? i looked in all includes which is given by the SA-MP server package and didn't find the /rcon command.
/rcon is client sided.
jlalt is offline   Reply With Quote
Old 18/06/2018, 05:10 PM   #17
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Posts: 1,652
Reputation: 513
Default Re: PSA: OnFilterScript* Events Not Thread Safe

Just discovered?

This was known to many people since years. It even was reported 3 years ago but noone cared.
NaS is offline   Reply With Quote
Old 18/06/2018, 10:57 PM   #18
[HLF]Southclaw
Godfather
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 5,014
Reputation: 1581
Default Re: PSA: OnFilterScript* Events Not Thread Safe

Quote:
Originally Posted by Ultraz View Post
Y_Less said that Ingame console have it's own thread so where we can find it? i looked in all includes which is given by the SA-MP server package and didn't find the /rcon command.
No it doesn't have its own thread, /rcon commands are registered and executed within the same thread as as the AMX instance (gamemode) so they are safe to use.

What you're probably looking for is SendRconCommand.
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is online now   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Events! AyanAliKhan Server Support 1 15/11/2016 01:02 PM
events StR_MaRy Scripting Help 3 16/04/2016 09:19 AM
Halloween events Eagle1928 Everything and Nothing 1 25/10/2014 06:04 PM
[Map] MY FIRST MAP FOR EVENTS by Georgia tujituji1 Maps 14 16/01/2011 11:53 AM
[HELP] Events andershh Help Archive 4 17/07/2010 03:28 AM


All times are GMT. The time now is 01:50 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.