SA-MP Forums Archive
cmd enter problem - 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: cmd enter problem (/showthread.php?tid=659059)



cmd enter problem - xAlecsu - 21.09.2018

hello take a sistem for business from tutorials ,but when i try to enter in my bizz i take this error "Server:unknown command"

Код:
CMD:enter(playerid)
{
	new h = GetClosetHouseID(playerid);
	if(House[h][On_Sell] == 0 && House[h][Lock] == 0)
	{
		SetPlayerPos(playerid,House[h][ExitX],House[h][ExitY],House[h][ExitZ]);
		SetPlayerInterior(playerid,House[h][IntID]);
		SetPlayerVirtualWorld(playerid,House[h][VW]);
	}
	else return SCM(playerid,COLOR_RED,"EROR: "COL_WHITE"House is locked/Is not on sale.");
	if(strcmp(House[h][Owner],GetName(playerid),false) == 0)
	{
		new Year, Month, Day;
		getdate(Year, Month, Day);
		House[h][DayEnter] = Day;
	 	House[h][MonthEnter] = Month;
		CheckHouse(h);
	}
 	if(IsPlayerInRangeOfPoint(playerid, 1.0, BusinessInfo[playerid][bEntranceX], BusinessInfo[playerid][bEntranceY], BusinessInfo[playerid][bEntranceZ]))//Checks if player is near the entrance.
 	{
  		if(BusinessInfo[playerid][bLocked] == 1) return SendClientMessage(playerid, COLOR_GREY, "This Business is locked!");//Checks it it is locked/
		SetPlayerPos(playerid, BusinessInfo[playerid][bExitX], BusinessInfo[playerid][bExitY], BusinessInfo[playerid][bExitZ]);
		SetPlayerFacingAngle(playerid, BusinessInfo[playerid][bExitA]);
		SetPlayerInterior(playerid, BusinessInfo[playerid][bInsideInt]);
		SetPlayerVirtualWorld(playerid, BusinessInfo[playerid][bInsideWorld]);
		InsideBiz[playerid] = playerid;
		return 1;
	}
	if(IsPlayerInRangeOfPoint(playerid, 2.0, BusinessInfo[playerid][bExitX], BusinessInfo[playerid][bExitY], BusinessInfo[playerid][bExitZ]) && GetPlayerVirtualWorld(playerid) == BusinessInfo[playerid][bInsideWorld])//Checks if player is in near the exit.
 	{
		SetPlayerPos(playerid, BusinessInfo[playerid][bEntranceX], BusinessInfo[playerid][bEntranceY], BusinessInfo[playerid][bEntranceZ]);
		SetPlayerFacingAngle(playerid, BusinessInfo[playerid][bEntranceA]);
		SetPlayerInterior(playerid, BusinessInfo[playerid][bInt]);
		SetPlayerVirtualWorld(playerid, BusinessInfo[playerid][bWorld]);
		InsideBiz[playerid] = 0;
		return 1;
	}
    return 1;
}



Re: cmd enter problem - kingmk - 21.09.2018

Can u show us the console error?


Re: cmd enter problem - Calisthenics - 22.09.2018

What if a player is not close to any house? Will GetClosetHouseID return an invalid value? Using it in House array will give run time error 4, you need to verify it is a valid house (player close to house) before doing anything.


Re: cmd enter problem - GTLS - 22.09.2018

PHP код:
CMD:enter(playeridparams[]) 



Re: cmd enter problem - TheToretto - 22.09.2018

ZCMD's syntaxes are the following :

COMMAND:enter(playerid, params[]) or CMD:enter(playerid, params[]) // You can lowercase them (cmd/command) anyway, you should change this

PHP код:
CMD:enter(playerid
to this

PHP код:
CMD:enter(playeridparams[]) 
Beside that's not the source of the problem, no errors while compiling?


Re: cmd enter problem - xAlecsu - 22.09.2018

i change this:
Код:
CMD:enter(playerid, params[])
but i have same problem..


Re: cmd enter problem - Zeus666 - 22.09.2018

Is this via filterscript or you added it in your server pwn?


Re: cmd enter problem - xAlecsu - 22.09.2018

it's Gagi's House System v1.4 and yea it's from filescript


Re: cmd enter problem - Gammix - 23.09.2018

Quote:
Originally Posted by xAlecsu
Посмотреть сообщение
i change this:
Код:
CMD:enter(playerid, params[])
but i have same problem..
You can have both syntax, both will compile and work.

Quote:
Originally Posted by Calisthenics
Посмотреть сообщение
What if a player is not close to any house? Will GetClosetHouseID return an invalid value? Using it in House array will give run time error 4, you need to verify it is a valid house (player close to house) before doing anything.
^ This is the solution to your problem. You need to check if GetClosetHouseID doesn't return an invalid value, which in your case it is when you're not close to any house and your command crashes.


Re: cmd enter problem - solstice_ - 23.09.2018

Quote:
Originally Posted by GTLS
Посмотреть сообщение
PHP код:
CMD:enter(playeridparams[]) 
Why would that make a difference? That has nothing to do with the issue at all.