Mask CMD error
#1

When I compile the script I receive and error saying:
Код:
cmd_mask should return a value
Here is the code:
PHP код:
CMD:mask(playeridparams[])
{
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(!
PlayerInfo[playerid][pMask] == 1) return SendClientMessage(playeridCOLOR_GREY"You need to buy a mask from a 24/7!.");
    if(
PlayerInfo[playerid][pMasked] == 0)
    {
        
PlayerInfo[playerid][pMasked] = 1;
        
SetPlayerAttachedObject(playerid9190372104.70.090900);//You can change this however you want, use sa-mp wiki for more info, right now is HockeyMask2
        
SendClientMessage(playeridCOLOR_WHITE"You have put on a mask! (/mask to romove it)");
        for(new 
0MAX_PLAYERSi++)
        {
            
ShowPlayerNameTagForPlayer(iplayerid0); // ShowPlayerNameTagForPlayer(i, playerid, 0) hide name for all players
        
}
    }
    else
    {
        
PlayerInfo[playerid][pMasked] = 0;
        
SendClientMessage(playeridCOLOR_WHITE"You have removed your mask!"); // This is message what was send when you remove your mask
        
if(IsPlayerAttachedObjectSlotUsed(playerid9))
        {
            
RemovePlayerAttachedObject(playerid9);
            {
                for(new 
0MAX_PLAYERSi++)
                {
                    
ShowPlayerNameTagForPlayer(iplayerid1); // ShowPlayerNameTagForPlayer(i, playerid, 1) show name back.
                
}
            }
            return 
1;
        }
    }

Reply
#2

You must use a return true to finish the CMD!

pawn Код:
CMD:mask(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pMask] == 1) return SendClientMessage(playerid, COLOR_GREY, "You need to buy a mask from a 24/7!.");
    if(PlayerInfo[playerid][pMasked] == 0)
    {
        PlayerInfo[playerid][pMasked] = 1;
        SetPlayerAttachedObject(playerid, 9, 19037, 2, 10, 4.7, 0.0, 90, 90, 0);//You can change this however you want, use sa-mp wiki for more info, right now is HockeyMask2
        SendClientMessage(playerid, COLOR_WHITE, "You have put on a mask! (/mask to romove it)");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            ShowPlayerNameTagForPlayer(i, playerid, 0); // ShowPlayerNameTagForPlayer(i, playerid, 0) hide name for all players
        }
    }
    else
    {
        PlayerInfo[playerid][pMasked] = 0;
        SendClientMessage(playerid, COLOR_WHITE, "You have removed your mask!"); // This is message what was send when you remove your mask
        if(IsPlayerAttachedObjectSlotUsed(playerid, 9))
        {
            RemovePlayerAttachedObject(playerid, 9);
            {
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    ShowPlayerNameTagForPlayer(i, playerid, 1); // ShowPlayerNameTagForPlayer(i, playerid, 1) show name back.
                }
            }
            return 1;
        }
    }
    return 1;
}
Reply
#3

do it like this
pawn Код:
CMD:mask(playerid, params[])
{
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!PlayerInfo[playerid][pMask] == 1) return SendClientMessage(playerid, COLOR_GREY, "You need to buy a mask from a 24/7!.");
    if(PlayerInfo[playerid][pMasked] == 0)
    {
        PlayerInfo[playerid][pMasked] = 1;
        SetPlayerAttachedObject(playerid, 9, 19037, 2, 10, 4.7, 0.0, 90, 90, 0);//You can change this however you want, use sa-mp wiki for more info, right now is HockeyMask2
        SendClientMessage(playerid, COLOR_WHITE, "You have put on a mask! (/mask to romove it)");
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            ShowPlayerNameTagForPlayer(i, playerid, 0); // ShowPlayerNameTagForPlayer(i, playerid, 0) hide name for all players
        }
    }
    else
    {
        PlayerInfo[playerid][pMasked] = 0;
        SendClientMessage(playerid, COLOR_WHITE, "You have removed your mask!"); // This is message what was send when you remove your mask
        if(IsPlayerAttachedObjectSlotUsed(playerid, 9))
        {
            RemovePlayerAttachedObject(playerid, 9);
            {
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    ShowPlayerNameTagForPlayer(i, playerid, 1); // ShowPlayerNameTagForPlayer(i, playerid, 1) show name back.
                }
            }
            return 1;
        }
    }
    return 1;
}
EDIT: @Guy Above Me - Y U NO LET ME ANSWER FIRST lol
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)