SA-MP Forums Archive
[Hopfully Solved] Unknown command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Hopfully Solved] Unknown command (/showthread.php?tid=94444)



[Hopfully Solved] Unknown command - kevin974 - 29.08.2009

Код:
new Float:HousesCoords[13][3] = {
{222.9534, 1287.7649, 1082.1406},  // Sml - 1 bedroom
{261.0827, 1284.6899, 1080.2578},  // Sml - 1 bedroom
{260.6734, 1237.7909, 1084.2578},  // Sml - 1 bedroom
{376.7426, 1417.3226, 1081.3281},  // Sml - 1 bedroom
{295.2874, 1473.2769, 1080.2578},  // Med - 2 bedroom
{2270.1050, -1210.3917, 1047.5625}, // Med - 2 bedroom
{327.9431, 1478.3801, 1084.4375},  // Med - 2 bedroom
{447.1211, 1397.8444, 1084.3047},  // Med - 2 bedroom
{2196.0063, -1204.6326, 1049.0234}, // Lrg - 3 bedroom
{235.3416, 1187.2882, 1080.2578},  // Lrg - 3 bedroom
{490.9987, 1399.4164, 1080.2578},  // Lrg - 3 bedroom
{227.1212, 1114.1840, 1080.9972},  // Lrg - 4 bedroom
{225.6624, 1022.5345, 1084.0145}  // Xlrg - 4 bedrooms
};

dcmd_exit(playerid,params[]) {
	#pragma unused params
	if(IsPlayerConnected(playerid) && PLAYERLIST_authed[playerid] == 1){
		for(new h = 0; h <= MAX_HOUSES; h++)
		{
		  if(PlayerToPoint(3.0, playerid, HousesCoords[HouseInfo[h][hLevel]][0], HousesCoords[HouseInfo[h][hLevel]][1], HousesCoords[HouseInfo[h][hLevel]][2]))
			{
			  TeleportPlayer(playerid, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ], 0, 0, 0);
              return 1;
			}
		}
	}
	return true;
}

stock TeleportPlayer(playerid, Float:x,Float:y,Float:z, Interior, VehTele, Vworld)
{
	if(IsPlayerConnected(playerid)){
		new car = GetPlayerVehicleID(playerid);
		if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) { SetPlayerPos(playerid, x,y,z); SetPlayerVirtualWorld(playerid, Vworld); }
		if( VehTele == 1) {
			if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) { SetVehiclePos(car, x,y,z); SetVehicleVirtualWorld(car, Vworld); }
			}
		SetPlayerInterior(playerid, Interior); }
	return true;
}
I am having a problem with my dcmd_exit command i believe. When i try /exit and i am not over the coordinated it returns Unknown Command. But when i am over the coordinates i dont get the error it just teleports me to were i wanna go.


Re: [HELP] Unknown command - Correlli - 29.08.2009

pawn Код:
if(PlayerToPoint(3.0, playerid, HousesCoords[HouseInfo[h][hLevel]][0], HousesCoords[HouseInfo[h][hLevel]][1], HousesCoords[HouseInfo[h][hLevel]][2]))
{
  TeleportPlayer(playerid, HouseInfo[h][hExitX], HouseInfo[h][hExitY], HouseInfo[h][hExitZ], 0, 0, 0);
  return 1;
}
else
{
  // _you're_not_there_msg_
}



Re: [HELP] Unknown command - kevin974 - 29.08.2009

When i do that it spames the not there message about 100 times and then at the end it sayd Unknown command. And if i just return 1; on the else i can only enter and exit from the first set of coordinates and nothing else.


Re: [HELP] Unknown command - Correlli - 30.08.2009

I assume you have putted it under the MAX_HOUSES loop, that's why it's spaming.


Re: [HELP] Unknown command - kevin974 - 30.08.2009

Well i have too, if you look at the command i need to put the loop before the if statement because the variable uses the loop.


Re: [HELP] Unknown command - kevin974 - 30.08.2009

Does anyone at least know how to write this code so that it would work?


Re: [HELP] Unknown command - EirikhO - 30.08.2009

[me=EirikhO]just got a semi-bright idea[/me]


You make one of those things you can set to 1 and 0 (dont remember what its called, but you know -- like Policedude[playerid]=1)
and set it to 0 if not near any house, but if youre near the place you need to be, set it at 1 and do whatever you want to do



...but to not mess it up if its not the last house in the sequence youre near, you need 13 of those thingys.


Re: [HELP] Unknown command - kevin974 - 30.08.2009

Well what i am doing in the functions /enter /exit is that when you enter it well tp you to one of 12 interiors. But there may be like 100 houses( the exit coordinates ).


Re: [HELP] Unknown command - EirikhO - 30.08.2009

Can't you just make a pickup?


Re: [HELP] Unknown command - kevin974 - 30.08.2009

I could but i don't create pickups on the interior of the houses. Just the entrance of the house.

The problem is withing the exit command. But i don't know why the hell it would be showing the unknown command error.