[Plugin] [REL] Execute
#41

Quote:
Originally Posted by [MrS]Lake
Посмотреть сообщение
Does someone know how to open and close a file using linux cmds?

Like windows cmds, for example:

open
pawn Код:
exec("START samp-server.exe");
close
pawn Код:
exec("TASKKILL /F /IM \"samp-server.exe\"");
But i want for linux
Start: shell_exec("cd /path/to/server; nohup ./samp03svr &");
Stop: shell_exec("pkill -9 samp03svr");

I suggest you use ssh2 module, it will work much better.
Reply
#42

Works greakt - have anyone usefull Functions like:
Quote:

exec("COLOR 1F");

or:
Quote:

exec("TASKKILL /F /IM \"RocketDock.exe\"");

?
Reply
#43

This plugin seems to crash my friend's PC. Is it compatible with Windows 7
Reply
#44

Quote:
Originally Posted by YJIET
Посмотреть сообщение
This plugin seems to crash my friend's PC. Is it compatible with Windows 7
Should be compatible with all versions of Windows that can run the C++ libraries really.

Although I cannot see at all how this plugin could make an entire Operating System "crash"
Reply
#45

Well I'm not sure what exactly caused his OS to freeze, but it has something to do with this code:
pawn Код:
exec("cd npcmodes & if not exist dir_npc md dir_npc & cd recordings & if not exist dir_rec md dir_rec");
Once that code was removed, the crash disappeared.
Reply
#46

Quote:
Originally Posted by YJIET
Посмотреть сообщение
Well I'm not sure what exactly caused his OS to freeze, but it has something to do with this code:
pawn Код:
exec("cd npcmodes & if not exist dir_npc md dir_npc & cd recordings & if not exist dir_rec md dir_rec");
Once that code was removed, the crash disappeared.
I just tested that on Windows 7 Professional x64 and it worked fine, so I don't know what could be causing that, has he tried running the samp-server.exe as an Administrator (Right-click and run as administrator)? You could also try disabling UAC. Either way both of those options may help, the executable might not have access to write directories. I just know it worked fine for me and I have UAC disabled.
Reply
#47

The directories were actually created normally. Everything froze a few seconds after command execution (tested 2 times) and then he had to shut down his PC manually... but oh well, the main thing that the crash is gone now.
Reply
#48

Thank you so much for this. I've been rattling my brain over how to automatically chmod something my script creates and this just solved my problem. Without this I don't know what I would have done.
Reply
#49

Please implement a native to check if the target is a Windows or a Linux host:
Код:
#ifdef _WIN32
    int OS = 0;
#else
    int OS = 1;
#endif
...
AMX_NATIVE_CALL GetOS(AMX *amx, cell *params)
{
    return OS;
}
Thanks in advance.
Reply
#50

OMG, nvm i wronged
Reply
#51

Is it possible to make a "dummy" windows plugin for this? Just so we won't get any errors while trying to run it on our PC, and not having to go back to your script and comment #include <exec> and the function.
Reply
#52

Quote:
Originally Posted by DeathTone
Посмотреть сообщение
Is it possible to make a "dummy" windows plugin for this? Just so we won't get any errors while trying to run it on our PC, and not having to go back to your script and comment #include <exec> and the function.
I don't really know what you're asking, or what you are talking about.
Reply
#53

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
I don't really know what you're asking, or what you are talking about.
When trying to run the server on windows, and we have #include <exec>

It will give us a runtime error, so is there any way to make it easier so we don't have to comment "#include <exec>" every time we are going to test the server on our windows PC?
Reply
#54

Is there any way to thread this plugin?
I'm trying to do a big operation with exec and the whole server is frozen until it finishes...

Thanks!
Reply
#55

This is like a command processor or what?
Reply
#56

Works like a charm with Python scripts
Reply
#57

How to do this on linux?
pawn Код:
new file2[256];
format(file2, 256, "pawno/pawncc.exe scriptfiles/%s.pwn",rec_name[p_rec_id[playerid]]), exec(file2);
Reply
#58

Quote:
Originally Posted by Suxi
Посмотреть сообщение
How to do this on linux?
pawn Код:
new file2[256];
format(file2, 256, "pawno/pawncc.exe scriptfiles/%s.pwn",rec_name[p_rec_id[playerid]]), exec(file2);
You have to use WINE.
http://dracoblue.net/dev/compile-sam...-exe-on-linux/
Reply
#59

and is there another way? D=
Reply
#60

Why don't you just use edited pawn compiler by Zeex/xeeZ? He fixed several issues related to compiler bugs plus there's a Linux version aswell https://github.com/Zeex/pawn/releases
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)