Mask Problem
#1

look i want to type /mask to put hitmans mask on/off...i cant make it..work properly please help +REP!

PHP код:
if (strcmp(cmd"/mask"true) == 0)
                    {
                    if(
PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
                    {
                    if(
PlayerInfo[playerid][pMaskuse] == 1)
                    {
                    for(new 
0MAX_PLAYERSi++)
                       {
                       
ShowPlayerNameTagForPlayer(iplayerid0);
                    
PlayerInfo[playerid][pMaskuse] = 1;
                    
SendClientMessage(playeridCOLOR_WHITE"   Ti-ai pus masca!");
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    }
                    else
                    {
                    
ShowPlayerNameTagForPlayer(i,playerid1);
                    
PlayerInfo[playerid][pMaskuse] = 0;
                    
SendClientMessage(playeridCOLOR_WHITE"Ti-ai dat jos masca!");
                    
GetPlayerName(playeridsendernamesizeof(sendername));
                    }
                    }
                    }
                    else
                    {
                    
SendClientMessage(playeridCOLOR_GRAD2"   Nu esti Hitman !");
                    return 
1;
                    }
                    } 
Reply
#2

u dont get any errors?
Reply
#3

no.errors.just doesent work..please help me fix it!
Reply
#4

Maybe put
pawn Код:
return 0;
Down
Reply
#5

Give this a shot.
pawn Код:
if(strcmp(cmdtext, "/mask", true) == 0)
{
    if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
    {
        if(PlayerInfo[playerid][pMaskuse] == 1)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    ShowPlayerNameTagForPlayer(i, playerid, 0);
                }
            }
            PlayerInfo[playerid][pMaskuse] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "   Ti-ai pus masca!");
        }
        else
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    ShowPlayerNameTagForPlayer(i,playerid, 1);
                }
            }
            PlayerInfo[playerid][pMaskuse] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "Ti-ai dat jos masca!");
        }
    }
    else return SendClientMessage(playerid, COLOR_GRAD2, "   Nu esti Hitman !");
    return 1;
}
You were not closing the loop, and it would have caused a few spamming errors and others.
Reply
#6

you must use OnPlayerStreamIn too.

Use this:

pawn Код:
public OnPlayerStreamIn(playerid, forplayerid)
{
    if(PlayerInfo[playerid][pMaskuse] >= 1)
    {
        ShowPlayerNameTagForPlayer(forplayerid, playerid, false);
    }
    return 1;
}
Reply
#7

I suggest this: https://sampforum.blast.hk/showthread.php?tid=327607
Reply
#8

Quote:
Originally Posted by clarencecuzz
Посмотреть сообщение
Give this a shot.
pawn Код:
if(strcmp(cmdtext, "/mask", true) == 0)
{
    if(PlayerInfo[playerid][pMember] == 13 || PlayerInfo[playerid][pLeader] == 13)
    {
        if(PlayerInfo[playerid][pMaskuse] == 1)
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    ShowPlayerNameTagForPlayer(i, playerid, 0);
                }
            }
            PlayerInfo[playerid][pMaskuse] = 1;
            SendClientMessage(playerid, COLOR_WHITE, "   Ti-ai pus masca!");
        }
        else
        {
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
                    ShowPlayerNameTagForPlayer(i,playerid, 1);
                }
            }
            PlayerInfo[playerid][pMaskuse] = 0;
            SendClientMessage(playerid, COLOR_WHITE, "Ti-ai dat jos masca!");
        }
    }
    else return SendClientMessage(playerid, COLOR_GRAD2, "   Nu esti Hitman !");
    return 1;
}
You were not closing the loop, and it would have caused a few spamming errors and others.
only a thing happens it just takes off mask..doesent put it on..

PHP код:
PlayerInfo[playerid][pMaskuse] = 0;
SendClientMessage(playeridCOLOR_WHITE"Ti-ai dat jos masca!"); 
only this works..
Reply
#9

