Unalomból készítettem egy Prefix Systemet.
Elkészítési idő: 7 perc (teszteléssel)
Készítő: KLaypex
Script:
#include <a_samp>
#include <sscanf2>
#include <zcmd>
#include <dini>
new PlayerColors[200] = {
0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF,0x6495EDFF,0xf0e68cFF,0x778899FF,0xFF1493FF,0xF4A460FF,
0xEE82EEFF,0xFFD720FF,0x8b4513FF,0x4949A0FF,0x148b8bFF,0x14ff7fFF,0x556b2fFF,0x0FD9FAFF,0x10DC29FF,
0x534081FF,0x0495CDFF,0xEF6CE8FF,0xBD34DAFF,0x247C1BFF,0x0C8E5DFF,0x635B03FF,0xCB7ED3FF,0x65ADEBFF,
0x5C1ACCFF,0xF2F853FF,0x11F891FF,0x7B39AAFF,0x53EB10FF,0x54137DFF,0x275222FF,0xF09F5BFF,0x3D0A4FFF
};
public OnFilterScriptInit()
{
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
dini_Create(PlayerFile(playerid));
SetPlayerColor(playerid, PlayerColors[playerid]);
return 1;
}
public OnPlayerText(playerid, text[])
{
new string[256];
if(strlen(dini_Get(PlayerFile(playerid), \"Prefix\")) >= 1)
{
format(string, sizeof(string),\"{%06x}%s {00db58}[%s] {c4ff00}(%i): {ffffff}%s\",GetPlayerColor(playerid) >>> 8, GetName(playerid), dini_Get(PlayerFile(playerid), \"Prefix\"), playerid, text);
}
else
{
format(string, sizeof(string),\"{%06x}%s{c4ff00}(%i): {ffffff}%s\",GetPlayerColor(playerid) >>> 8, GetName(playerid), playerid, text);
}
SendClientMessageToAll(-1, string);
return 0;
}
CMD:myprefix(playerid, params[])
{
new prefix[128], string[128];
if(sscanf(params, \"s[128]\", prefix)) return SendClientMessage(playerid, 0xFF0000AA, \"Használat: /myprefix [prefix]\");
if(strlen(prefix) > 32) return SendClientMessage(playerid, 0xFF0000AA, \"Hiba: A prefixed csak 32 karakteres lehet!\");
format(string, sizeof(string),\"{0086FF}Módosítottad a prefixed. \\\"%s\\\"\",prefix);
SendClientMessage(playerid, -1, string);
dini_Set(PlayerFile(playerid), \"Prefix\", prefix);
return 1;
}
CMD:deletemyprefix(playerid)
{
SendClientMessage(playerid, -1, \"{0086FF}Eltávolítottad a prefixedet!\");
dini_Unset(PlayerFile(playerid), \"Prefix\");
return 1;
}
stock PlayerFile(playerid)
{
new file[100];
format(file, sizeof(file),\"/%s.ini\",GetName(playerid));
return file;
}
stock GetName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
return Name;
}