Load Player Colour - 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: Load Player Colour (
/showthread.php?tid=514523)
Load Player Colour -
TazmaNiax - 22.05.2014
hello everyone,
i need help with Player colour, i want if them change /color (my commands) its will be save
when they connect to my server again, this my code
Код:
CMD:color(playerid, params[])
{
if(pInfo[playerid][Invisible] == 1) return SendClientMessage(playerid, COLOR_RED, "[Error]: You are invsible, You cannot use this command!");
if(GetPlayerState(playerid) != 1 && GetPlayerState(playerid) != 2 && GetPlayerState(playerid) != 3)
return SendClientMessage(playerid, COLOR_RED, "[Spawned]: You're not able to use this command!, Spawn first!");
ShowPlayerDialog(playerid, DIALOG_COLOR, DIALOG_STYLE_LIST, ""white"Change Color", "Purple\nPink\nLight Blue\nLight Green\nGrey\nWhite\nOrange\nYellow\nRed\nGreen", "Change", "Cancel");
SendAdminCMD(playerid, "color");
return 1;
}
OndialogResponse
Код:
if(dialogid == DIALOG_COLOR)
{
if(!response) return 1;
else if(response)
{
SendClientMessage(playerid, COLOR_LIME, "{FF0000}xSF {A0A0A0}» {FFFFFF}Your name color has been successfully changed!");
switch(listitem)
{
case 0: SetPlayerColor(playerid, COLOR_PURPLE);
case 1: SetPlayerColor(playerid, COLOR_PINK);
case 2: SetPlayerColor(playerid, COLOR_LIGHTBLUE);
case 3: SetPlayerColor(playerid, COLOR_LIGHTGREEN);
case 4: SetPlayerColor(playerid, COLOR_GREY);
case 5: SetPlayerColor(playerid, COLOR_WHITE);
case 6: SetPlayerColor(playerid, COLOR_ORANGE);
case 7: SetPlayerColor(playerid, COLOR_YELLOW);
case 8: SetPlayerColor(playerid, COLOR_RED);
case 9: SetPlayerColor(playerid, COLOR_GREEN);
}
}
}
Re: Load Player Colour -
TazmaNiax - 22.05.2014
Help.
Re: Load Player Colour -
Rittik - 22.05.2014
Under your PlayerInfo enum insert pColor
Then follow this code.
Код:
if(dialogid == DIALOG_COLOR)
{
if(!response) return 1;
else if(response)
{
SendClientMessage(playerid, COLOR_LIME, "{FF0000}xSF {A0A0A0}» {FFFFFF}Your name color has been successfully changed!");
switch(listitem)
{
case 0: SetPlayerColor(playerid, COLOR_PURPLE);
PlayerInfo[playerid][pColor]=GetPlayerColor(playerid);
case 1: SetPlayerColor(playerid, COLOR_PINK);
PlayerInfo[playerid][pColor]=GetPlayerColor(playerid);
case 2: SetPlayerColor(playerid, COLOR_LIGHTBLUE);
PlayerInfo[playerid][pColor]=GetPlayerColor(playerid);
case 3: SetPlayerColor(playerid, COLOR_LIGHTGREEN);
PlayerInfo[playerid][pColor]=GetPlayerColor(playerid);
case 4: SetPlayerColor(playerid, COLOR_GREY);
PlayerInfo[playerid][pColor]=GetPlayerColor(playerid);
case 5: SetPlayerColor(playerid, COLOR_WHITE);
PlayerInfo[playerid][pColor]=GetPlayerColor(playerid);
case 6: SetPlayerColor(playerid, COLOR_ORANGE);
PlayerInfo[playerid][pColor]=GetPlayerColor(playerid);
case 7: SetPlayerColor(playerid, COLOR_YELLOW);
PlayerInfo[playerid][pColor]=GetPlayerColor(playerid);
case 8: SetPlayerColor(playerid, COLOR_RED);
PlayerInfo[playerid][pColor]=GetPlayerColor(playerid);
case 9: SetPlayerColor(playerid, COLOR_GREEN);
PlayerInfo[playerid][pColor]=GetPlayerColor(playerid);
}
}
}
Then,Under OnPlayerDisconnect
Код:
public OnPlayerDisconnect(playerid, reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File,"Color",PlayerInfo[playerid][pColor]);
INI_Close(File);
return 1;
}
Re: Load Player Colour -
TazmaNiax - 22.05.2014
Error,, its make my pawno crash, to much error!
Re: Load Player Colour -
TazmaNiax - 22.05.2014
i got this error
Код:
D:\xSF\gamemodes\IxF.pwn(10200) : error 001: expected token: "-string end-", but found "-identifier-"
D:\xSF\gamemodes\IxF.pwn(10200) : warning 215: expression has no effect
D:\xSF\gamemodes\IxF.pwn(10200) : error 001: expected token: ";", but found ")"
D:\xSF\gamemodes\IxF.pwn(10200) : error 029: invalid expression, assumed zero
D:\xSF\gamemodes\IxF.pwn(10200) : fatal error 107: too many error messages on one line
Re: Load Player Colour -
JFF - 22.05.2014
show me your load/save stats script
Re: Load Player Colour -
Rittik - 22.05.2014
Show us the line
10200
Re: Load Player Colour -
TazmaNiax - 22.05.2014
btw its solved!