AttachObjectToPlayer Problem - I really need help! :(
#1

Hello, I have this code right here:

Код:
if (strcmp(cmdtext, "/attachobjecttovehicle", true, 10) == 0)
  {
  if(IsPlayerInAnyVehicle(playerid))
  {
  new Float:pX, Float:pY, Float:pZ;
  GetPlayerPos(playerid, Float:pX, Float:pY, Float:pZ);
  new AttachableObject = CreateObject(18450, Float:pX, Float:pY, Float:pZ, 0, 0, 0);
  AttachObjectToPlayer(AttachableObject, playerid, 0.0, 0.0, -0.87, 0.0, 0.0, 90.0);
  SendClientMessage(playerid, COLOR_YELLOW, "Object Successfully Attached!");
  }
  else
  {
  SendClientMessage(playerid, COLOR_RED, "You Need To Be In A Vehicle Before Attaching An Object!");
	}
	return 1;
	}
But it works only for 1 person. So now my question: How can I make this work for all players? So if anyone types /attachobjecttovehicle (yes, it's gonna be a shorter command lol) and then another person types that in, it will work for both.

Sorry for my bad english.

Thank you!
Reply
#2

CreatePlayerObject instead of CreateObject
Reply
#3

ty
Reply
#4

it doesn't work

If I use CreatePlayerObject(blabla) then the object won't even attach and it has a different position. Also I want to make it in CreatePlayerDynamicObject(blabla) so it kinda makes me confused
Reply
#5

please I really need this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)