SA-MP Forums Archive
Help me fix this bugs :) - 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 me fix this bugs :) (/showthread.php?tid=317714)



Help me fix this bugs :) - ivanVU - 12.02.2012

Hello,i have some bugs with filterscript for apartments.


1. Bug is with enter/exit in apartment
Enter works,but i don't know what's wrong with exit...

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if( newkeys == KEY_SECONDARY_ATTACK ) // enter
{
for(new st = 0; st <= MAX_STANOVA; st++)
	{
		if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))
		{
			new Level = StanInfo[st][stLevel];
			if(StanInfo[st][stLocked] == 1 && strcmp(StanInfo[st][stName], GetName(playerid), false) != 0) return SendClientMessage(playerid, -1,  ""CRVENA"[STAN]:"ZELENA" Ovaj stan je zakljucan.");
			SetPlayerPos(playerid, StansCoords[Level][0], StansCoords[Level][1], StansCoords[Level][2]);
			SetPlayerInterior(playerid, StansLevels[Level][0]);
			SetPlayerVirtualWorld(playerid, StanInfo[st][stVirtualWorld]);

			break;
		}
	}
}
if( newkeys == KEY_SECONDARY_ATTACK ) // exit
{
	for(new stan = 0; stan<= MAX_STANOVA; stan++)
	{
	    new st = GetPlayerVirtualWorld(playerid);
		if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StansCoords[StanInfo[st][stLevel]][0], StansCoords[StanInfo[st][stLevel]][1], StansCoords[StanInfo[st][stLevel]][2]))
		{
			SetPlayerPos(playerid, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]);
			SetPlayerInterior(playerid, 0);
			SetPlayerVirtualWorld(playerid, 0);
		}
	}
}
return true;
}
2. Bug is with command Lock

That command does what it must do , but it send's me message SERVER: Unknown message..
I don't know what's the problem with this command

Код:
CMD:lock(playerid,params[])
{
    for(new st = 0; st <= MAX_STANOVA; st++)
    {
		if(IsPlayerInRangeOfPoint(playerid, PTP_RADIUS, StanInfo[st][stExitX], StanInfo[st][stExitY], StanInfo[st][stExitZ]))// return SCM(playerid,-1,""CRVENA"[STAN]:"ZELENA"Niste vlasnik ovog stana!");
		{
			if(strcmp(StanInfo[st][stName], GetName(playerid), false) == 0)
			{
				if(StanInfo[st][stLocked] == 1)
				{
				StanInfo[st][stLocked] = 0;
				SpremiStanove(st);
				SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA"Otkljucali ste svoj stan.");
				}
    			else
				{
				StanInfo[st][stLocked] = 1;
				SpremiStanove(st);
				SendClientMessage(playerid, -1, ""CRVENA"[STAN]:"ZELENA"Zakljucali ste svoj stan.");
				}
			}
		}
	}
        return SCM(playerid,-1,"");
}
Thank you