SA-MP Forums Archive
How to do it? - 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: How to do it? (/showthread.php?tid=553237)



How to do it? - _Application_ - 28.12.2014

I'm working on anti-hack

Now I do not want to for do any "anti-cheat" new public

i want they be like this:
PHP код:
public OnPlayerDetectedCheat(playeridcheatid)
{
    if(
cheatid == ANTI_MONEY// (cheatid 1)
    
{
        
// 
    
}
    if(
cheatid == ANTI_WEAPON// (cheatid 2)
    
{
        
//
    
}
    return 
0;

want one of everything Public.

Do not want to do so:
PHP код:
public OnPlayerFakeMoney(playerid)
{
    return 
0;

PHP код:
public OnPlayerFakeWeapon(playerid)
{
    return 
0;

I believe you understand me, I'd be happy if you explain to me how to do it

( sorry my bad english )


Re: How to do it? - Abagail - 28.12.2014

You can use CallLocalFunction to call a custom callback, assuming your calling a local script(example: the script is part of a gamemode / in as an include).

See:
https://sampwiki.blast.hk/wiki/CallLocalFunction

Using https://sampwiki.blast.hk/wiki/CallRemoteFunction will call the function in any loaded scripts the server is running.


Re: How to do it? - _Application_ - 28.12.2014

Quote:
Originally Posted by Abagail
Посмотреть сообщение
You can use CallLocalFunction to call a custom callback, assuming your calling a local script(example: the script is part of a gamemode / in as an include).

See:
https://sampwiki.blast.hk/wiki/CallLocalFunction

Using https://sampwiki.blast.hk/wiki/CallRemoteFunction will call the function in any loaded scripts the server is running.
Can be an example of how to do what I asked?

You can make me an example code?

If I knew I would do


Re: How to do it? - Abagail - 28.12.2014

Oh I thought you wanted it the other way around. You can still use that function how-ever, and do something like this:

pawn Код:
// when CASE_MONEY gets detected:
CallLocalFunction("OnPlayerDetectedCheat", "id", playerid, CHEAT_MONEY);
This will call the function with these parameters:
OnPlayerDetectedCheat(playerid, CHEAT_MONEY);


Re: How to do it? - _Application_ - 28.12.2014

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Oh I thought you wanted it the other way around. You can still use that function how-ever, and do something like this:

pawn Код:
// when CASE_MONEY gets detected:
CallLocalFunction("OnPlayerDetectedCheat", "id", playerid, CHEAT_MONEY);
This will call the function with these parameters:
OnPlayerDetectedCheat(playerid, CHEAT_MONEY);
Enable the full code please?