23.03.2016, 22:47
You'll need to have a variable to hold the colors and then run a loop via your command to set them all.
I.E;
This will be different depending on what you use to create commands obviously.
The reason I use SetPVarInt is so that if the player disconnects and another joins, it won't give the new player the old player's color. It's a lot easier.
I.E;
PHP код:
CMD:toorange(playerid, params[]) {
for(new i = 0; i< MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
SetPVarInt(i, "color", GetPlayerColor(i));
SetPlayerColor(i, 0xD1773BFF); // orange
}
}
return 1;
}
CMD:returncolors(playerid, params[]) {
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i)) {
SetPlayerColor(i, GetPVarInt(i, "color"));
}
}
return 1;
}
The reason I use SetPVarInt is so that if the player disconnects and another joins, it won't give the new player the old player's color. It's a lot easier.