Hallo,
ich möchte es so machen wenn man in der nähe des Automaten ist das man F drückt leben bekommt und dann eine Animation kommt.
#include <a_samp>
#define MAX_MACHINES 10 // CHANGE IF YOU'RE USING A STREAMER AND WILLING TO ADD MORE
#define MACHINE_CASH 5 // Cost - Default is $1
//**VARIABLES**//
enum fMachines
{
Float:fmX,
Float:fmY,
Float:fmZ,
fmType
};
new FoodMachines[MAX_MACHINES][fMachines];
new Machine = 1;
new SprunkMachine[MAX_MACHINES];
new CandyMachine[MAX_MACHINES];
new Anim[200];
//**FORWARDS**//
forward MachineAnimation(playerid);
/*x---------------------------------CallBacks-------------------------------------x*/
stock Seif_PlayerToPoint(playerid,Float:radi, Float:px, Float:py, Float:pz)
{
if(IsPlayerConnected(playerid))
{
new Float:x, Float:y, Float:z;
new Float:ox, Float:oy, Float:oz;
GetPlayerPos(playerid, ox, oy, oz);
x = (ox -px);
y = (oy -py);
z = (oz -pz);
if (((x < radi) && (x > -radi)) && ((y < radi) && (y > -radi)) && ((z < radi) && (z > -radi))) return 1;
}
return 0;
}
AddSprunkMachine(Float:X,Float:Y,Float:Z,Float:rX,Float:rY,Float:rZ)
{
Machine++;
SprunkMachine[Machine] = CreateObject(955,X,Y,Z,rX,rY,rZ);
FoodMachines[Machine][fmX] = X;
FoodMachines[Machine][fmY] = Y;
FoodMachines[Machine][fmZ] = Z;
FoodMachines[Machine][fmType] = 1;
}
AddCandyMachine(Float:X,Float:Y,Float:Z,Float:rX,Float:rY,Float:rZ)
{
Machine++;
CandyMachine[Machine] = CreateObject(956,X,Y,Z,rX,rY,rZ);
FoodMachines[Machine][fmX] = X;
FoodMachines[Machine][fmY] = Y;
FoodMachines[Machine][fmZ] = Z;
FoodMachines[Machine][fmType] = 2;
}
public MachineAnimation(playerid)
{
if (Anim[playerid] == 1) ApplyAnimation(playerid,"VENDING","VEND_Drink2_P",4.1,0,1,1,1,1), Anim[playerid] = 0 ,SetTimerEx("MachineAnimation",1000,0,"d",playerid);
else if (Anim[playerid] == 2) ApplyAnimation(playerid,"VENDING","VEND_Eat_P",4.1,0,1,1,1,1), Anim[playerid] = 0, SetTimerEx("MachineAnimation",1000,0,"d",playerid);
else if (Anim[playerid] == 0) ApplyAnimation(playerid, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0);
return 1;
}