27.01.2015, 18:40
Hi.
It works only for leatest created object. Why?
It works only for leatest created object. Why?
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { if(newkeys == KEY_ANALOG_LEFT) { if(!carry) { new Float:x, Float:y, Float:z; GetObjectPos(crate, x, y, z); if(IsPlayerInRangeOfPoint(playerid, 1.5, x, y, z)) { ApplyAnimation(playerid, "CARRY", "liftup", 4.1, 0, 1, 1, 0, 0, 1); SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY); DestroyObject(crate); SetPlayerAttachedObject(playerid,0,2358,5,0.091000,0.125999,0.180000,-76.000015,0.000000,100.000000); carry = true; } }else if(carry) { ApplyAnimation(playerid, "CARRY", "putdwn", 4.1, 0, 1, 1, 0, 0, 1); SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE); RemovePlayerAttachedObject(playerid, 0); new Float:x, Float:y, Float:z, Float:angle; GetPointInAngleOfPlayer(playerid, x, y, z, 0.8, 0.0); GetPlayerFacingAngle(playerid, angle); crate = CreateObject(2358, x, y, z-0.85, 0.0, 0.0, angle); carry = false; } } return 1; }