enum CPInfo
{
Float:CPX,
Float:CPY,
Float:CPZ,
ActorID,
Float:ActorX,
Float:ActorY,
Float:ActorZ,
ActorSkin,
ActorVW
};
new Float:CheckPoint[][CPInfo] =
{
{CPX, CPY, CPZ, ActorID, ActorX, ActorY, ActorZ, ActorSkin, ActorVW}//You can add more
};
CMD:test(playerid, params[])
{
new CPPos[3], ActorPos[4], actorskin, AID;
new randomcp = random(sizeof(Checkpoint));
CPPos[0] = CheckPoint[randomcp][CPX];
CPPos[1] = CheckPoint[randomcp][CPY];
CPPos[2] = CheckPoint[randomcp][CPZ];
//Actor
AID = CheckPoint[randomcp][ActorID];
actorskin = CheckPoint[randomcp][ActorSkin];
ActorPos[0] = CheckPoint[randomcp][ActorX];
ActorPos[1] = CheckPoint[randomcp][ActorY];
ActorPos[2] = CheckPoint[randomcp][ActorZ];
ActorPos[3] = CheckPoint[randomcp][ActorVW];
CreatePlayerCheckpoint(playerid, CPPos[0], CPPos[1], CPPos[2], 5.0);
AID = CreateActor(actorskin, ActorPos[0], ActorPos[1], ActorPos[2], 0.0);
SetActorVirtualWorld(AID, ActorPos[3]);
return;
}
Take this as example
PHP код:
|
https://sampforum.blast.hk/showthread.php?tid=460467
i think this will help you. |
new Actor[MAX_PLAYERS];
enum CPInfo
{
Float:CPX,
Float:CPY,
Float:CPZ,
Float:ActorX,
Float:ActorY,
Float:ActorZ,
ActorSkin,
ActorVW
};
new Float:CheckPoint[][CPInfo] =
{
{CPX, CPY, CPZ, ActorX, ActorY, ActorZ, ActorSkin, ActorVW}//You can add more
};
CMD:test(playerid, params[])
{
new CPPos[3], ActorPos[4], actorskin;
new randomcp = random(sizeof(Checkpoint));
CPPos[0] = CheckPoint[randomcp][CPX];
CPPos[1] = CheckPoint[randomcp][CPY];
CPPos[2] = CheckPoint[randomcp][CPZ];
//Actor
actorskin = CheckPoint[randomcp][ActorSkin];
ActorPos[0] = CheckPoint[randomcp][ActorX];
ActorPos[1] = CheckPoint[randomcp][ActorY];
ActorPos[2] = CheckPoint[randomcp][ActorZ];
ActorPos[3] = CheckPoint[randomcp][ActorVW];
CreatePlayerCheckpoint(playerid, CPPos[0], CPPos[1], CPPos[2], 5.0);
Actor[playerid] = CreateActor(actorskin, ActorPos[0], ActorPos[1], ActorPos[2], 0.0);
ApplyActorAnimation(Actor[playerid], "FOOD", "FF_Sit_Eat3", 4.0, 1, 0, 0, 0, 0, 1);
SetActorVirtualWorld(Actor[playerid], ActorPos[3]);
return 1;
}