15.07.2009, 23:10
So I have this code for my server I'm working on, I want to make it to where you type /enter to enter a building, and /exit to leave the building. Here is the code:
The command works when the "If" lines all have the final parameter " == 0)" but then the command will teleport you to the Pizzaria, regardless of your location. When the "If" lines are set to == 1, I get the message "SERVER: Unknown Command". It's probably something simple that I'm missing, and I'm still new with "if". Please help, and thanks in advance.
P.S. I have a feeling that it is failing due to the "If" lines.
Code:
if (strcmp("/enter", cmdtext, true, 6) == 1) { if (PlayerToPoint(playerid, Float:10, Float:2104.8997, Float:-1806.4668, Float:14.1484) == 0) { SetPlayerInterior(playerid, 5); SetPlayerPos(playerid, Float:372.3520, Float:-131.6543, Float:1001.4922); SendClientMessage(playerid, 0xffffffff, "Welcome to the Pizza Parlor"); SetPlayerFacingAngle(playerid, Float:0.0); return 1; } else if (PlayerToPoint(playerid, Float:10, Float:1554.9174, Float:-1675.5553, Float:15.5010) == 0) { SetPlayerInterior(playerid, 6); SetPlayerPos(playerid, Float:246.7840, Float:63.9002, Float:1003.6406); SendClientMessage(playerid, 0xffffffff, "Welcome to the Police Department"); return 1; } else { SendClientMessage(playerid, 0xff0000AA, "ERROR: You can't enter here!"); }
P.S. I have a feeling that it is failing due to the "If" lines.