[HELP] Attachobject
#1

Hello guys im making simple command for player so when player do

/Appeler he will get a call to someone and he will get a attachobject phone on his hand

the probleme is how to add it on the Hand :/

this is Code

Код:
if(strcmp(cmd, "/appeler", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /appeler [Numero]");
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /numero (ID du Joueur)");
				return 1;
			}
			if(PlayerInfo[playerid][pPnumber] == 0)
			{
				SendClientMessage(playerid, COLOR_GRAD2, "  Nophone !");
				return 1;
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "* %s blablabla.", sendername);
			SetPlayerAttachedObject(playerid, 6, 18865, 2, 0.120000, 0.040000, -0.003500, 0, 100, 100, 1.4, 1.4, 1.4);
and when he Hungup /rac the Object Destroy how to destroy it

CODE

Код:
if(strcmp(cmd, "/rac", true) == 0 || strcmp(cmd, " ", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
		{
			new caller = Mobile[playerid];
			if(IsPlayerConnected(caller))
			{
			    if(caller != INVALID_PLAYER_ID)
			    {
					if(caller != 255)
					{
						if(caller < 255)
						{
							SendClientMessage(caller,  COLOR_GRAD2, "	hungup.");
							CellTime[caller] = 0;
							CellTime[playerid] = 0;
							SendClientMessage(playerid,  COLOR_GRAD2, "	Ihungup.");
							Mobile[caller] = 255;
						}
						Mobile[playerid] = 255;
						CellTime[playerid] = 0;
						RingTone[playerid] = 0;
						PlayerInfo[playerid][pSpeaker] = 0;
						UnidentifedCall[playerid] = 0;
					}
				}
			}
			SendClientMessage(playerid,  COLOR_GRAD2, "   takes out the phone.");
			SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
		}
		return 1;
	}
Reply
#2

Quote:
Originally Posted by BigBaws
Посмотреть сообщение
Hello guys im making simple command for player so when player do

/Appeler he will get a call to someone and he will get a attachobject phone on his hand

the probleme is how to add it on the Hand :/

-code-

and when he Hungup /rac the Object Destroy how to destroy it

-code-
pawn Код:
SetPlayerAttachedObject(playerid, index, modelid, bone, Float:fOffsetX, Float:fOffsetY, Float:fOffsetZ, Float:fRotX, Float:fRotY, Float:fRotZ, Float:fScaleX, Float:fScaleY, Float:fScaleZ)
4th parameter: bone

Right hand: 6
Left hand: 5
https://sampwiki.blast.hk/wiki/Bone_IDs

to destroy:
pawn Код:
if(IsPlayerAttachedObjectSlotUsed(playerid, 0)) RemovePlayerAttachedObject(playerid, 0);
where 0 is the 2nd parameter you used in SetPlayerAttachedObject => in your case: 6

(for information: you can attach up to 10 objects: index(=slot) 0-9)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)