SA-MP Forums Archive
questions - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: questions (/showthread.php?tid=273207)



questions - Gh0sT_ - 31.07.2011

Does OnPlayerKeyStateChange gets called when someone used sprunk machines?

If not, then maybe someone knows animation name when using sprunk machines?


Re: questions - LetsOWN[PL] - 31.07.2011

Yes, it is, if you scripted something under the key, that you're using to buy sprunk.


Re: questions - Onyx - 31.07.2011

Original vending machines doesn't use OnPlayerKeyStateChange callback. Animations which are related with vending machines, can be found here, by using keyword vending.


Re: questions - Calgon - 31.07.2011

OnPlayerKeyStateChange is called for EVERY key that GTA: SA uses, Sprunk or not.

Quote:
Originally Posted by Onyx
View Post
Original vending machines doesn't use OnPlayerKeyStateChange callback. Animations which is related with vending machines, can be found here, by using keyword vending.
That doesn't mean it won't call the callback. You should be more explanatory in your posts to prevent people from being misled in to believing untrue information.


Re: questions - LetsOWN[PL] - 31.07.2011

Quote:

That doesn't mean it won't call the callback. You should be more explanatory in your posts to prevent people from being misled in to believing untrue information.

Yehh
SA-MP team should give us "OnPlayerUsingSprunkMachine(playerid,machineid )" for situations like this, hehe


Re: questions - Onyx - 31.07.2011

Quote:
Originally Posted by Calg00ne
View Post
OnPlayerKeyStateChange is called for EVERY key that GTA: SA uses, Sprunk or not.



That doesn't mean it won't call the callback. You should be more explanatory in your posts to prevent people from being misled in to believing untrue information.
I was wrong, but you corrected my fault. So we both learned from our mistakes. Nobody can be perfect. At least, I'm trying to help.


Re: questions - Gh0sT_ - 31.07.2011

OK, thanks, now another problem.. >_>


So, I my anti text/command spam script a bit, and its stop working. When I use 1-3 commands, it likes freezes the server when using commands, and anti text spam - I can spam howmuch I want.

I tried to test it with new.pwn, same.

Script, with it I tested it:


pawn Code:
#include "..\pawno\include\a_samp.inc"
#include "..\pawno\include\zcmd.inc"

new CommandSpam[MAX_PLAYERS], TextSpam[MAX_PLAYERS];

main(){}

public OnPlayerText(playerid)
{
    if(TextSpam[playerid] != 0 && gettime() > TextSpam[playerid]) return 0;
    TextSpam[playerid] = gettime() + 2;
    return 1;
}

public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(CommandSpam[playerid] != 0 && gettime() > CommandSpam[playerid]) return 0;
    CommandSpam[playerid] = gettime() + 2;
    return 1;
}

CMD:pirma(playerid, params[]) return SendClientMessage(playerid, -1, "{33AA33}Komanda NR. 1");

CMD:antra(playerid, params[]) return SendClientMessage(playerid, -1, "{33AA33}Komanda NR. 2");

CMD:info(playerid, params[])
{
    new sz_String[69];
    format( sz_String, 69, "{FFFFFF}Text Spam - {33AA33}%d\n{FFFFFF}Command Spam - {33AA33}%d", TextSpam[playerid], CommandSpam[playerid]);
    ShowPlayerDialog(playerid,  1339, DIALOG_STYLE_MSGBOX, "{FFFFFF}Info", sz_String, "Close", "" );
    return 1;
}



Re: questions - Gh0sT_ - 01.08.2011

So, anyone knows where's the problem? :X


Re: questions - Gh0sT_ - 01.08.2011

^^^^... :<>


Re: questions - AndreT - 01.08.2011

Why are you checking if the current UNIX timestamp is bigger than the TextSpam value? Also, I think you should use GetTickCount() for more precise measurement since you are dealing with times 1-2 seconds. You could make your anti-spam script better if you actually checked if one line is being repeated constantly or spammed.