Quote:
Originally Posted by SickAttack
pawn Код:
#define FILEPATH "/FileName.cfg" // Path within scriptfiles. new FamilyColor[MAX_PLAYERS]; // Variable were the color will be stored. // Black space. stock ReadFile(playerid) // A stock. { // A character. new string[128]; // A variable, well you know what this is for right? new File:File=fopen(FILEPATH, io_read); // Open the file and read it. while(fread(File, string)) // While the code reads the file. { // A character. FamilyColor[playerid] = strval(string); // Store the color in the variable and convert the string to an integer. SetPlayerColor(playerid, FamilyColor[playerid]); // Set the players color to the color read from the file. } // A character. fclose(File); // Close the file. } // A character.
pawn Код:
new string[128]; // Define the cells of the string. new File:File1=fopen(FILENAME, io_write); // Open the file and write a string. format(string, sizeof(string), "PUT YOUR COLOR INSIDE HERE"); // String to write. fwrite(File1, string); // Write the string. fclose(File1); // Close the file.
Done. I just don't understand how are you going to make it more unique?
|
CHEEE!!
Thanks
But i can i set the color on every family slot and save it on .cfg ??
CMD:families(playerid, params[])
{
new string[128], familyid;
if(sscanf(params, "d", familyid))
{
new number = 0;
for(new i = 0; i < sizeof(FamilyInfo); i++)
{
number ++;
format(string, sizeof(string), "Family %d | Name: %s | Leader: %s | Members: %d",number,FamilyInfo[i][FamilyName],FamilyInfo[i][FamilyLeader],FamilyInfo[i][FamilyMembers]);
SendClientMessage(playerid, COLOR_WHITE, string);
}
return 1;
}
if(familyid < 1 || familyid > MAX_FAMILY) { SendClientMessage(playerid, COLOR_GREY, "Family slot must be between 1 and 14."); return 1; }
familyid -= 1;
if(FamilyInfo[familyid][FamilyTaken] != 1)
{
SendClientMessage(playerid, COLOR_GREY, "That family slot is empty.");
return 1;
}
foreach(Player, i)
{
if(PlayerInfo[i][pGang] == familyid && (AdminDuty[i] != 1))
{
if(PlayerInfo[i][pRank] == 1)
{
format(string, sizeof(string), "* %s: %s | Rank: %s (1).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank1]);
}
else if(PlayerInfo[i][pRank] == 2)
{
format(string, sizeof(string), "* %s: %s | Rank: %s (2).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank2]);
}
else if(PlayerInfo[i][pRank] == 3)
{
format(string, sizeof(string), "* %s: %s | Rank: %s (3).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank3]);
}
else if(PlayerInfo[i][pRank] == 4)
{
format(string, sizeof(string), "* %s: %s | Rank: %s (4).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank4]);
}
else if(PlayerInfo[i][pRank] == 5)
{
format(string, sizeof(string), "* %s: %s | Rank: %s (5).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank5]);
}
else if(PlayerInfo[i][pRank] == 6)
{
format(string, sizeof(string), "* %s: %s | Rank: %s (6).",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank6]);
}
else
{
format(string, sizeof(string), "* %s: %s | Rank: %s.",FamilyInfo[familyid][FamilyName],GetPlayerNameEx(i),FamilyInfo[familyid][FamilyRank1]);
}
SendClientMessage(playerid, COLOR_GREY, string);
}
}
return 1;
}