SA-MP Forums Archive
Color saving yini - 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)
+--- Thread: Color saving yini (/showthread.php?tid=594722)



Color saving yini - SalmaN97 - 22.11.2015

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;




Re: Color saving yini - Vince - 22.11.2015

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


Re: Color saving yini - SalmaN97 - 22.11.2015

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"


Re: Color saving yini - AbyssMorgan - 22.11.2015

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




Re: Color saving yini - SalmaN97 - 22.11.2015

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


Re: Color saving yini - Vince - 22.11.2015

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).


Re: Color saving yini - SalmaN97 - 22.11.2015

thanks vince your code worked