IsPlayerHoldingObject macro help - 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: IsPlayerHoldingObject macro help (
/showthread.php?tid=194148)
[SOLVED] IsPlayerHoldingObject macro help -
PlayLSX - 28.11.2010
This is probably something simple, but ... I have added the macros to my script for the object functions as stated in the release thread, but I'm now getting this error when I try to compile:
pawn Код:
C:\Users\Noc\Desktop\Stuff\SAMP\gamemodes\LSX.pwn(4758) : error 001: expected token: ")", but found ";"
C:\Users\Noc\Desktop\Stuff\SAMP\gamemodes\LSX.pwn(4758) : error 036: empty statement
C:\Users\Noc\Desktop\Stuff\SAMP\gamemodes\LSX.pwn(4758) : error 029: invalid expression, assumed zero
C:\Users\Noc\Desktop\Stuff\SAMP\gamemodes\LSX.pwn(4758) : fatal error 107: too many error messages on one line
Line 4758 is:
pawn Код:
CMD:mho(playerid, params[])
{
  if(PlayerInfo[playerid][LoggedIn])
  {
    new Obj, Bone, Float:Xoff, Float: Yoff, Float: Zoff, Float: Xrot, Float: Yrot, Float: Zrot;
    if(sscanf(params, "iiF(Xoff)F(Yoff)F(Zoff)F(Xrot)F(Xrot)F(Xrot)", Obj, Bone, Xoff, Yoff, Zoff, Xrot, Yrot, Zrot)) return SendClientMessage(playerid, Red, "USAGE: /sho [ObjectID] [Bone ID](1-16) Optional: [X] [Y] [Z] [X Rot] [Y Rot] [Z Rot]");
    if(!IsValidObjectID(Obj)) return SendClientMessage(playerid, Red, "ERROR: That object ID is invalid, please try again!");
    if(Bone < 1 || Bone > 16) return SendClientMessage(playerid, Red, "ERROR: Bone ID's are 1 - 16.");
    if(IsPlayerHoldingObject(playerid)) // LINE 4758 <<<<<
    {
      StopPlayerHoldingObject(playerid);
    }
    SetPlayerHoldingObject(playerid, Obj, Bone, Xoff, Yoff, Zoff, Xrot, Yrot, Zrot);
    PlayerInfo[playerid][HObjID] = Obj; PlayerInfo[playerid][HObjBone] = Bone;
    PlayerInfo[playerid][HObjXoff] = Xoff; PlayerInfo[playerid][HObjYoff] = Yoff; PlayerInfo[playerid][HObjZoff] = Zoff;
    PlayerInfo[playerid][HObjXrot] = Xrot;
    PlayerInfo[playerid][HObjYrot] = Yrot;
    PlayerInfo[playerid][HObjZrot] = Zrot;
    CurrentHoldingOb[playerid] = Obj;
    SendClientMessage(playerid, COLOR_GREEN, "Object successfully placed, to remove it use /rmho!");
  }
  else
  {
    SendClientMessage(playerid, Red, "ERROR: You need to login to use this command!");
  }
  return 1;
}
This happens on all lines that contain IsPlayerHoldingObject. Any ideas?
Regards.
Re: IsPlayerHoldingObject macro help - [03]Garsino - 28.11.2010
pawn Код:
#define SetPlayerHoldingObject(%1,%2,%3,%4,%5,%6,%7,%8,%9) SetPlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJECTS-1,%2,%3,%4,%5,%6,%7,%8,%9)
#define StopPlayerHoldingObject(%1) RemovePlayerAttachedObject(%1,MAX_PLAYER_ATTACHED_OBJECTS-1)
#define IsPlayerHoldingObject(%1) IsPlayerAttachedObjectSlotUsed(%1,MAX_PLAYER_ATTACHED_OBJECTS-1)
Kalcor made a typo and added a ; at the end!
Re: IsPlayerHoldingObject macro help -
PlayLSX - 28.11.2010
Haha, it's to be expected! Thankyou