Re: Little coding questions - For general minor queries 5 -
SickAttack - 18.12.2016
Quote:
Originally Posted by ISmokezU
Is it possible to check for a function? for example hooking SetPlayerHealth to SetPlayerHealthEx,and check whether "SetPlayerHealth" gets call then ban the individual,is that possible?
|
SetPlayerHealth isn't called by cheats if you were wondering btw.
Re: Little coding questions - For general minor queries 5 -
ISmokezU - 18.12.2016
Quote:
Originally Posted by SickAttack
SetPlayerHealth isn't called by cheats if you were wondering btw.
|
Oh no it was an example,but is it possible? what i was asking. ^^
Re: Little coding questions - For general minor queries 5 -
SickAttack - 18.12.2016
Quote:
Originally Posted by ISmokezU
Oh no it was an example,but is it possible? what i was asking. ^^
|
Please elaborate more on what you want to do. It's obviously possible by hooking SetPlayerHealth and with a variable.
Re: Little coding questions - For general minor queries 5 -
ISmokezU - 18.12.2016
Код:
#if defined _ALS_GivePlayerWeapon
#undef GivePlayerWeapon
#else
#define _ALS_GivePlayerWeapon
#endif
#define GivePlayerWeapon GivePlayerWeaponEx
So now could i check for GivePlayerWeapon(...) then do w/e?
Re: Little coding questions - For general minor queries 5 -
SickAttack - 18.12.2016
Tell me what you want to do first.
Re: Little coding questions - For general minor queries 5 -
PrO.GameR - 18.12.2016
Functions don't get called by players/clients, thats what callbacks are for, functions are as the name stands, functions for the coder to use.
Re: Little coding questions - For general minor queries 5 -
SickAttack - 18.12.2016
Quote:
Originally Posted by PrO.GameR
Functions don't get called by players/clients, thats what callbacks are for, functions are as the name stands, functions for the coder to use.
|
It's possible to detect whether either is used, but I'm just not sure what he's trying to do.
Re: Little coding questions - For general minor queries 5 -
ISmokezU - 18.12.2016
Quote:
Originally Posted by SickAttack
It's possible to detect whether either is used, but I'm just not sure what he's trying to do.
|
Then tell me and isn't it obvious? to detect them.
Re: Little coding questions - For general minor queries 5 -
Dignity - 19.12.2016
Anyone has a clue why my inputtext isn't working properly? It occassionally adds/switches random characters.
EDIT: I should note that I use y_inline for all of my dialogs and they all work properly, except for this one.
PHP код:
if ( playertextid == creation_nameSel [ playerid ] ) {
inline creation_NameSel(pid, dialogid, response, listitem, string:inputtext[]) {
#pragma unused pid, dialogid, listitem
if ( ! response ) {
// No choice
}
if ( response ) {
if ( ! IsRPName ( inputtext )) {
return Dialog_ShowCallback ( playerid, using inline creation_NameSel, DIALOG_STYLE_INPUT, "Character: Name Selection", "Enter your character's name.\n\n\
Your name isn't a valid roleplaying name!\nIt has to be in a Firstname_Lastname format.\nIt can't be smaller than 5, or longer than 24 characters.", "Continue", "Cancel" );
}
new nameString [ 64 ] ;
player_nameSelect [ playerid ] [ 0 ] = EOS ;
strcat(nameString, inputtext, MAX_PLAYER_NAME ) ;
strcat ( player_nameSelect [ playerid ], inputtext, MAX_PLAYER_NAME ) ;
if ( strlen ( inputtext ) > 10 ) {
strdel(nameString, 10, sizeof ( nameString ) ) ;
strins(nameString, "...", 10, sizeof ( nameString ) ) ;
}
format ( nameString, sizeof ( nameString ), "Name~w~ %s", nameString ) ;
PlayerTextDrawSetString(playerid, creation_nameSel [ playerid ], nameString ) ;
}
}
return Dialog_ShowCallback ( playerid, using inline creation_NameSel, DIALOG_STYLE_INPUT, "Character: Name Selection", "Enter your character's name.", "Continue", "Cancel" );
}
Debug output:
Robert_Sheldon:
Код:
[14:56:17] [Inputtext]: Roaert_Sheldon | [NameStr]: Roaert_Sheldon | [NameSelect]: Roaert_Sheldon
Billy_Joe:
Код:
[14:56:17] [Inputtext]: Bihly_Joe | [NameStr]: Bihly_Joe| [NameSelect]: Bihly_Joe
Re: Little coding questions - For general minor queries 5 -
SickAttack - 19.12.2016
Quote:
Originally Posted by ISmokezU
Then tell me and isn't it obvious? to detect them.
|
I already told you in a previous reply. The fact you don't want to tell me what you are trying to do is stupid, so that's the only answer I'm giving you.
Quote:
Originally Posted by Dignity
Anyone has a clue why my inputtext isn't working properly? It occassionally adds/switches random characters.
EDIT: I should note that I use y_inline for all of my dialogs and they all work properly, except for this one.
PHP код:
if ( playertextid == creation_nameSel [ playerid ] ) {
inline creation_NameSel(pid, dialogid, response, listitem, string:inputtext[]) {
#pragma unused pid, dialogid, listitem
if ( ! response ) {
// No choice
}
if ( response ) {
if ( ! IsRPName ( inputtext )) {
return Dialog_ShowCallback ( playerid, using inline creation_NameSel, DIALOG_STYLE_INPUT, "Character: Name Selection", "Enter your character's name.\n\n\
Your name isn't a valid roleplaying name!\nIt has to be in a Firstname_Lastname format.\nIt can't be smaller than 5, or longer than 24 characters.", "Continue", "Cancel" );
}
new nameString [ 64 ] ;
player_nameSelect [ playerid ] [ 0 ] = EOS ;
strcat(nameString, inputtext, MAX_PLAYER_NAME ) ;
strcat ( player_nameSelect [ playerid ], inputtext, MAX_PLAYER_NAME ) ;
if ( strlen ( inputtext ) > 10 ) {
strdel(nameString, 10, sizeof ( nameString ) ) ;
strins(nameString, "...", 10, sizeof ( nameString ) ) ;
}
format ( nameString, sizeof ( nameString ), "Name~w~ %s", nameString ) ;
PlayerTextDrawSetString(playerid, creation_nameSel [ playerid ], nameString ) ;
}
}
return Dialog_ShowCallback ( playerid, using inline creation_NameSel, DIALOG_STYLE_INPUT, "Character: Name Selection", "Enter your character's name.", "Continue", "Cancel" );
}
Debug output:
Robert_Sheldon:
Код:
[14:56:17] [Inputtext]: Roaert_Sheldon | [NameStr]: Roaert_Sheldon | [NameSelect]: Roaert_Sheldon
Billy_Joe:
Код:
[14:56:17] [Inputtext]: Bihly_Joe | [NameStr]: Bihly_Joe| [NameSelect]: Bihly_Joe
|
Do more debugging (removing parts until it's normal then abnormal / printing after each instance).
Re: Little coding questions - For general minor queries 5 -
Dignity - 19.12.2016
Quote:
Originally Posted by SickAttack
Do more debugging (removing parts until it's normal then abnormal / printing after each instance).
|
There was no need for more debugging because I knew that inputtext caused it, and the debugs were done right after the inline function.
Either way, I suspect my hooks fucked it up or something because I put it in an individual function and it works perfectly now.
Re: Little coding questions - For general minor queries 5 -
PrO.GameR - 19.12.2016
Quote:
Originally Posted by Dignity
Anyone has a clue why my inputtext isn't working properly? It occassionally adds/switches random characters.
EDIT: I should note that I use y_inline for all of my dialogs and they all work properly, except for this one.
PHP код:
if ( playertextid == creation_nameSel [ playerid ] ) {
inline creation_NameSel(pid, dialogid, response, listitem, string:inputtext[]) {
#pragma unused pid, dialogid, listitem
if ( ! response ) {
// No choice
}
if ( response ) {
if ( ! IsRPName ( inputtext )) {
return Dialog_ShowCallback ( playerid, using inline creation_NameSel, DIALOG_STYLE_INPUT, "Character: Name Selection", "Enter your character's name.\n\n\
Your name isn't a valid roleplaying name!\nIt has to be in a Firstname_Lastname format.\nIt can't be smaller than 5, or longer than 24 characters.", "Continue", "Cancel" );
}
new nameString [ 64 ] ;
player_nameSelect [ playerid ] [ 0 ] = EOS ;
strcat(nameString, inputtext, MAX_PLAYER_NAME ) ;
strcat ( player_nameSelect [ playerid ], inputtext, MAX_PLAYER_NAME ) ;
if ( strlen ( inputtext ) > 10 ) {
strdel(nameString, 10, sizeof ( nameString ) ) ;
strins(nameString, "...", 10, sizeof ( nameString ) ) ;
}
format ( nameString, sizeof ( nameString ), "Name~w~ %s", nameString ) ;
PlayerTextDrawSetString(playerid, creation_nameSel [ playerid ], nameString ) ;
}
}
return Dialog_ShowCallback ( playerid, using inline creation_NameSel, DIALOG_STYLE_INPUT, "Character: Name Selection", "Enter your character's name.", "Continue", "Cancel" );
}
Debug output:
Robert_Sheldon:
Код:
[14:56:17] [Inputtext]: Roaert_Sheldon | [NameStr]: Roaert_Sheldon | [NameSelect]: Roaert_Sheldon
Billy_Joe:
Код:
[14:56:17] [Inputtext]: Bihly_Joe | [NameStr]: Bihly_Joe| [NameSelect]: Bihly_Joe
|
You should remember that passing an string to a function passes it as a reference, hence any changes made in the function will be applied to the original string parameter.
This can be because of IsRPName function, or any other function used thru OnDialogResponse hooks.
Re: Little coding questions - For general minor queries 5 -
Dignity - 19.12.2016
Quote:
Originally Posted by PrO.GameR
This can be because of IsRPName function, or any other function used thru OnDialogResponse hooks.
|
Yeah that was my first thought. I made several debugs but it was actually the inputtext messing up. Read the reply I made to Sickattack for more info
Re: Little coding questions - For general minor queries 5 -
ISmokezU - 20.12.2016
Hey does it matter if you use a strong tag or a weak tag with enums?
Код:
enum
E_Test//Strong tag
{
E_Sum = 5
};
enum
e_test//Weak tag
{
e_sum = 1
};
Then again why do people use _: with enums?
Re: Little coding questions - For general minor queries 5 -
SickAttack - 20.12.2016
Quote:
Originally Posted by ISmokezU
Hey does it matter if you use a strong tag or a weak tag with enums?
Код:
enum
E_Test//Strong tag
{
E_Sum = 5
};
enum
e_test//Weak tag
{
e_sum = 1
};
Then again why do people use _: with enums?
|
That means nothing, you could go all capslock too. It's just the name.
_: is to detag something (remove tag)
Re: Little coding questions - For general minor queries 5 -
ISmokezU - 20.12.2016
Quote:
Originally Posted by SickAttack
That means nothing, you could go all capslock too. It's just the name.
_: is to detag something (remove tag)
|
Ok,thanks what do you mean by detag something though?
Re: Little coding questions - For general minor queries 5 -
Logic_ - 20.12.2016
Can somebody explain me...
Quote:
[16:28:06] [debug] Run time error 6: "Invalid instruction"
[16:28:06] [debug] Unknown opcode 0x2c at address 0x000E11F0
[16:28:06] [debug] AMX backtrace:
[16:28:06] [debug] #0 native Kick () from samp-server.exe
[16:28:06] [debug] #1 00000004 in ?? (0) from CLASSIFIED.amx
[16:28:06] [debug] #2 0005c194 in public SSCANF_OnPlayerDisconnect (0, 2) from CLASSIFIED.amx
[16:28:06] [debug] #3 00003b24 in public KickTimer (0, 2) from CLASSIFIED.amx
|
KickTimer function
Код:
forward KickTimer(playerid);
public KickTimer(playerid)
{
if(playerid != INVALID_PLAYER_ID) Kick(playerid);
return 1;
}
Re: Little coding questions - For general minor queries 5 -
PrO.GameR - 20.12.2016
Quote:
Originally Posted by SickAttack
That means nothing, you could go all capslock too. It's just the name.
_: is to detag something (remove tag)
|
Do not give random info if you have no idea about the question asked
https://sampforum.blast.hk/showthread.php?tid=318307
Yes, they do have a difference:
Quote:
Strong & Weak tags:
pawn Код:
enum E_STRONG //< Since the name starts with a capital letter, the tag is considered "Strong" { E_VAR = 64 };
main() { new Test = E_STRONG:E_VAR; //Will give you a warning: "tag mismatch" because "Test" doesn't have E_STRONG tag #pragma unused Test }
pawn Код:
enum e_WEAK //< And here it starts with small letter, so the enum creates a weak tag. { E_VAR = 64 };
main() { new Test = e_WEAK:E_VAR; //No warning... #pragma unused Test }
|
Quote:
Originally Posted by ALiScripter
Can somebody explain me...
KickTimer function
Код:
forward KickTimer(playerid);
public KickTimer(playerid)
{
if(playerid != INVALID_PLAYER_ID) Kick(playerid);
return 1;
}
|
Idk if that seems to be the origin but by the looks of it you are passing yet another parameter to KickTimer, you should fix that.
You should consider re-compiling your code with debug lvl 3 (-d3) when testing your code.
Also I assume this is a linux server? if yes there's a tutorial on how to get more meaningful crash reports.
Re: Little coding questions - For general minor queries 5 -
PrO.GameR - 20.12.2016
Woops, double post -_-
Re: Little coding questions - For general minor queries 5 -
Logic_ - 20.12.2016
Quote:
Originally Posted by PrO.GameR
Idk if that seems to be the origin but by the looks of it you are passing yet another parameter to KickTimer, you should fix that.
You should consider re-compiling your code with debug lvl 3 (-d3) when testing your code.
Also I assume this is a linux server? if yes there's a tutorial on how to get more meaningful crash reports.
|
Nope, checked the whole script, I'm not passing any other parameter.
-d3 doesn't works, it doesn't show shit on my compiler output except for some warnings. I replaced my compiler and everything when 0.3.7 got released and downloaded all the new includes and stuff. Linux and Windows server output the exact same errors.