#include <a_samp>
#define GREEN 0x33AA33AA
#define RED 0xAA3333AA
#define YELLOW 0xFFFF00AA
#define WHITE 0xFFFFFFAA
#define BLUE 0x0000BBAA
#define GOLD 0xB8860BAA
#define PINK 0xFFC0CBAA
#define PURPLE 0x800080FF
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Player Color");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
#endif
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/color", cmdtext, true, 10) == 0)
{
ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Player Color", "White\nGreen\nRed\nYellow\nBlue\nPurple\nGold\nPink", "Choose", "Close");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 5)
{
if(response)
{
new string[128];
new message[256+1];
if(listitem == 0)
{
format(string, sizeof(string), "You got now a WHITE name");
SendClientMessage(playerid, 0xFFFFFFAA, message);
SetPlayerColor(playerid, WHITE);
}
if(listitem == 1)
{
format(string, sizeof(string), "You got now a GREEN name");
SendClientMessage(playerid, 0x33AA33AA, message);
SetPlayerColor(playerid, GREEN);
return 1;
}
if(listitem == 2)
{
format(string, sizeof(string), "You got now a RED name");
SendClientMessage(playerid, 0xAA3333AA, message);
SetPlayerColor(playerid, RED);
return 1;
}
if(listitem == 3)
{
format(string, sizeof(string), "You got now a YELLOW name");
SendClientMessage(playerid, 0xFFFF00AA, message);
SetPlayerColor(playerid, YELLOW);
return 1;
}
if(listitem == 4)
{
format(string, sizeof(string), "You got now a BLUE name");
SendClientMessage(playerid, 0x0000BBAA, message);
SetPlayerColor(playerid, BLUE);
return 1;
}
if(listitem == 5)
{
format(string, sizeof(string), "You got now a PURPLE name");
SendClientMessage(playerid, 0x800080FF, message);
SetPlayerColor(playerid, PURPLE);
return 1;
}
if(listitem == 6)
{
format(string, sizeof(string), "You got now a GOLD name");
SendClientMessage(playerid, 0xB8860BAA, message);
SetPlayerColor(playerid, GOLD);
return 1;
}
if(listitem == 7)
{
format(string, sizeof(string), "You got now a PINK name");
SendClientMessage(playerid, 0xFFC0CBAA, message);
SetPlayerColor(playerid, PINK);
return 1;
}
}
}
return 1;
}
First, do you have a file saving system?
Also; LOL at your signature, fail. |
/* Colour Save */ #include <a_samp> #include <dini> #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Colour Save!"); print("--------------------------------------\n"); return 1; } #endif public OnPlayerCommandText(playerid, cmdtext[]) { new file[256],name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), "%s.ini", name); if (strcmp("/cc 1", cmdtext, true, 10) == 0) { SetPlayerColor(playerid, 0xff0000ff); SendClientMessage(playerid, 0xff0000ff, "%s has changed the colour"); return 1; } if (strcmp("/color save", cmdtext, true) == 0) { if(dini_Int(file,"alreadysaved") != 0) return SendClientMessage(playerid,0xff0000ff,"Sorry , but you already saved your color once!"); if(!dini_Int(file,"alreadysaved")) { dini_IntSet(file,"savedcolour",GetPlayerColor(playerid)); dini_IntSet(file,"alreadysaved",1); } return 1; } return 0; }
kbalor try this
Код:
/* Colour Save */ #include <a_samp> #include <dini> #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Colour Save!"); print("--------------------------------------\n"); return 1; } #endif public OnPlayerCommandText(playerid, cmdtext[]) { new file[256],name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), "%s.ini", name); if (strcmp("/cc 1", cmdtext, true, 10) == 0) { SetPlayerColor(playerid, 0xff0000ff); SendClientMessage(playerid, 0xff0000ff, "%s has changed the colour"); return 1; } if (strcmp("/color save", cmdtext, true) == 0) { if(dini_Int(file,"alreadysaved") != 0) return SendClientMessage(playerid,0xff0000ff,"Sorry , but you already saved your color once!"); if(!dini_Int(file,"alreadysaved")) { dini_IntSet(file,"savedcolour",GetPlayerColor(playerid)); dini_IntSet(file,"alreadysaved",1); } return 1; } return 0; } |
#include <a_samp> #include <dini> #define GREEN 0x33AA33AA #define RED 0xAA3333AA #define YELLOW 0xFFFF00AA #define WHITE 0xFFFFFFAA #define BLUE 0x0000BBAA #define GOLD 0xB8860BAA #define PINK 0xFFC0CBAA #define PURPLE 0x800080FF #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print("Player Color"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else #endif public OnPlayerCommandText(playerid, cmdtext[]) { new file[256],name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(file, sizeof(file), "%s.ini", name); if (strcmp("/color", cmdtext, true, 10) == 0) { ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "Player Color", "White\nGreen\nRed\nYellow\nBlue\nPurple\nGold\nPink", "Choose", "Close"); return 1; } if (strcmp("/color save", cmdtext, true) == 0) { if(dini_Int(file,"alreadysaved") != 0) return SendClientMessage(playerid,0xff0000ff,"Sorry , but you already saved your color once!"); if(!dini_Int(file,"alreadysaved")) { dini_IntSet(file,"savedcolour",GetPlayerColor(playerid)); dini_IntSet(file,"alreadysaved",1); } return 1; } return 0; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { if(dialogid == 5) { if(response) { new string[128]; new message[256+1]; if(listitem == 0) { format(string, sizeof(string), "You got now a WHITE name"); SendClientMessage(playerid, 0xFFFFFFAA, message); SetPlayerColor(playerid, WHITE); } if(listitem == 1) { format(string, sizeof(string), "You got now a GREEN name"); SendClientMessage(playerid, 0x33AA33AA, message); SetPlayerColor(playerid, GREEN); return 1; } if(listitem == 2) { format(string, sizeof(string), "You got now a RED name"); SendClientMessage(playerid, 0xAA3333AA, message); SetPlayerColor(playerid, RED); return 1; } if(listitem == 3) { format(string, sizeof(string), "You got now a YELLOW name"); SendClientMessage(playerid, 0xFFFF00AA, message); SetPlayerColor(playerid, YELLOW); return 1; } if(listitem == 4) { format(string, sizeof(string), "You got now a BLUE name"); SendClientMessage(playerid, 0x0000BBAA, message); SetPlayerColor(playerid, BLUE); return 1; } if(listitem == 5) { format(string, sizeof(string), "You got now a PURPLE name"); SendClientMessage(playerid, 0x800080FF, message); SetPlayerColor(playerid, PURPLE); return 1; } if(listitem == 6) { format(string, sizeof(string), "You got now a GOLD name"); SendClientMessage(playerid, 0xB8860BAA, message); SetPlayerColor(playerid, GOLD); return 1; } if(listitem == 7) { format(string, sizeof(string), "You got now a PINK name"); SendClientMessage(playerid, 0xFFC0CBAA, message); SetPlayerColor(playerid, PINK); return 1; } } } return 1; }