Delay when entering/exiting interior
#1

Hello,
I'm having issue on my gamemode with delay when entering interiors and exiting.
When I press F or ENTER those are the two keys that are set I need to hold them for 5 sec before it reacts to it.
Now how could I fix that? I tried changing the keys didn't work. I'm using latest plugins and it was compiled with latest includes.
I didn't work on that gamemode from scratch it was downloaded from some website but the guy stoped developing it long time ago.
Reply
#2

There'll be a reason why they aren't developing it anymore, it probably has bugs.

Especially if you have to hold the key to enter, and it takes 5 seconds.

Show OnPlayerKeystateChange, and if that's packed full of crappy code, then that'll cause you trouble in more areas than just entering/exiting.
Reply
#3

@Sew_Sumi sent you an PM.
And yea it is crappy code.
Reply
#4

Quote:
Originally Posted by FikusBL
Посмотреть сообщение
@Sew_Sumi sent you an PM.
And yea it is crappy code.
Why don't you post the code here..?
Reply
#5

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Why don't you post the code here..?
Didn't wanna post it because it's written in other language.
But if you think you can help me out with this - https://pastebin.com/rkUYUKAi



EDIT: Hmm got this from server log

Код:
[00:54:55] [debug] Run time error 4: "Array index out of bounds"
[00:54:55] [debug]  Accessing element at index 1001 past array upper bound 1000
[00:54:55] [debug] AMX backtrace:
[00:54:55] [debug] #0 0037900c in public Spam_OnPlayerKeyStateChange (playerid=0, newkeys=16, oldkeys=0) at D:\Users\Fikus\Desktop\SAMP Test\gamemodes\grpv1.pwn:34577
[00:54:55] [debug] #1 native CallRemoteFunction () from samp-server.exe
[00:54:55] [debug] #2 00026f28 in ?? (... <3 arguments>) at D:\Users\Fikus\Desktop\SAMP Test\pawno\include\nospam.inc:278
[00:54:55] [debug] #3 0001280c in public OnPlayerKeyStateChange (playerid=0, newkeys=16, oldkeys=0) at D:\Users\Fikus\Desktop\SAMP Test\pawno\include\YSI\y_hooks/impl.inc:1962
->>>>>>> [chat] [Fikus]: ^^^^^^^^^^^^^ PRESSED F TO EXIT INTERIOR ^^^^^^^^^^^^
[00:55:01] [debug] Run time error 4: "Array index out of bounds"
[00:55:01] [debug]  Accessing element at index 1001 past array upper bound 1000
[00:55:01] [debug] AMX backtrace:
[00:55:01] [debug] #0 0037900c in public Spam_OnPlayerKeyStateChange (playerid=0, newkeys=16, oldkeys=0) at D:\Users\Fikus\Desktop\SAMP Test\gamemodes\grpv1.pwn:34577
[00:55:01] [debug] #1 native CallRemoteFunction () from samp-server.exe
[00:55:01] [debug] #2 00026f28 in ?? (... <3 arguments>) at D:\Users\Fikus\Desktop\SAMP Test\pawno\include\nospam.inc:278
[00:55:01] [debug] #3 0001280c in public OnPlayerKeyStateChange (playerid=0, newkeys=16, oldkeys=0) at D:\Users\Fikus\Desktop\SAMP Test\pawno\include\YSI\y_hooks/impl.inc:1962
---->>>>> [chat] [Fikus]: ENTERED INTERIOR ^^^^^^^^^^^^^
[00:54:55] [debug] #0 0037900c in public Spam_OnPlayerKeyStateChange (playerid=0, newkeys=16, oldkeys=0) at D:\Users\Fikus\Desktop\SAMP Test\gamemodes\grpv1.pwn:34577

^ This line is pointing here

Код:
	if(!IsPlayerInAnyVehicle(playerid))
	{

	  		for(new i; i < MAX_HOUSE; i++)
			{
				if(IsPlayerInRangeOfPoint(playerid, 3.0, KucaInfo[i][kUlazX], KucaInfo[i][kUlazY], KucaInfo[i][kUlazZ])) <------
				{

	    			if(PlayerInfo[playerid][pPosedovanjeKuce] == i ||  PI[playerid][pRent] == i || KucaInfo[i][kZatvoreno] == 0)

	    		   	{

	                    SetPlayerVirtualWorld(playerid, KucaInfo[i][kVW]);
	                    SetPlayerInterior(playerid, KucaInfo[i][kInt]);
	                 	Dimi_SetPlayerPos(playerid, KucaInfo[i][kIzlazX], KucaInfo[i][kIzlazY], KucaInfo[i][kIzlazZ]);
	                 	PlayerInfo[playerid][pInt] = 1;
	                 	SetPlayerWeather(playerid, 1);
	                 	PlayerTimer[playerid][25]  =SetTimerEx("unfreezeobject",0,false,"d",playerid);
	                 	TogglePlayerControllable(playerid, 0);
	                 	 	if(Snegic == 1)
	             	{
					 DeleteSnow(playerid);
	             	}
	                 	antiCheatCS[ playerid ][ TeleportCheck ] = 4;
					   {
						if(KucaInfo[i][kNeaktivnost] >=1)
						if(PlayerInfo[playerid][pPosedovanjeKuce] == i)
						{
						  KucaInfo[i][kNeaktivnost] = 0;
						  SacuvajKucu(i);
						  SCM(playerid,-1,"Restartovali ste neaktvinost vase kuce !");
						  KuceLP(i);
						}
						}


	                }
	                else
	                {


	                    GMT(playerid,"~r~ZAKLJUCANO",4000,1);
	                    return 1;

	                }

	}
Reply
#6

What's MAX_HOUSE set to? If it's over 1000, that could have something to do with this.
Reply
#7

Wow, actually it was a simple fix, just deleted the nospam inc. It was causing the trouble..
But I appreciate the help!
Reply
#8

I'd be a bit wary of this... Whilst removing the include has stopped the error being shown, I'm sure this will come up again.

That OnPlayerKeystateChange is SOOOOOOOOO overweighted.

Like, that really needs work, indentation is one thing, but that code, is likely to need a severe look at, it looks like it's simply every gamemode scripts OnPlayerKeystateChange merged into one.


I just put uncrustify through it, and the indentation is fixed... You should look at this compared to your code as no doubt, it's a lot easier to read.

https://pastebin.com/jFnC5cNi
Reply
#9

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
I'd be a bit wary of this... Whilst removing the include has stopped the error being shown, I'm sure this will come up again.

That OnPlayerKeystateChange is SOOOOOOOOO overweighted.

Like, that really needs work, indentation is one thing, but that code, is likely to need a severe look at, it looks like it's simply every gamemode scripts OnPlayerKeystateChange merged into one.
Oh yea the identation is fucked up on over 7k+ lines.
Reply
#10

Uncrustify is good...

Код:
uncrustify.exe -c ./cfg/defaults.cfg -f opksc.txt > unfopksc.txt
https://github.com/uncrustify/uncrustify

opksc.txt being the input, unfopksc.txt being the output.

I use txt files so I can simply make a new text file in the folder, change the batch file to reflect what files I'm processing, and away it goes, no more headaches.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)