Load Player Colour
#1

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);
		    }
		}
	}
Reply
#2

Help.
Reply
#3

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;
}
Reply
#4

Error,, its make my pawno crash, to much error!
Reply
#5

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
Reply
#6

show me your load/save stats script
Reply
#7

Show us the line 10200
Reply
#8

btw its solved!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)