SA-MP Forums Archive
Litle Question ! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Litle Question ! (/showthread.php?tid=621143)



Litle Question ! - TYDS - 07.11.2016

Hello guys i have a question want to ask !
- How can i make this , when type cmd /test it's will show a random checkpoint and in this random checkpoint appear a actor with some animation. means /test > random checkpoint appear in 5 location i create and appear actor in this random checkpoint to > done !


Re: Litle Question ! - Hansrutger - 07.11.2016

****** these terms:
- samp scripting random
- samp zcmd
- samp setplayercheckpoint
- samp actor

I can confirm that I tested the search terms and they worked!


Re: Litle Question ! - thefirestate - 07.11.2016

Confirming as well!


Re: Litle Question ! - TYDS - 07.11.2016

i know but you don't understand my question


Re: Litle Question ! - IceBilizard - 07.11.2016

Take this as example
PHP код:
enum CPInfo
{
        
Float:CPX,
        
Float:CPY,
        
Float:CPZ,
        
ActorID,
        
Float:ActorX,
        
Float:ActorY,
        
Float:ActorZ,
        
ActorSkin,
        
ActorVW
};
new 
Float:CheckPoint[][CPInfo] =
{
    {
CPXCPYCPZActorIDActorXActorYActorZActorSkinActorVW}//You can add more
};
CMD:test(playeridparams[])
{
    new 
CPPos[3], ActorPos[4], actorskinAID;
    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(playeridCPPos[0], CPPos[1], CPPos[2], 5.0);
    
AID CreateActor(actorskinActorPos[0], ActorPos[1], ActorPos[2], 0.0);
    
SetActorVirtualWorld(AIDActorPos[3]);
    return;




Re: Litle Question ! - TYDS - 07.11.2016

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
Take this as example
PHP код:
enum CPInfo
{
        
Float:CPX,
        
Float:CPY,
        
Float:CPZ,
        
ActorID,
        
Float:ActorX,
        
Float:ActorY,
        
Float:ActorZ,
        
ActorSkin,
        
ActorVW
};
new 
Float:CheckPoint[][CPInfo] =
{
    {
CPXCPYCPZActorIDActorXActorYActorZActorSkinActorVW}//You can add more
};
CMD:test(playeridparams[])
{
    new 
CPPos[3], ActorPos[4], actorskinAID;
    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(playeridCPPos[0], CPPos[1], CPPos[2], 5.0);
    
AID CreateActor(actorskinActorPos[0], ActorPos[1], ActorPos[2], 0.0);
    
SetActorVirtualWorld(AIDActorPos[3]);
    return;

how can i apply animation for the actor appear !
"FOOD", "FF_Sit_Eat3", 4.0, 1, 0, 0, 0, 0, 1);


Re: Litle Question ! - TYDS - 08.11.2016

any i deas


Re: Litle Question ! - Pearson - 08.11.2016

https://sampforum.blast.hk/showthread.php?tid=460467
i think this will help you.


Re: Litle Question ! - TYDS - 08.11.2016

Quote:
Originally Posted by Pearson
Посмотреть сообщение
thank you but my question have the actor to, the random checkpoint i can do that, but random actor with checkpoint and animation when actor appear i don't know how to do


Re: Litle Question ! - Tass007 - 08.11.2016

Basically what you need to do is create a variable that you assign to an actor once you create it. Then you need to link the position of the actor to the position of the cp. Then once you create an actor you apply the animation to the created actor. If we use IceBilizard's code it will be something like this

PHP код:
new Actor[MAX_PLAYERS];
enum CPInfo 

        
Float:CPX
        
Float:CPY
        
Float:CPZ
        
Float:ActorX
        
Float:ActorY
        
Float:ActorZ
        
ActorSkin
        
ActorVW 
}; 
new 
Float:CheckPoint[][CPInfo] = 

    {
CPXCPYCPZActorXActorYActorZActorSkinActorVW}//You can add more 
}; 
CMD:test(playeridparams[]) 

    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(playeridCPPos[0], CPPos[1], CPPos[2], 5.0); 
    
Actor[playerid] = CreateActor(actorskinActorPos[0], ActorPos[1], ActorPos[2], 0.0); 
    
ApplyActorAnimation(Actor[playerid], "FOOD""FF_Sit_Eat3"4.0100001);
    
SetActorVirtualWorld(Actor[playerid], ActorPos[3]); 
    return 
1

Hope this helps.