03.08.2011, 13:25
I have a /SETPOS command, with these parameters:
X, Y, Z, ANGLE, INTERIOR
X Y and Z are required, but angle and interior, if omitted, should remain the same.
If 4 parameters are input, the fourth should be interior, not angle. If 5 are input, the 5th will be interior.
Hope you understand, any help appreciated.
EDIT: I tried this, but it crashes the server:
I thought maybe I could then check if it was -1, to see if it was input.
X, Y, Z, ANGLE, INTERIOR
X Y and Z are required, but angle and interior, if omitted, should remain the same.
If 4 parameters are input, the fourth should be interior, not angle. If 5 are input, the 5th will be interior.
Hope you understand, any help appreciated.
EDIT: I tried this, but it crashes the server:
pawn Code:
dcmd_setpos(playerid, params[])
{
new Float:setposx, Float:setposy, Float:setposz, Float:setposa, setposi;
if(sscanf(params, "fffF(-1.0)I(-1)", setposx, setposy, setposz, setposa, setposi)) return ShowSyntax(playerid, "/SETPOS [X] [Y] [Z] <ANGLE> <INTERIOR>", "Set your position.");
if(GetPlayerState(playerid) != 2) SetPlayerPos(playerid, setposx, setposy, setposz);
else SetVehiclePos(GetPlayerVehicleID(playerid), setposx, setposy, setposz);
SetPlayerFacingAngle(playerid, setposa);
SetPlayerInterior(playerid, setposi);
return 1;
}