Try This ;


PHP код:
    if(strcmp(cmd"/maskon"true) == 0
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pMask] == 0)
                {
                    
SendClientMessage(playeridCOLOR_GRAD1"** You don't have a mask");
                    return 
1;
               }
               if(
PlayerInfo[playerid][pLevel] < 5)
            {
                   
SendClientMessage(playeridCOLOR_GRAD1"** You are not able to use it.");
                return 
1;
            }
            for(new 
0MAX_PLAYERSi++)
               {
                   if(
IsPlayerConnected(i))
                   {
                       
ShowPlayerNameTagForPlayer(iplayerid0);
                }
            }
            
PlayerInfo[playerid][pMaskuse] = 1;
            
SendClientMessage(playeridCOLOR_WHITE"** You have put your mask on [/maskoff to put it away].");
              
format(stringsizeof(string), "* %s puts a mask on."sendername);
              
ProxDetector(30.0playeridstringCOLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
              new 
ymd;
            new 
h,mi,s;
            
getdate(y,m,d);
            
gettime(h,mi,s);
            
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /maskon",d,m,y,h,mi,s,sendername);
            
CommandLog(string);
        }
        return 
1;
    }
    if(
strcmp(cmd"/maskoff"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pMask] == 0)
            {
                   
SendClientMessage(playeridCOLOR_GRAD1"   You don't have a mask");
                return 
1;
            }
            if(
PlayerInfo[playerid][pLevel] < 5)
            {
                
SendClientMessage(playeridCOLOR_GRAD1"   You are not able to use it.");
                return 
1;
            }
            for(new 
0MAX_PLAYERSi++)
               {
                   if(
IsPlayerConnected(i))
                   {
                       
ShowPlayerNameTagForPlayer(iplayerid1);
                }
            }
            
PlayerInfo[playerid][pMaskuse] = 0;
            
PlayerInfo[playerid][pMaskReplacement] = 0;
            
SendClientMessage(playeridCOLOR_WHITE"HINT:[/maskon to use your mask!].");
            
GameTextForPlayer(playerid,"You have removed your mask!",5000,5);
              
format(stringsizeof(string), "* %s puts a mask away."sendername);
              
ProxDetector(30.0playeridstringCOLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
              new 
ymd;
            new 
h,mi,s;
            
getdate(y,m,d);
            
gettime(h,mi,s);
            
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /maskoff",d,m,y,h,mi,s,sendername);
            
CommandLog(string);
        }
        return 
1;
    } 
And For The Mask Off ;


PHP код:
    if(strcmp(cmd"/maskoff"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pMask] == 0)
            {
                   
SendClientMessage(playeridCOLOR_GRAD1"   You don't have a mask");
                return 
1;
            }
            if(
PlayerInfo[playerid][pLevel] < 5)
            {
                
SendClientMessage(playeridCOLOR_GRAD1"   You are not able to use it.");
                return 
1;
            }
            for(new 
0MAX_PLAYERSi++)
               {
                   if(
IsPlayerConnected(i))
                   {
                       
ShowPlayerNameTagForPlayer(iplayerid1);
                }
            }
            
PlayerInfo[playerid][pMaskuse] = 0;
            
PlayerInfo[playerid][pMaskReplacement] = 0;
            
SendClientMessage(playeridCOLOR_WHITE"HINT:[/maskon to use your mask!].");
            
GameTextForPlayer(playerid,"You have removed your mask!",5000,5);
              
format(stringsizeof(string), "* %s puts a mask away."sendername);
              
ProxDetector(30.0playeridstringCOLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
              new 
ymd;
            new 
h,mi,s;
            
getdate(y,m,d);
            
gettime(h,mi,s);
            
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /maskoff",d,m,y,h,mi,s,sendername);
            
CommandLog(string);
        }
        return 
1;
    } 
Reply
#10

i want with /mask.to put on mask and take it off..( theres no way..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)