Need help with /usemask
#1

Hello! i make for my server /usemask cmd, have problem: I created a mask with the mask is very CreateObject but not exactly worth, and generally does not move with the person need your help, I will be very grateful!

PHP код:
    if(strcmp(cmd"/usemask"true) == 0)// маска
    
{
        if(
PlayerInfo[playerid][pMask] == 1)
        {
            if(
PlayerInfo[playerid][pMaskOn] == 0)
            {
                
PlayerInfo[playerid][pMaskOn] = 1;
                for(new 
0MAX_PLAYERSi++)
                {
                    
ShowPlayerNameTagForPlayer(iplayerid0);
                }
                
SendClientMessage(playerid,COLOR_YELLOW,"Вы одели маску");
                
PlayerInfo[playerid][pMaskSkill] -= 1;
                
maska CreateObject(190381,1,1,0,0,0);
                
AttachObjectToPlayer(maskaplayerid0,0.1,0.670090 );
                if(
PlayerInfo[playerid][pMaskSkill] <= 0)
                {
                    new 
ranran random(100);
                    if(
ranran 2)
                    {
                        
SendClientMessage(playerid,COLOR_LIGHTRED,"Вы порвали маску");
                        
DestroyObject(maska);
                        
PlayerInfo[playerid][pMaskSkill] = 0;
                        
PlayerInfo[playerid][pMask] = 0;
                        
PlayerInfo[playerid][pMaskOn] = 0;
                        for(new 
0MAX_PLAYERSi++)
                        {
                            
ShowPlayerNameTagForPlayer(iplayerid1);
                        }
                    }
                }
            }
            else if(
PlayerInfo[playerid][pMaskOn] == 1)
            {
                
PlayerInfo[playerid][pMaskOn] = 0;
                for(new 
0MAX_PLAYERSi++)
                {
                for(new 
i=0i<MAX_PLAYER_ATTACHED_OBJECTSi++)
                {
                if(
IsPlayerAttachedObjectSlotUsed(playeridi)) RemovePlayerAttachedObject(playeridi);
                }
                    
ShowPlayerNameTagForPlayer(iplayerid1);
                }
                
DestroyObject(maska);
                
SendClientMessage(playerid,COLOR_YELLOW,"Вы сняли маску");
            }
        }
        else
        {
            
SendClientMessage(playerid,COLOR_GREY,"У вас нет маски");
        }
        return 
1;
    } 
Sorry for my bad english.
Reply
#2

You should use the 0.3e object editing functions. And use dynamic objects as well.
Reply
#3

Use SetPlayerAttachedObject instead of AttachObjectToPlayer.
Reply
#4

PHP код:
if(strcmp(cmd"/usemask"true) == 0)// маска
    
{
        if(
PlayerInfo[playerid][pMask] == 1)
        {
            if(
PlayerInfo[playerid][pMaskOn] == 0)
            {
                
PlayerInfo[playerid][pMaskOn] = 1;
                for(new 
0MAX_PLAYERSi++)
                {
                    
ShowPlayerNameTagForPlayer(iplayerid0);
                }
                
SendClientMessage(playerid,COLOR_YELLOW,"Вы одели маску");
                
PlayerInfo[playerid][pMaskSkill] -= 1;
                
maska CreateDynamicObject(190381,1,1,0,0,0);
                
SetPlayerAttachedObject(playerid3maska2);
                if(
PlayerInfo[playerid][pMaskSkill] <= 0)
                {
                    new 
ranran random(100);
                    if(
ranran 2)
                    {
                        
SendClientMessage(playerid,COLOR_LIGHTRED,"Вы порвали маску");
                        
DestroyObject(maska);
                        
PlayerInfo[playerid][pMaskSkill] = 0;
                        
PlayerInfo[playerid][pMask] = 0;
                        
PlayerInfo[playerid][pMaskOn] = 0;
                        for(new 
0MAX_PLAYERSi++)
                        {
                            
ShowPlayerNameTagForPlayer(iplayerid1);
                        }
                    }
                }
            }
            else if(
PlayerInfo[playerid][pMaskOn] == 1)
            {
                
PlayerInfo[playerid][pMaskOn] = 0;
                for(new 
0MAX_PLAYERSi++)
                {
                for(new 
i=0i<MAX_PLAYER_ATTACHED_OBJECTSi++)
                {
                if(
IsPlayerAttachedObjectSlotUsed(playeridi)) RemovePlayerAttachedObject(playeridi);
                }
                    
ShowPlayerNameTagForPlayer(iplayerid1);
                }
                
DestroyObject(maska);
                
SendClientMessage(playerid,COLOR_YELLOW,"Вы сняли маску");
            }
        }
        else
        {
            
SendClientMessage(playerid,COLOR_GREY,"У вас нет маски");
        }
        return 
1;
    } 
not working, mask after 1 sec just lost
Reply
#5

bump
Reply
#6

thank you
understood
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)