Well, I figured it out but I have another problem. When I do /dropstretcher, my character appears on top of the stretcher. Is there a way to get a position of an attached object? When I tried it, my stretchers spawned at the place I took them. How to make it that my stretchers always spawn on the right side from my character and how to make it that when a player gets removed from vehicle that he spawns at the back of the ambulance?
pawn Код:
CMD:stretcher(playerid)
{
new Float:X, Float:Y, Float:Z, Float:R;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, R);
Stretcher[playerid] = CreateObject(2146, X, Y, Z, 0, 0, R, 100.0);
AttachObjectToPlayer(Stretcher[playerid], playerid, 0.00, 1.30, -0.50, 0.0, 0.0, 0.0 );
UsingStretcher[playerid] = 1;
return 1;
}
CMD:dropstretcher(playerid)
{
new Float:X, Float:Y, Float:Z, Float:R;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, R);
DestroyObject(Stretcher[playerid]);
Stretcher[playerid] = CreateObject(2146, X, Y, Z - 0.60, 0, 0, R, 100.0);
UsingStretcher[playerid] = 0;
return 1;
}
CMD:pickupstretcher(playerid)
{
new Float:X, Float:Y, Float:Z;
GetObjectPos(Stretcher[playerid], X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 5.0, X, Y, Z) && UsingStretcher[playerid] == 0)
{
AttachObjectToPlayer(Stretcher[playerid], playerid, 0.00, 1.30, -0.50, 0.0, 0.0, 0.0 );
UsingStretcher[playerid] = 1;
return 1;
}
else return SendClientMessage(playerid,0xFFFFFFFF,"ERROR: You are not near a stretcher or you are using it.");
}