SA-MP Forums Archive
Adding A Line - 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: Adding A Line (/showthread.php?tid=443188)



Adding A Line - AchievementMaster360 - 10.06.2013

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;
}



Re: Adding A Line - -CaRRoT - 10.06.2013

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;




Re: Adding A Line - AchievementMaster360 - 10.06.2013

Thanks