SERVER UNKNOWN COMMAND, but command works
#1

I have a problem, when I type /enter i got message "SerevR: Unknown command" but command works perfect.

this is my command:
Код:
	if(strcmp(cmd, "/enter", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			if(UWSobi[playerid] != 999){SendClientMessage(playerid,COLOR_GREY,"Trenutno ne mozes ovo raditi!"); return 1;}
			for(new i = 0; i < sizeof(HouseInfo); i++)
			{
				if (IsPlayerInRangeOfPoint(playerid, 4,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]))
				{
					
					if(Igrac[playerid][pKuca] == i || HouseInfo[i][hLock] == 0)
					{	    
						StopAudioStreamForPlayer(playerid);
						SetPlayerVirtualWorld(playerid,HouseInfo[i][hWorld]);
						SetPlayerInterior(playerid,HouseInfo[i][hInt]);
						AC_SetPlayerPos(playerid,HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz]);
						Igrac[playerid][pVirWorld] = HouseInfo[i][hWorld];
						HouseEntered[playerid] = i;
						Igrac[playerid][pInterior] = 39;
						if(strcmp(HouseInfo[i][hRadio],"off",true)!=0) PlayAudioStreamForPlayer(playerid,HouseInfo[i][hRadio]);
						return 1;
					}
					else
					{
						SendClientMessage(playerid,COLOR_GREY,"Kuca je zakljucana, pokusaj pozvoniti.{FFFFFF} ((/zvoni))");
						return 1;
					}
				}
			}
			for(new i = 0; i < sizeof(OrgInfo); i++)
			{
				if(IsPlayerInRangeOfPoint(playerid,2,OrgInfo[i][oBazaTextX],OrgInfo[i][oBazaTextY],OrgInfo[i][oBazaTextZ]) && (Igrac[playerid][pClan]== i || Igrac[playerid][pVodja]==i))
				{
					SetPlayerVirtualWorld(playerid,OrgInfo[i][oVWorld]);
					SetPlayerInterior(playerid,OrgInfo[i][oInt]);
					AC_SetPlayerPos(playerid,OrgInfo[i][oBazaIzlazX],OrgInfo[i][oBazaIzlazY],OrgInfo[i][oBazaIzlazZ]);
					OrgEntered[playerid]=i;
					return 1;
				}
			}
			if(IsPlayerInRangeOfPoint(playerid,2,OrgInfo[15][oBazaTextX],OrgInfo[15][oBazaTextY],OrgInfo[15][oBazaTextZ]) && PolOvlast(playerid,2))
			{
				SetPlayerVirtualWorld(playerid,OrgInfo[15][oVWorld]);
				SetPlayerInterior(playerid,OrgInfo[15][oInt]);
				AC_SetPlayerPos(playerid,OrgInfo[15][oBazaIzlazX],OrgInfo[15][oBazaIzlazY],OrgInfo[15][oBazaIzlazZ]);
				OrgEntered[playerid]=15;
				return 1;
			}
			if(IsPlayerInRangeOfPoint(playerid,2,-1819.2833,-149.2082,9.3984) && Igrac[playerid][pPosao]==6) // prerada droge ulaz
			{
				StopAudioStreamForPlayer(playerid);
				SetPlayerVirtualWorld(playerid,0);
				SetPlayerInterior(playerid,0);
				AC_SetPlayerPos(playerid,770.9332,-1107.6324,-43.2620);
				return 1;
			}
			/*if(IsPlayerInRangeOfPoint(playerid,2,1739.9890,-1098.5948,24.0781) && (Igrac[playerid][pClan]==1 || Igrac[playerid][pVodja]==1))
			{
				Portan[playerid] = 4;
				StopAudioStreamForPlayer(playerid);
				SetPlayerVirtualWorld(playerid,2);
				OrgEntered[playerid] = 1;
				AC_SetPlayerPos(playerid,1738.3232,-1098.4375,24.0781);
				return 1;
			}*/
			if(IsPlayerInRangeOfPoint(playerid,2,474.6057,-21.6561,1003.1094) && Unutar[playerid] == 3 && Igrac[playerid][pPosao]==16)
			{
				AC_SetPlayerPos(playerid,474.6819,-19.9865,1003.6953);
				Unutar[playerid] = 4;
			}
			// Sudnica unutra port
			if(IsPlayerInRangeOfPoint(playerid,3,1496.2693,-1538.2214,19.6840)) // sudnica ulaz
			{
			    SetTimerEx("UcitavanjeObjekata", 2000, 0, "i", playerid);
				AC_SetPlayerPos(playerid,1482.2810,-1780.4349,2981.3540);
				TogglePlayerControllable(playerid, 0);
			}
			// Zatvor ulaz
			if(IsPlayerInRangeOfPoint(playerid,2,1480.6371,-1776.5649,3281.7954))
			{
				StopAudioStreamForPlayer(playerid);
				SetPlayerVirtualWorld(playerid,0);
				SetPlayerInterior(playerid,0);
				AC_SetPlayerPos(playerid,1317.2689,-894.6085,7.8714);
                SetTimerEx("UcitavanjeObjekata", 2000, 0, "i", playerid);
				TogglePlayerControllable(playerid, 0);
				return 1;
			}
			// Zatvor izlaz
			if(IsPlayerInRangeOfPoint(playerid,2,1317.2689,-894.6085,7.8714))
			{
				StopAudioStreamForPlayer(playerid);
				SetPlayerVirtualWorld(playerid,0);
				SetPlayerInterior(playerid,0);
				AC_SetPlayerPos(playerid,1480.6371,-1776.5649,3281.7954);
				TogglePlayerControllable(playerid, 0);
				SetTimerEx("UcitavanjeObjekata", 2000, 0, "i", playerid);
				// interijer ovdje
				return 1;
			}
			if(IsPlayerInRangeOfPoint(playerid,3,1488.8939,-1542.5552,19.6464)) // sudnica ulaz
			{
			    SetTimerEx("UcitavanjeObjekata", 2000, 0, "i", playerid);
			    TogglePlayerControllable(playerid, 0);
				AC_SetPlayerPos(playerid,1482.2810,-1780.4349,2981.3540);
			}
			if(IsPlayerInRangeOfPoint(playerid,2,1471.3590,-1178.0969,23.9212))
			{
				AC_SetPlayerPos(playerid,1477.0608,-1185.3660,23.9428);
			}
			if(IsPlayerInRangeOfPoint(playerid,2,1463.3236,-1470.5436,13.5391))
			{
				AC_SetPlayerPos(playerid,1470.1124,-1470.8492,13.6154);
			}
			if(IsPlayerInRangeOfPoint(playerid,2,1966.4862,-1276.0928,23.9844))
			{
				AC_SetPlayerPos(playerid,1959.1147,-1276.1901,-6.5438);
			}
			if(IsPlayerInRangeOfPoint(playerid,2,1727.0249,-1637.0326,20.2241))
			{
				AC_SetPlayerPos(playerid,1727.0746,-1637.8335,20.2229);
			}
			if(IsPlayerInRangeOfPoint(playerid,2,1699.7336,-1667.8314,20.2189))
			{
				AC_SetPlayerPos(playerid,1700.5308,-1667.7980,20.2188);
			}
			if(IsPlayerInRangeOfPoint(playerid,2,1574.2218,-1341.0956,16.4844))
			{
				AC_SetPlayerPos(playerid,1548.7089,-1363.7505,326.2183);
			}
			if(IsPlayerInRangeOfPoint(playerid,2,1024.1372,-983.9824,42.7204))
			{
				AC_SetPlayerPos(playerid,976.6693,-1012.2502,42.7952);
			}
 			new kojagaraza = GarazaID(playerid);
			if(kojagaraza != 9999)
			{
			    if(HouseInfo[kojagaraza][hImagarazu] == 0) return 1;
			    if(HouseInfo[kojagaraza][hGarazaZakljucana] == 1 && Igrac[playerid][pKuca] != kojagaraza)
		    	{
		        	SendClientMessage(playerid, COLOR_GREY, "{FF0000}Garaza zakljucana.");
		        	return 1;
		    	}
				if(GetPlayerState(playerid) == 2)
  				{
	     			Portan[playerid] = 4;
	        		SetPlayerVirtualWorld(playerid, kojagaraza);
			        SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), kojagaraza);
			        SetVehiclePos(GetPlayerVehicleID(playerid), 1373.6763,-38.0756,1001.0511);
					SetVehicleZAngle(GetPlayerVehicleID(playerid), 1.7881);
					hGarazaEntered[playerid] = kojagaraza;
	    		}
		    	else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
		    	{
		    	    SetPlayerVirtualWorld(playerid, kojagaraza);
		    	    AC_SetPlayerPos(playerid, 1373.6763,-38.0756,1001.0511);
		    	    hGarazaEntered[playerid] = kojagaraza;
		    	}
		    	return 1;
			}
  		}
		return 1;
	}
