Unknown command
#1

Well, everytime I type "/exit" it shows me it's an unknown command even though it isn't. Can anyone see anything wrong with it?

Код:
CMD:exit(playerid) {
	if(IsPlayerInRangeOfPoint(playerid, 2.0, 246.6040,63.7641,1003.6406)) {
		SetPlayerPos(playerid, 1553.9977,-1675.6483,16.1953);
		SetPlayerInterior(playerid, 0);
	}
	else if(IsPlayerInRangeOfPoint(playerid, 2.0, -2027.5374,-105.0062,1035.1719)) {
		SetPlayerPos(playerid, 1284.8177,-1585.1346,13.5469);
		SetPlayerInterior(playerid, 0);
	}	
	else if(IsPlayerInRangeOfPoint(playerid, 2.0, 2305.8345,-16.0619,26.7496)) {
		SetPlayerPos(playerid, 1459.5800,-1011.4103,26.8438);
		SetPlayerInterior(playerid, 0);
	}
	else if(IsPlayerInRangeOfPoint(playerid, 2.0, 3161.4094,-442.7526,10.6328)) {
		SetPlayerPos(playerid, 1172.7821,-1325.3270,15.4007);
		SetPlayerInterior(playerid, 0);
	}
	
	if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[houseEntered{playerid}][hIntX], HouseInfo[houseEntered{playerid}][hIntY], HouseInfo[houseEntered{playerid}][hIntZ])) {
		SetPlayerPos(playerid, HouseInfo[houseEntered{playerid}][hX], HouseInfo[houseEntered{playerid}][hY], HouseInfo[houseEntered{playerid}][hZ]);
		SetPlayerInterior(playerid, 0);
		houseEntered{playerid} = 0;
	}
	if(IsPlayerInRangeOfPoint(playerid, 2.0, BusinessInfo[bizEntered{playerid}][bIntX], BusinessInfo[bizEntered{playerid}][bIntY], BusinessInfo[bizEntered{playerid}][bIntZ])) {
		SetPlayerPos(playerid, BusinessInfo[bizEntered{playerid}][bX], BusinessInfo[bizEntered{playerid}][bY], BusinessInfo[bizEntered{playerid}][bZ]);
		SetPlayerInterior(playerid, 0);
		bizEntered{playerid} = 0;
	}
	return 1;
}
Reply
#2

CMD:exit(playerid, params[]) {
Reply
#3

That doesn't make any difference. You don't have to include the param function if you don't need it.
Reply
#4

Run time error 4:
pawn Код:
HouseInfo[houseEntered{playerid}][...]
// and
BusinessInfo[bizEntered{playerid}][...]
I guess when a player hasn't entered a house/business, the variable is set to a value that it's not between 0 and size of House/Business Info arrays.

Maybe you forgot to assign the house/business when a player enters?
Reply
#5

You should get used to debugging.

The best debugging processes IMO are crashdetect and debug printing.

By crashdetect I obviously mean the plugin. By debug printing I mean something like this:
pawn Код:
CMD:exit(playerid) {
    printf("Initial Command Call");
    if(IsPlayerInRangeOfPoint(playerid, 2.0, 246.6040,63.7641,1003.6406)) {
        printf("[D] 1");
        SetPlayerPos(playerid, 1553.9977,-1675.6483,16.1953);
        SetPlayerInterior(playerid, 0);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2.0, -2027.5374,-105.0062,1035.1719)) {
        printf("[D] 2");
        SetPlayerPos(playerid, 1284.8177,-1585.1346,13.5469);
        SetPlayerInterior(playerid, 0);
    }  
    else if(IsPlayerInRangeOfPoint(playerid, 2.0, 2305.8345,-16.0619,26.7496)) {
        printf("[D] 3");
        SetPlayerPos(playerid, 1459.5800,-1011.4103,26.8438);
        SetPlayerInterior(playerid, 0);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 2.0, 3161.4094,-442.7526,10.6328)) {
        printf("[D] 4");
        SetPlayerPos(playerid, 1172.7821,-1325.3270,15.4007);
        SetPlayerInterior(playerid, 0);
    }
   
    if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseInfo[houseEntered{playerid}][hIntX], HouseInfo[houseEntered{playerid}][hIntY], HouseInfo[houseEntered{playerid}][hIntZ])) {
        printf("[H] 1");
        SetPlayerPos(playerid, HouseInfo[houseEntered{playerid}][hX], HouseInfo[houseEntered{playerid}][hY], HouseInfo[houseEntered{playerid}][hZ]);
        printf("[H] 2");
        SetPlayerInterior(playerid, 0);
        printf("[H] 3");
        houseEntered{playerid} = 0;
    }
    if(IsPlayerInRangeOfPoint(playerid, 2.0, BusinessInfo[bizEntered{playerid}][bIntX], BusinessInfo[bizEntered{playerid}][bIntY], BusinessInfo[bizEntered{playerid}][bIntZ])) {
        printf("[B] 1");
        SetPlayerPos(playerid, BusinessInfo[bizEntered{playerid}][bX], BusinessInfo[bizEntered{playerid}][bY], BusinessInfo[bizEntered{playerid}][bZ]);
        printf("[B] 2");
        SetPlayerInterior(playerid, 0);
        printf("[B] 3");
        bizEntered{playerid} = 0;
    }
    return 1;
}
I always tend to first try debug printing, and I always have crashdetect running in my test server.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)