SA-MP Forums Archive
/setcolour for VIPs only help - 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: /setcolour for VIPs only help (/showthread.php?tid=461874)



/setcolour for VIPs only help - Ponii - 03.09.2013

Hi i want to make this command to be set for them only. For example they cant set anyone's name colour except themselves.

so far i got this
Код:
CMD:/dcolor(playerid, params[])
{
        if(PlayerInfo[playerid][dRank] >= 1) {

			SendClientMessage(playerid, red, "USAGE: /dcolour [yourID] [Colour]");
			return SendClientMessage(playerid, red, "Colours: 0=black 1=white 2=red 3=orange 4=yellow 5=green 6=blue 7=purple 8=brown 9=pink");
		} else return SendClientMessage(playerid,red,"ERROR: You need to be atleast Donor level 2 to use this command");
			format(string, sizeof(string), "You have set your colour to '%s' ",  colour);



Re : /setcolour for VIPs only help - Matnix - 04.09.2013

I'm not a big fan of ZCMD, try this one :
pawn Код:
CMD:dcolor(playerid, params[])
{
    if(PlayerInfo[playerid][dRank] >= 1)
    {
        if(isnull(params))
        {
            SendClientMessage(playerid, COLOR,"USAGE: /setcolor <0 - 9>");
            SendClientMessage(playerid, COLOR,"blabla");
        }
//
        if(!strcmp(params, "0", true)) // if he have 0 after /dcolor 0
        {
            SetPlayerColor(playerid, COLOR);
            SendClientMessage(playerid, COLOR, "white");
            return 1;
        }
        // do like the 1 one
    }
    else
    {
        SendClientMessage(playerid,red,"ERROR: You need to be atleast Donor level 2 to use this command");
    }
    return 1;
}



Re: /setcolour for VIPs only help - Tomer!.$ - 04.09.2013

There you go.
PHP код:
CMD:dcolor(playeridparams[])
{
    if(
PlayerInfo[playerid][dRank] < 1) return SendClientMessage(playeridred"[Error] You are not authorised to use this command.");
    else
    {
        new 
string[84],
            
id,
            
color,
            
name[MAX_PLAYER_NAME+1];
        if(
sscanf(params"ud"idcolor))
        {
            
SendClientMessage(playeridred"[Usage] /dcolor [Player ID] [Color ID]");
            
SendClientMessage(playeridwhite"[Info] Colours: 0=black 1=white 2=red 3=orange 4=yellow 5=green 6=blue 7=purple 8=brown 9=pink");
            return 
1;
        }
        
GetPlayerName(idnamesizeof(name));
        
format(stringsizeof(string), "[SUCCESS] You have set %s's color to %d."namecolor);
        
SendClientMessage(playeridwhitestring);
        
SetPlayerColor(idcolor);
    }
    return 
1;




Re: /setcolour for VIPs only help - Tomer!.$ - 04.09.2013

Oops, I didn't get you right.
I thought you wanted him to be able to set everyone's color, so that's what the command I posted above does.

But here you go, I made you a new command, using this he will only be able to set his own color.
PHP код:
CMD:dcolor(playeridparams[])
{
    if(
PlayerInfo[playerid][dRank] < 1) return SendClientMessage(playeridred"[Error] You are not authorised to use this command.");
    else
    {
        new 
string[84],
            
color;
        if(
sscanf(params"d"color))
        {
            
SendClientMessage(playeridwhite"[Usage] /dcolor [Color ID]");
            
SendClientMessage(playeridwhite"[Info] Colours: 0=black 1=white 2=red 3=orange 4=yellow 5=green 6=blue 7=purple 8=brown 9=pink");
            return 
1;
        }
        
format(stringsizeof(string), "[SUCCESS] You set your color to %d."color);
        
SendClientMessage(playeridwhitestring);
        
SetPlayerColor(playeridcolor);
    }
    return 
1;




Re: /setcolour for VIPs only help - Ponii - 07.09.2013

The color has no function.


Re: /setcolour for VIPs only help - Konstantinos - 07.09.2013

Quote:
Originally Posted by Tomer!.$
Посмотреть сообщение
Oops, I didn't get you right.
I thought you wanted him to be able to set everyone's color, so that's what the command I posted above does.

But here you go, I made you a new command, using this he will only be able to set his own color.
PHP код:
CMD:dcolor(playeridparams[])
{
    if(
PlayerInfo[playerid][dRank] < 1) return SendClientMessage(playeridred"[Error] You are not authorised to use this command.");
    else
    {
        new 
string[84],
            
color;
        if(
sscanf(params"d"color))
        {
            
SendClientMessage(playeridwhite"[Usage] /dcolor [Color ID]");
            
SendClientMessage(playeridwhite"[Info] Colours: 0=black 1=white 2=red 3=orange 4=yellow 5=green 6=blue 7=purple 8=brown 9=pink");
            return 
1;
        }
        
format(stringsizeof(string), "[SUCCESS] You set your color to %d."color);
        
SendClientMessage(playeridwhitestring);
        
SetPlayerColor(playeridcolor);
    }
    return 
1;

It will set the color to 0 or 1 for example. Almost what you did, but instead of setting the color, switch the color and set the specific color.
pawn Код:
switch( color )
{
    case 0: SetPlayerColor(playerid, 0x000000FF);
    case 1: SetPlayerColor(playerid, 0xFFFFFFFF);
    case 2: SetPlayerColor(playerid, 0xFF0000FF);
    case 3: SetPlayerColor(playerid, /* orange here */);
    case 4: SetPlayerColor(playerid, 0xFFFF00FF);
    case 5: SetPlayerColor(playerid, 0x00FF00FF);
    case 6: SetPlayerColor(playerid, 0x0000FFFF);
    case 7: SetPlayerColor(playerid, /* purple here */);
    case 8: SetPlayerColor(playerid, /* brown here */);
    case 9: SetPlayerColor(playerid, /* pink here */);
}