Help with actors
#1

Hello, I tried to make "/createactor" & "/deleteactor" commands, but "/deleteactor" isn't deleting right, I can create like 4 actors, and delete only 1 or 2 randomly.. please help

PHP код:
enum Actor
{
    
Float:aX,
    
Float:aY,
    
Float:aZ,
    
aID,
    
aSkin,
    
Text3D:aString
};
new 
ActorData[MAX_ACTORS][Actor];
new 
Actor_ID
PHP код:
CMD:createactor(playeridparams[])
{
    if(
IsPlayerAnAdmin(playerid,3))
    {
        new 
modelid,string[200],Float:pos[4];
        if(!
sscanf(params"i"modelid))
        {
            
GetPlayerPos(playerid,pos[0],pos[1],pos[2]);
            
GetPlayerFacingAngle(playerid,pos[3]);
            
ActorData[Actor_ID][aID] = CreateActor(modelid,pos[0],pos[1]+0.5,pos[2],pos[3]);
            
SetActorInvulnerable(ActorData[Actor_ID][aID], false);
            
SetActorHealth(ActorData[Actor_ID][aID], 100);
            
format(stringsizeof(string), "ACTOR ID: %d and SKIN ID: %d",Actor_ID,modelid);
            
ActorData[Actor_ID][aString] = CreateDynamic3DTextLabel(string,ORANGE,pos[0],pos[1],pos[2],20,-1,0);
            
format(stringsizeof(string), "Actor created, SKIN ID: %d and ID: %d",modelid,Actor_ID); SCM(playerid,GREEN,string);
            
Actor_ID++;
        }
        else 
SCM(playerid,RED,"[INFO]: /createactor <skin>");
    }
    else 
SCM(playerid,RED,">> You are not an admin!");
    return 
1;

PHP код:
CMD:deleteactor(playeridparams[])
{
    if(
IsPlayerAnAdmin(playerid,3))
    {
        new 
string[200];
        if(!
sscanf(params"u"Actor_ID))
        {
            if(
Actor_ID != INVALID_ACTOR_ID)
            {
                
DestroyActor(ActorData[Actor_ID][aID]);
                
DestroyDynamic3DTextLabel(ActorData[Actor_ID][aString]);
                
format(stringsizeof(string), "Actor deleted.. (ACTOR ID: %d)",ActorData[Actor_ID][aID]);
                
SCM(playerid,GREEN,string);
                
Actor_ID--;
            }
            else 
SCM(playerid,RED,">> Bad actor ID!");
        }
        else 
SCM(playerid,RED,"[INFO]: /deleteactor <ID>");
    }
    else 
SCM(playerid,RED,">> You are not an admin!");
    return 
1;

Reply


Messages In This Thread
Help with actors - by TayFunCZE - 15.08.2016, 07:11
Re: Help with actors - by oliverrud - 15.08.2016, 10:27
Re: Help with actors - by Stinged - 15.08.2016, 11:58

Forum Jump:


Users browsing this thread: 1 Guest(s)