Color saving yini
#1

i am trying to save group color so when the player reconnect it spawns with group saved color but my problem is that the color not saving this is my code

PHP код:
CMD:groupcolor(playeridparams[])
{
    static 
RGB;
    if (
sscanf(params"iii"R,G,B))  return SendClientMessage(playerid, -1"/groupcolor [0-255] [0-255] [0-255]");
    
GroupInfo[PlayerInfo[playerid][pGroupID]][gColor] = GetPlayerColor(playerid);
    for(new 
0MAX_PLAYERSi++)
    {
        if(
PlayerInfo[i][pGroupID] == PlayerInfo[playerid][pGroupID])
        {
            
SetPlayerColor(i, (16777216) + (65536) + (B*256));
            
SendClientMessage(i, (16777216) + (65536) + (B*256), "[ Group ]: This is Group new color!");
        }
    }
    return 
1;
}
stock SaveGroups(id)
{
    new 
file[64];
    
format(filesizeof(file), "Groups/%d.ini"id);
    new 
INI:fHandle INI_Open(file);
    if(
fHandle != INI_NO_FILE)
    {
           
INI_SetTag(fHandle"GroupsData");
        
INI_WriteString(fHandle"GroupName"GroupInfo[id][gName]);
        
INI_WriteString(fHandle"PresidentName"GroupInfo[id][gPresidentName]);
        
INI_WriteInt(fHandle,"Active"GroupInfo[id][gActive]);
          
INI_WriteInt(fHandle,"GroupCash"GroupInfo[id][gCash]);
          
INI_WriteInt(fHandle,"GroupColor"GroupInfo[id][gColor]);
        
INI_Close(fHandle);
    }
    return 
1;

Reply
#2

Quote:
PHP код:
GroupInfo[PlayerInfo[playerid][pGroupID]][gColor] = GetPlayerColor(playerid); 
Shouldn't that be set to the new color or am I mistaken?
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Shouldn't that be set to the new color or am I mistaken?
yes i am storing the color in
PHP код:
GroupInfo[PlayerInfo[playerid][pGroupID]][gColor
but its not storing when i check group .ini "GroupColor = 0"
Reply
#4

PHP код:
CMD:groupcolor(playeridparams[]) 

    static 
RGB
    if (
sscanf(params"iii"R,G,B))  return SendClientMessage(playerid, -1"/groupcolor [0-255] [0-255] [0-255]"); 
    for(new 
0MAX_PLAYERSi++) 
    { 
        if(
PlayerInfo[i][pGroupID] == PlayerInfo[playerid][pGroupID]) 
        { 
            
SetPlayerColor(i, (16777216) + (65536) + (B*256)); 
            
SendClientMessage(i, (16777216) + (65536) + (B*256), "[ Group ]: This is Group new color!"); 
        } 
    } 
    
GroupInfo[PlayerInfo[playerid][pGroupID]][gColor] = GetPlayerColor(playerid); 
    return 
1

Reply
#5

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
PHP код:
CMD:groupcolor(playeridparams[]) 

    static 
RGB
    if (
sscanf(params"iii"R,G,B))  return SendClientMessage(playerid, -1"/groupcolor [0-255] [0-255] [0-255]"); 
    for(new 
0MAX_PLAYERSi++) 
    { 
        if(
PlayerInfo[i][pGroupID] == PlayerInfo[playerid][pGroupID]) 
        { 
            
SetPlayerColor(i, (16777216) + (65536) + (B*256)); 
            
SendClientMessage(i, (16777216) + (65536) + (B*256), "[ Group ]: This is Group new color!"); 
        } 
    } 
    
GroupInfo[PlayerInfo[playerid][pGroupID]][gColor] = GetPlayerColor(playerid); 
    return 
1

same
Reply
#6

Well yeah, a getter can't be used right after a setter because the player has not yet received that update. What I meant was:

PHP код:
GroupInfo[PlayerInfo[playerid][pGroupID]][gColor] = rgba(RGB0); 
PHP код:
stock rgba(rgba)
    return (
<< 24 << 16 << a); 
(function just for readability).
Reply
#7

thanks vince your code worked
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)