//FRAKCIÓ RENDSZER BY: Peter | Sa-Mp fórum. A nevemet ne tûntesd el bár úgyis elfogod
#include <a_samp>
#include <streamer>
#include <zcmd>
#include <foreach>
#include <sscanf2>
#include <YSI\\y_ini>
//Defik
#define SCM SendClientMessage
//Mentés defi
#define PATH \"Accounts/%s.ini\"
#define SECONDS(%1) ((%1)*(1000))
#define ALTCOMMAND:%1->%2; \\
COMMAND:%1(playerid, params[]) \\
return cmd_%2(playerid, params);
#define function%0(%1) forward%0(%1); public%0(%1)
//Színek
#define COL_YELLOW \"{F5E618}\"
#define COL_GREEN \"{2EAD15}\"
#define COL_WHITE \"{FFFFFF}\"
#define COL_BLUE \"{345ACF}\"
#define COLOR_RED 0xE01B4CFF
//regisztrálás
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_AGE 3
#define DIALOG_SEX 4
//Banda defik
//==========Illegális=========
#define TEAM_AZTECAS 0 //Aztecas
#define TEAM_VAGOS 1 //Vagos
#define TEAM_BALLAS 2 //Ballas
#define TEAM_GROVE 3 //Grove St.
#define TEAM_MAFIA 4 //Mafia
//Majd te ezt bõvíted azzal amivel akarod
enum pInfo
{
pPass,
pSex,
pAge,
pTeam,
pSkin
}
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnFilterScriptInit()
{
return 1;
}
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
SCM(playerid, COLOR_RED, \"Frakció rendszer aktiválva. By Peter\");
PlayerInfo[ playerid ][ pTeam ] = 0;
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), \"LoadUser_%s\", .bExtra = true, .extra = playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,\"Frakció Script\",\"Írd be a jelszavadat\",\"Regisztrálás\",\"Kilépés\");
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_AGE)
{
if(!response)
{
Kick(playerid);
}
else
{
if(strlen(inputtext))
{
new age = strval(inputtext);
if(age > 100 || age < 16)
{
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, \"- Korod -\",\"Hány éves vagy?\\n{FF0000}(( 16 - 100 ))\",\"Válasz\",\"Kilép\");
}
else
{
PlayerInfo[playerid][pAge] = age;
new
string[ 64 ]
;
format(string, sizeof(string), \"INFÓ: Értem {3BB9FF}%d éves vagy.\",age);
SendClientMessage(playerid, -1, string);
SaveAccountStats(playerid);
SpawnPlayer(playerid);
}
}
else
{
return 0;
}
}
}
if(dialogid == DIALOG_SEX)
{
if(response)
{
PlayerInfo[playerid][pSex] = 1;
SendClientMessage(playerid, -1, \"INFÓ: Te {3BB9FF}férfi vagy.\");
SetPlayerSkin(playerid, 60);
PlayerInfo[playerid][pSkin] = 60;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, \"- Korod -\",\"Hány éves vagy?\\n{FF0000}(( 16 - 100 ))\",\"Válasz\",\"Kilép\");
}
else
{
PlayerInfo[playerid][pSex] = 2;
SendClientMessage(playerid, -1, \"INFÓ: Te {3BB9FF}férfi nõ.\");
SetPlayerSkin(playerid, 233);
PlayerInfo[playerid][pSkin] = 233;
ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, \"- Korod -\",\"Hány éves vagy?\\n{FF0000}(( 16 - 100 ))\",\"Válasz\",\"Kilép\");
}
}
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, \"Regisztrálás...\",\"Rossz jelszó.\\nÍrd be a jelszavadat a regisztráláshoz.\",\"Regisztrálás\",\"Kilép\");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,\"data\");
INI_WriteInt(File,\"Password\",udb_hash(inputtext));
INI_WriteInt(File,\"Sex\",0);
INI_WriteInt(File,\"Age\",0);
INI_WriteInt(File,\"Skin\",0);
INI_WriteInt(File,\"Team\",0);
INI_Close(File);
ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_MSGBOX, \"- Nemed -\",\"Mi vagy?\",\"Férfi\",\"Nõ\");
}
}
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), \"LoadUser_%s\", .bExtra = true, .extra = playerid);
new
tmp2[ 256 ],
playername2[ MAX_PLAYER_NAME ]
;
GetPlayerName(playerid, playername2, sizeof(playername2));
format(tmp2, sizeof(tmp2), \"~w~Udvozollek ~n~~g~%s\", playername2);
GameTextForPlayer(playerid, tmp2, 5000, 1);
SetTimerEx(\"UnsetFirstSpawn\", 5000, false, \"i\", playerid);
SetSpawnInfo(playerid, PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pSkin], 1.0, -1, -1, -1, -1, -1, -1, -1, -1, -1);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,\"Belépés\",\"Rossz jelszó.\\nÍrd be a jelszavad\",\"Belep\",\"Kilép\");
}
return 1;
}
}
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SaveAccountStats(playerid);
return 1;
}
//Functionals ok
function LoadUser_data(playerid,name[],value[])
{
INI_Int(\"Password\",PlayerInfo[playerid][pPass]);
INI_Int(\"Sex\",PlayerInfo[playerid][pSex]);
INI_Int(\"Age\",PlayerInfo[playerid][pAge]);
INI_Int(\"Skin\",PlayerInfo[playerid][pSkin]);
INI_Int(\"Team\",PlayerInfo[playerid][pTeam]);
return 1;
}
function SaveAccountStats(playerid)
{
new
INI:File = INI_Open(UserPath(playerid))
;
INI_SetTag(File,\"data\");
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
INI_WriteInt(File,\"Sex\",PlayerInfo[playerid][pSex]);
INI_WriteInt(File,\"Age\",PlayerInfo[playerid][pAge]);
INI_WriteInt(File,\"Skin\",PlayerInfo[playerid][pSkin]);
INI_WriteInt(File,\"Team\",PlayerInfo[playerid][pTeam]);
INI_Close(File);
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
stock RPName(playerid)
{
new string[24];
GetPlayerName(playerid,string,24);
new str[24];
strmid(str,string,0,strlen(string),24);
for(new i = 0; i < MAX_PLAYER_NAME; i++)
{
if (str == \'_\') str = \' \'; //ha nem role play akkor ezt a sort szedd ki!!!
}
return str;
}
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
//Teszt parancsok hogy megértsd. Értem?
CMD:fkhelp(playerid, params[])
{
if(PlayerInfo[playerid][pTeam] == 0)
{
SCM(playerid, COLOR_RED, \"Aztecas tagja vagy\");
}
if(PlayerInfo[playerid][pTeam] == 1)
{
SCM(playerid, COLOR_RED, \"Vagos tagja vagy\");
}
if(PlayerInfo[playerid][pTeam] == 2)
{
SCM(playerid, COLOR_RED, \"Ballas tagja vagy\");
}
if(PlayerInfo[playerid][pTeam] == 3)
{
SCM(playerid, COLOR_RED, \"Grove St. Tagja vagy\");
}
if(PlayerInfo[playerid][pTeam] == 4)
{
SCM(playerid, COLOR_RED, \"Mafi tagja vagy\");
}
return 1;
}
Mediafire:
Letöltés ittDropbox:
Letöltés itt