SA-MP Forums Archive
Need help with /usemask - 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: Need help with /usemask (/showthread.php?tid=515696)



Need help with /usemask - MarkzD - 27.05.2014

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.


Re: Need help with /usemask - rappy93 - 27.05.2014

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


Re : Need help with /usemask - S4t3K - 27.05.2014

Use SetPlayerAttachedObject instead of AttachObjectToPlayer.


Re: Need help with /usemask - MarkzD - 27.05.2014

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


Re: Need help with /usemask - MarkzD - 27.05.2014

bump


Re: Need help with /usemask - MarkzD - 30.05.2014

thank you
understood