SA-MP Forums Archive
[HELP] Colors - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Colors (/showthread.php?tid=119336)



[HELP] Colors - WThieves - 07.01.2010

Hi all, here's my problem:
I've made this
Quote:

enum pInfo
{
***
pColor,
***
};
new PlayerInfo[MAX_PLAYERS][pInfo];

(The ***'s are other info)
And
Quote:

PlayerInfo[playerid][pColor] = 0;

Under onplayerconnect
And
Quote:

if (PlayerInfo[playerid][pColor] == 0)
{
SetPlayerColor(playerid, C_NOT); // White
}
if (PlayerInfo[playerid][pColor] == 1)
{
SetPlayerColor(playerid, C_COP); // Blue
}
if (PlayerInfo[playerid][pColor] == 2)
{
SetPlayerColor(playerid, C_FBI); // Midnightblue
}
if (PlayerInfo[playerid][pColor] == 3)
{
SetPlayerColor(playerid, C_ARM); // Armygreen
}
if (PlayerInfo[playerid][pColor] == 4)
{
SetPlayerColor(playerid, C_MED); // Lightblue
}
if (PlayerInfo[playerid][pColor] == 5)
{
SetPlayerColor(playerid, C_LCN); // chartreuse
}
if (PlayerInfo[playerid][pColor] == 6)
{
SetPlayerColor(playerid, C_YAK); // pink
}
if (PlayerInfo[playerid][pColor] == 7)
{
SetPlayerColor(playerid, C_GOV); // Very light pink
}
if (PlayerInfo[playerid][pColor] ==
{
SetPlayerColor(playerid, C_HIT); // brown
}
if (PlayerInfo[playerid][pColor] == 9)
{
SetPlayerColor(playerid, C_NEW); // purple
}
if (PlayerInfo[playerid][pColor] == 10)
{
SetPlayerColor(playerid, C_CAB); // yellow
}
if (PlayerInfo[playerid][pColor] == 11)
{
SetPlayerColor(playerid, C_DRL); // grey
}

Under onplayerspawn
Now i have everyone automatic at white(default 0), but how do i have to make a command that changes it?
I tried under /setstat and then made this:
Quote:

case 20:
{
PlayerInfo[giveplayerid][pColor] = amount;
format(string, sizeof(string), " The Player Color set to %d", amount);
}

But that doesn't work, any help?


Re: [HELP] Colors - Grim_ - 07.01.2010

Show the whole /setstat command.


Re: [HELP] Colors - WThieves - 07.01.2010

Quote:
Originally Posted by _Xerxes_
Show the whole /setstat command.
Here:
Quote:

if(strcmp(cmd, "/setstat", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /setstat [playerid/PartOfName] [statcode] [amount]");
***
***
***
***
SendClientMessage(playerid, COLOR_GRAD2, "|20 Color ");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /setstat [playerid/PartOfName] [statcode] [amount]");
***
***
***
***
SendClientMessage(playerid, COLOR_GRAD2, "|20 Color ");
return 1;
}
new stat;
stat = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /setstat [playerid/PartOfName] [statcode] [amount]");
***
***
***
***
SendClientMessage(playerid, COLOR_GRAD2, "|20 Color ");
return 1;
}
new amount;
amount = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 4)
{
switch (stat)
{
***
case 20:
{
PlayerInfo[giveplayerid][pColor] = amount;
format(string, sizeof(string), " The Player Color Was Set To %d", amount);
}
***
default:
{
format(string, sizeof(string), " Invalid Stat Code", amount);
}

}
SendClientMessage(playerid, COLOR_GRAD1, string);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " you are not authorized to use that command!");
}
}//not valid id
}//not connected
}
return 1;
}

The ***'s are things that i replaced becouse its unimportant right now.


Re: [HELP] Colors - WThieves - 08.01.2010

Can anyone help me??