Please help me, thanks
Reply
#2

You're probably missing a return 1; somewhere, therefore SAMP thinks the command hasn't executed when obviously in your case it has.
Reply
#3

pawn Код:
return 1;
            }
Remove it. ^
Reply
#4

Where exactly? I got 26 errors
Reply
#5

As stated, this is caused by OnPlayerCommandText returning 0. So one of your commands is missing a return.

Also, use a command processor like ZCMD or YCMD.
Reply
#6

I dont know that, please help me.
Reply
#7

pawn Код:
new kojagaraza = GarazaID(playerid);
if (kojagaraza != 9999) {
    if (HouseInfo[kojagaraza][hImagarazu] == 0) return 1;
    if (HouseInfo[kojagaraza][hGarazaZakljucana] == 1 && Igrac[playerid][pKuca] != kojagaraza) {
        SendClientMessage(playerid, COLOR_GREY, "{FF0000}Garaza zakljucana.");
        return 1;
    }
    if (GetPlayerState(playerid) == 2) {
        Portan[playerid] = 4;
        SetPlayerVirtualWorld(playerid, kojagaraza);
        SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), kojagaraza);
        SetVehiclePos(GetPlayerVehicleID(playerid), 1373.6763, -38.0756, 1001.0511);
        SetVehicleZAngle(GetPlayerVehicleID(playerid), 1.7881);
        hGarazaEntered[playerid] = kojagaraza;
    } else if (GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) {
        SetPlayerVirtualWorld(playerid, kojagaraza);
        AC_SetPlayerPos(playerid, 1373.6763, -38.0756, 1001.0511);
        hGarazaEntered[playerid] = kojagaraza;
    }
    return 1;
}
If GarazaID function returns any other value to indicate invalid instead of 9999, it can give run time error 4: array index out of bounds error.

Install crashdetect plugin (https://github.com/Zeex/samp-plugin-...etect/releases)
Set -d3 flag (https://github.com/Zeex/samp-plugin-...ith-debug-info)
Compile your script again.
Start the server, execute the command and post the server log if it gave unknown command.
Reply
#8

Quote:
Originally Posted by KinderClans
Посмотреть сообщение
pawn Код:
return 1;
            }
Remove it. ^
Double check, removing that one doesn't make sense check it again looks like he disabled some of the codes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)