[HELP] Colors
#1

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?
Reply
#2

Show the whole /setstat command.
Reply
#3

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.
Reply
#4

Can anyone help me??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)