YCMD:pickupcrate(playerid, params[], help)
{
#pragma unused help
new Float:x, Float:y, Float:z;
for(new i; i<=sizeof(crate); i++)
{
GetObjectPos(crate[i], x, y, z); //gets position of every crate
if(PlayerToPoint(1, playerid, x, y, z))//any crate???
{
//picking up that crate
ApplyAnimation(playerid, "CARRY", "liftup", 4.0, 0, 1, 1, 1, 1);
SetTimerEx("PokupioKutiju", 1000, false, "i", playerid);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
}else SendClientMessage(playerid, COLOR_WHITE, "You are not close enough to any crate".);
}
return 1;
}
forward PokupioKutiju(playerid);
public PokupioKutiju(playerid)
{
SetPlayerAttachedObject(playerid, 0, 3014, 6, 0.095999, 0.251999, -0.146999, -116.199989, -20.900005, 79.199981);
//DestroyObject(crate[i]); // how to work with this ???
ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 1, 1, 1, 1, 1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
return 1;
}
YCMD:leavecrate(playerid, params[], help)
{
#pragma unused help
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid, px, py, pz);
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++){if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);}
ApplyAnimation(playerid, "CARRY", "putdwn", 4.0, 0, 1, 0, 1, 1);
SetTimerEx("SpustioKutiju", 1000, false, "i", playerid); //this timer only clear animations
crate[i] = CreateObject(3014, px, py, pz-0.80, 0.00000, 0.00000, 0); //???
SetObjectPos(crate01, px, py, pz-0.80);
return 1;
}
crates[5]
crates[0]
crates[1]
crates[2]
crates[3]
crates[4]
crates[5]
I don't know anything about the crates, But the array:
PHP Code:
PHP Code:
|
forward PokupioKutiju(playerid, crateid);
public PokupioKutiju(playerid, crateid)
{
SetPlayerAttachedObject(playerid, 0, 3014, 6, 0.095999, 0.251999, -0.146999, -116.199989, -20.900005, 79.199981);
//DestroyObject(crate[crateid]); // how to work with this ???
ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 1, 1, 1, 1, 1);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CARRY);
return 1;
}
SetTimerEx("PokupioKutiju", 1000, false, "ii", playerid, i);