Adding A Line
#1

So I'm trying to add this line to this command
Код:
if(GetPlayerSkin(playerid) == 285)
but every time i do it the pawno gives me a bunch of errors how would i do it? Any help in how to add it and if you don't have this skin it doesn't let you use it and it sends a message?

Код:
CMD:mask(playerid, params[])
{
	new name[MAX_PLAYER_NAME];
	new string[42];
	if(PlayerInfo[playerid][pMask] == 0)
	{
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
			ShowPlayerNameTagForPlayer(i, playerid, 0);
			}
		}
		PlayerInfo[playerid][pMask] = 1;
		GetPlayerName(playerid, name, sizeof(name));
		format(string, sizeof(string), "* %s has put a mask on.", name);
		ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	}
	else if(PlayerInfo[playerid][pMask] == 1)
	{
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				ShowPlayerNameTagForPlayer(i, playerid, 1);
			}
		}
		PlayerInfo[playerid][pMask] = 0;
		GetPlayerName(playerid, name, sizeof(name));
		format(string, sizeof(string), "* %s has put their mask away.", name);
		ProxDetector(15.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	}
	return 1;
}
Reply
#2

PHP код:
CMD:mask(playeridparams[])
{
    new 
name[MAX_PLAYER_NAME];
    new 
string[42];
    if(
PlayerInfo[playerid][pMask] == 0)
    {
        for(new 
0MAX_PLAYERSi++)
        {
            if(
GetPlayerSkin(playerid) == 285)
            {
                if(
IsPlayerConnected(i))
                {
                
ShowPlayerNameTagForPlayer(iplayerid0);
                }
            }
        }
        
PlayerInfo[playerid][pMask] = 1;
        
GetPlayerName(playeridnamesizeof(name));
        
format(stringsizeof(string), "* %s has put a mask on."name);
        
ProxDetector(15.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    else if(
PlayerInfo[playerid][pMask] == 1)
    {
        for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
            {
                
ShowPlayerNameTagForPlayer(iplayerid1);
            }
        }
        
PlayerInfo[playerid][pMask] = 0;
        
GetPlayerName(playeridnamesizeof(name));
        
format(stringsizeof(string), "* %s has put their mask away."name);
        
ProxDetector(15.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    return 
1;

Here you go.


EDIT : - With the message.

PHP код:
CMD:mask(playeridparams[])
{
    new 
name[MAX_PLAYER_NAME];
    new 
string[42];
    if(
PlayerInfo[playerid][pMask] == 0)
    {
        for(new 
0MAX_PLAYERSi++)
        {
            if(
GetPlayerSkin(playerid) != 285)
            {
                return 
SendClientMessage(playeridCOLOR_WHITE,"You don't have the right skin to use this command.");
                }
                if(
IsPlayerConnected(i))
                {
                
ShowPlayerNameTagForPlayer(iplayerid0);
                }
        }
        
PlayerInfo[playerid][pMask] = 1;
        
GetPlayerName(playeridnamesizeof(name));
        
format(stringsizeof(string), "* %s has put a mask on."name);
        
ProxDetector(15.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    else if(
PlayerInfo[playerid][pMask] == 1)
    {
        for(new 
0MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i))
            {
                
ShowPlayerNameTagForPlayer(iplayerid1);
            }
        }
        
PlayerInfo[playerid][pMask] = 0;
        
GetPlayerName(playeridnamesizeof(name));
        
format(stringsizeof(string), "* %s has put their mask away."name);
        
ProxDetector(15.0playeridstringCOLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    }
    return 
1;

Reply
#3

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)