SA-MP Forums Archive
[HELP]save hex code to file? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]save hex code to file? (/showthread.php?tid=615708)



[HELP]save hex code to file? - gouster3 - 26.08.2016

Hi. I want to ask, if is possible to export this hexcode:
Quote:

C2000000E0F108080400080094000000E40000001401000014 410000FFFFFFFF380000004000000048000000580000005800 00006000000008000000620000000000000070000000000000 00830000000000000088000000040000408E0000001F004F6E 52636F6E436F6D6D616E640043616C6C52656D6F746546756E 6374696F6E0073616D7000466C6F617400466C6F6174008078 002E8109290C27282700270C807B002C1081090B0130804F80 6E80528063806F806E8043806D806400807300

to file.
like using hexedit, but in samp (ongamemodeinit).


Re: [HELP]save hex code to file? - SickAttack - 26.08.2016

What is it for?


Re: [HELP]save hex code to file? - AbyssMorgan - 26.08.2016

PHP код:
new len,
    
input[256 2],
    
output[256];
    
input "C2000000E0F108080400080094000000E40000001401000014";
len strlen(input) / 2;
HexStringToString(input,output,sizeof(output)); //Return binary data: "В...ŕń......”...д........"
new File:outf fopen("test.bin",io_write);
for(new 
0leni++){
    
fputchar(outf,output[i],false);
}
fclose(outf); 
ADM:
https://sampforum.blast.hk/showthread.php?tid=595203


Re: [HELP]save hex code to file? - gouster3 - 26.08.2016

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
new len,
    
input[256 2],
    
output[256];
    
input "C2000000E0F108080400080094000000E40000001401000014";
len strlen(input) / 2;
HexStringToString(input,output,sizeof(output)); //Return binary data: "В...ŕń......”...д........"
new File:outf fopen("test.bin",io_write);
for(new 
0leni++){
    
fputchar(outf,output[i],false);
}
fclose(outf); 
ADM:
https://sampforum.blast.hk/showthread.php?tid=595203
Thanx.

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
What is it for?
I have OnRconCommand in my gamemode. but in samp there is some bug, and it is working only in fs.
so i want to create .amx file (filterscript) that will comunicate with my gm and make OnRconCommand working.
then i will just load this fs by using command in my gm.

file i want create:
Код:
#include <a_samp>
public OnRconCommand(cmd[])
{
CallRemoteFunction("OnRconCmd","s",cmd);
return 1;
}
hex value u can see in this thread is from compiled .amx.

then i can just use this in my gm:
Код:
//to ongamemodeinit:
SendRconCommand(loadfs ../scriptfiles/fix);  //fix will be name of created file


public OnRconCmd(cmd[])
{
    return 1;
}
forward OnRconCmd(cmd[]);
+ create file.


Re: [HELP]save hex code to file? - Konstantinos - 26.08.2016

Quote:
Originally Posted by gouster3
Посмотреть сообщение
I have OnRconCommand in my gamemode. but in samp there is some bug, and it is working only in fs.
so i want to create .amx file (filterscript) that will comunicate with my gm and make OnRconCommand working.
then i will just load this fs by using command in my gm.

file i want create:
Код:
#include <a_samp>
public OnRconCommand(cmd[])
{
CallRemoteFunction("OnRconCmd","s",cmd);
return 1;
}
hex value u can see in this thread is from compiled .amx.

then i can just use this in my gm:
Код:
//to ongamemodeinit:
SendRconCommand(loadfs ../scriptfiles/fix);  //fix will be name of created file


public OnRconCmd(cmd[])
{
    return 1;
}
forward OnRconCmd(cmd[]);
+ create file.
Why don't you simply load a filterscript with code:
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

public OnRconCommand(cmd[])
{
    return 0;
}
and then use OnRconCommand callback normally to your gamemode?


Re: [HELP]save hex code to file? - gouster3 - 26.08.2016

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Why don't you simply load a filterscript with code:
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

public OnRconCommand(cmd[])
{
    return 0;
}
and then use OnRconCommand callback normally to your gamemode?
Yes, it is simple, but i want to have all my gamemode in one file (gm.amx) in gamemodes folder. all other required files will be created from gamemode code automatic.