save /color - 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: save /color (
/showthread.php?tid=467503)
save /color -
kbalor - 03.10.2013
Hi I would like to ask if you can help me make a setplayercolor command when I do /color and then a dialog box will appear which where I will choose the color with his format below..
Код:
///This is a dialog box
Set Player Color //Title
Blue
Red
Green
Yellow
Black
White
Set, Close <<--- the two options for dialog box
Then when I choose what color I want. It will be save then, and after disconnect and reconnect the color should still be last one I set. Like save/autoload
Thanks looking forward to hear your reply..
EDIT: Im using Y_INI saving system.
Re: save /color -
DanishHaq - 03.10.2013
And what's your color variable, that you're using in-game and that you're saving?
Re: save /color -
xXShadowXx - 03.10.2013
pawn Код:
forward loadcolor(playerid,name[],value[]);
new pColor[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
new name[30];
GetPlayerName(playerid,name,sizeof(name));
strcat(name,".ini",sizeof(name));
if(fexist(name)) INI_ParseFile(name,"loadcolor",.bExtra = true,.extra = playerid);
else { new INI:file = INI_Open(name); INI_SetTag(file,"color"); INI_WriteHex(file,"color",0xFFFFFFFF); pColor[playerid] = 0xFFFFFFFF; INI_Close(file); }
SetPlayerColor(playerid,pColor[playerid]);
return 1;
}
public OnPlayerDisconnect(playerid)
{
new name[30];
GetPlayerName(playerid,name,sizeof(name));
strcat(name,".ini",sizeof(name));
new INI:file = INI_Open(name);
INI_SetTag(file,"color");
INI_WriteHex(file,"color",pColor[playerid]);
INI_Close(file);
return 1;
}
public loadcolor(playerid,name[],value[])
{
INI_Hex("color",pColor[playerid]);
return 1;
}
Save your color hex code into the variable pColor[playerid].
Re: save /color -
kbalor - 03.10.2013
Quote:
Originally Posted by xXShadowXx
pawn Код:
forward loadcolor(playerid,name[],value[]); new pColor[MAX_PLAYERS];
public OnPlayerConnect(playerid) { new name[30]; GetPlayerName(playerid,name,sizeof(name)); strcat(name,".ini",sizeof(name)); if(fexist(name)) INI_ParseFile(name,"loadcolor",.bExtra = true,.extra = playerid); else { new INI:file = INI_Open(name); INI_SetTag(file,"color"); INI_WriteHex(file,"color",0xFFFFFFFF); pColor[playerid] = 0xFFFFFFFF; INI_Close(file); } SetPlayerColor(playerid,pColor[playerid]); return 1; }
public OnPlayerDisconnect(playerid) { new name[30]; GetPlayerName(playerid,name,sizeof(name)); strcat(name,".ini",sizeof(name)); new INI:file = INI_Open(name); INI_SetTag(file,"color"); INI_WriteHex(file,"color",pColor[playerid]); INI_Close(file); return 1; }
public loadcolor(playerid,name[],value[]) { INI_Hex("color",pColor[playerid]); return 1; }
Save your color hex code into the variable pColor[playerid].
|
thankt for the reply and I appreciate your effort. but I don't understand why u use
Код:
INI_WriteHex(file,"color",0xFFFFFFFF); pColor[playerid] = 0xFFFFFFFF; INI_Close(file); }
under onplayerconnect?
This is where where INI from onplayerconnect which is "LoginPlayer"
Quote:
public LoginPlayer(playerid, name[], value[])
{
INI_Int("Level", pInfo[playerid][pLevel]);
INI_Int("Donator", pInfo[playerid][Donator]);
INI_Int("Banned", pInfo[playerid][Banned]);
INI_Int("Kills", pInfo[playerid][Kills]);
INI_Int("Deaths", pInfo[playerid][Deaths]);
INI_Int("Muted", pInfo[playerid][Muted]);
INI_Int("Score", pInfo[playerid][Score]);
INI_Int("Cash", pInfo[playerid][Cash]);
INI_Int("Skin", pInfo[playerid][Skin]);
INI_WriteHex(ACC,"color",0xFFFFFFFF); pColor[playerid] = 0xFFFFFFFF;
INI_String("LastLoggedIP", pInfo[playerid][IP], 16);
INI_Int("TotalSeconds", pInfo[playerid][TotalSecs]);
return 1;
}
|
Re: save /color -
Blueflash123 - 04.10.2013
Color hex yeah good luck guys!