LeXa_RuS
Новичок
PHP:
#include <dini>
//#if defined FILTERSCRIPT
#define SCRIPT_VERSION "Welcome"
#define COLOR_WHITE 0x0000BBAA
#define HEX_ADMINRED "{FB0000}"
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define FILTERSCRIPT
#define timersek 5
#define SAVEPLAYERSCORE
#define SAVEPLAYERMONEY
#define SAVEPLAYERDEATHS
#define SHOWINFORMATIONS
#if !defined SendClientMessagef || !defined SendClientMessageToAllf || !defined MSGf || !defined MSGToAllf
new __string[256];
#define SendClientMessagef(%0,%1,%2) \
format(__string, sizeof(__string), %2); \
SendClientMessage((%0), (%1), __string)
#define SendClientMessageToAllf(%0,%1) \
format(__string, sizeof(__string), %1); \
SendClientMessageToAll((%0), __string)
#define MSGf(%0,%1,%2) \
format(__string, sizeof(__string), %2); \
SendClientMessage((%0), (%1), __string)
#define MSGToAllf(%0,%1) \
format(__string, sizeof(__string), %1); \
SendClientMessageToAll((%0), __string)
#endif
#if !defined ShowRegisterDialog || !defined ShowLoginDialog
new dString[150];
#define ShowRegisterDialog(%0) \
format(dString, sizeof(dString), "Äîáðî Ïîæàëîâàòü "HEX_LIGHTGREEN"%s"HEX_WHITE",Çàðåãåñòðèðóéòåñü ÷òîáû èãðàòü", PlayerName(%0)); \
ShowPlayerDialog(%0, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", dString, "Ðåãåñòð.", "Âûéòè")
#define ShowLoginDialog(%0) \
format(dString, sizeof(dString), "Äîáðî Ïîæàëîâàòü "HEX_LIGHTGREEN"%s"HEX_WHITE",Ââåäèòå ïàðîëü ÷òîáû íà÷àòü èãðó.", PlayerName(%0)); \
ShowPlayerDialog(%0, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", dString, "Âîéòè", "Âûõîä")
#endif
#define MAX_LOGIN_ATTEMPTS 3
static
armedbody_pTick[MAX_PLAYERS];
new AccountFile[100];
new LoginAttempts[MAX_PLAYERS]
new Deaths[MAX_PLAYERS];
new prod;
new oryzh;
new gPlayerClass[MAX_PLAYERS];
static gTeam[MAX_PLAYERS];
new BigEar[MAX_PLAYERS];
new FirstTimeSpawned[MAX_PLAYERS];
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
stock PlayerName(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
return name;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
GameTextForPlayer(playerid,"PAWNO-INFO",5000,5);
#if defined SAVEPLAYERDEATHS
format(AccountFile, sizeof(AccountFile), "/users/%s.txt", PlayerName(playerid));
if(dini_Exists(AccountFile))
{
if(!dini_Isset(AccountFile, "Deaths")) dini_IntSet(AccountFile, "Deaths", 0);
Deaths[playerid] = dini_Int(AccountFile, "Deaths");
}
else if(!dini_Exists(AccountFile))
{
Deaths[playerid] = 0;
}
#endif
LoginAttempts[playerid] = 0;
FirstTimeSpawned[playerid] = 0;
return 1;
}
stock SavePlayer(playerid)
{
format(AccountFile, sizeof(AccountFile), "/users/%s.txt", PlayerName(playerid));
#if defined SAVEPLAYERMONEY
if(!dini_Isset(AccountFile, "Money")) dini_IntSet(AccountFile, "Money", 0);
dini_IntSet(AccountFile, "Money", GetPlayerMoney(playerid));
#endif
#if defined SAVEPLAYERSCORE
if(!dini_Isset(AccountFile, "Score")) dini_IntSet(AccountFile, "Score", 0);
dini_IntSet(AccountFile, "Score", GetPlayerScore(playerid));
#endif
#if defined SAVEPLAYERDEATHS
if(!dini_Isset(AccountFile, "Deaths")) dini_IntSet(AccountFile, "Deaths", 0);
dini_IntSet(AccountFile, "Deaths", Deaths[playerid]);
#endif
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
LoginAttempts[playerid] = 0;
FirstTimeSpawned[playerid] = 0;
SavePlayer(playerid);
return 1;
}
stock CheckRegLogin(playerid)
{
if(FirstTimeSpawned[playerid] == 0)
{
format(AccountFile, sizeof(AccountFile), "/users/%s.txt", PlayerName(playerid));
if(dini_Exists(AccountFile)) { ShowLoginDialog(playerid); }
else if(!dini_Exists(AccountFile)) { ShowRegisterDialog(playerid); }
FirstTimeSpawned[playerid] = 1;
}
else if(FirstTimeSpawned[playerid] != 0) { }
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_REGISTER)
{
if(!strlen(inputtext)) { SendClientMessage(playerid, WHITE, ""HEX_ADMINRED"Îøèáêà:"HEX_WHITE"Âû äîëæíû ââåñòè ïàðîëü!"); ShowRegisterDialog(playerid); return 1; }
if(response)
{
format(AccountFile, sizeof(AccountFile), "/users/%s.txt", PlayerName(playerid));
dini_Create(AccountFile);
#if defined SAVEPLAYERSCORE
dini_IntSet(AccountFile, "Score", 0);
#endif
#if defined SAVEPLAYERDEATHS
dini_IntSet(AccountFile, "Deaths", 0);
#endif
#if defined SAVEPLAYERMONEY
dini_IntSet(AccountFile, "Money", 0);
#endif
dini_Set(AccountFile, "Password", inputtext);
SendClientMessage(playerid, WHITE, "Âû "HEX_LIGHTGREEN"íå çàðåãåñòðèðîâàíû"HEX_WHITE"çàðåãåñòðèðóéòåñü ÷òîáû èãðàòü!");
#if defined SHOWINFORMATIONS
SendClientMessage (playerid, ORANGE, " Èíôîðìàöèÿ:");
#if defined SAVEPLAYERSCORE
SendClientMessagef(playerid, WHITE, "- Óáèéñòâ: "HEX_LIGHTBLUE"%d"HEX_WHITE".", GetPlayerScore(playerid));
#endif
#if defined SAVEPLAYERMONEY
SendClientMessagef(playerid, WHITE, "- Äåíåã: "HEX_LIGHTBLUE"%d"HEX_WHITE".", GetPlayerMoney(playerid));
#endif
#if defined SAVEPLAYERDEATHS
SendClientMessagef(playerid, WHITE, "- Ñìåðòåé: "HEX_LIGHTBLUE"%d"HEX_WHITE".", Deaths[playerid]);
#endif
#endif
}
else if(!response)
{
KickX(playerid, "Âû äîëæíû çàðåãåñòðèðîâàòüñÿ");
}
}
if(dialogid == DIALOG_LOGIN)
{
if(!strlen(inputtext)) { SendClientMessage(playerid, WHITE, ""HEX_ADMINRED"Îøèáêà:"HEX_WHITE"Âû äîëæíû ââåñòè ïàðîëü!"); ShowLoginDialog(playerid); return 1; }
if(response)
{
format(AccountFile, sizeof(AccountFile), "/users/%s.txt", PlayerName(playerid));
if(strcmp(inputtext, dini_Get(AccountFile, "Password"), true) == 0)
{
#if defined SAVEPLAYERMONEY
if(!dini_Isset(AccountFile, "Money")) dini_IntSet(AccountFile, "Money", 0);
GivePlayerMoney(playerid, dini_Int(AccountFile, "Money"));
#endif
#if defined SAVEPLAYERSCORE
if(!dini_Isset(AccountFile, "Score")) dini_IntSet(AccountFile, "Score", 0);
SetPlayerScore(playerid, dini_Int(AccountFile, "Score"));
#endif
SendClientMessage(playerid, WHITE, "Âû "HEX_LIGHTGREEN"çàðåãåñòðèðîâàíû"HEX_WHITE" ââåäèòå ïàðîëü!");
#if defined SHOWINFORMATIONS
SendClientMessage (playerid, ORANGE, " Èíôîðìàöèÿ:");
#if defined SAVEPLAYERSCORE
SendClientMessagef(playerid, WHITE, "- Óáèéñòâ: "HEX_LIGHTBLUE"%d"HEX_WHITE".", GetPlayerScore(playerid));
#endif
#if defined SAVEPLAYERMONEY
SendClientMessagef(playerid, WHITE, "- Äåíåã: "HEX_LIGHTBLUE"%d"HEX_WHITE".", GetPlayerMoney(playerid));
#endif
#if defined SAVEPLAYERDEATHS
SendClientMessagef(playerid, WHITE, "- Ñìåðòåé: "HEX_LIGHTBLUE"%d"HEX_WHITE".", Deaths[playerid]);
#endif
#endif
LoginAttempts[playerid] = 0;
}
else
{
LoginAttempts[playerid]++;
if(LoginAttempts[playerid] == MAX_LOGIN_ATTEMPTS)
{
KickX(playerid, "Îøèáêà");
return 1;
}
SendClientMessagef(playerid, WHITE, ""HEX_ADMINRED"Îøèáêà:"HEX_WHITE" Íå âåðíûé ïàðîëü [Ïîïûòîê áûëî: %d/Ìàêñèìàëüíî ïîïûòîê: %d]!", LoginAttempts[playerid], MAX_LOGIN_ATTEMPTS);
ShowLoginDialog(playerid);
}
}
else if(!response)
{
KickX(playerid, "Âû äîëæíû âîéòè!");
}
}
if(dialogid == 9701)
{
if(response)
{
if(listitem == 0)
{
SetPlayerHealth(playerid,100);
GivePlayerMoney(playerid,-31);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
}
if(listitem == 1)
{
SetPlayerHealth(playerid,100);
GivePlayerMoney(playerid,-11);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
}
if(listitem == 2)
{
SetPlayerHealth(playerid,100);
GivePlayerMoney(playerid,-5);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
}
if(listitem == 3)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
GivePlayerMoney(playerid,-3);
}
if(listitem == 4)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_WINE);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
GivePlayerMoney(playerid,-43);
}
if(listitem == 5)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_SPRUNK);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
GivePlayerMoney(playerid,-2);
}
if(listitem == 6)
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SMOKE_CIGGY);
PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
GivePlayerMoney(playerid,-7);
}
}
return 1;
}
if(dialogid == 9702)
{
if(response)
{
if(listitem == 0)
{
GivePlayerMoney(playerid,-7);
GivePlayerWeapon(playerid, 6, 1);
}
if(listitem == 1)
{
GivePlayerMoney(playerid,-44);
GivePlayerWeapon(playerid, 24, 40);
}
if(listitem == 2)
{
GivePlayerMoney(playerid,-85);
GivePlayerWeapon(playerid, 25, 55);
}
if(listitem == 3)
{
GivePlayerMoney(playerid,-127);
GivePlayerWeapon(playerid, 30, 100);
}
if(listitem == 4)
{
GivePlayerMoney(playerid,-102);
GivePlayerWeapon(playerid, 33, 35);
}
}
return 1;
}
---------- Добавлено сообщение в 21:19 ---------- Предыдущее в 21:17 ----------
ооо боже не буквы а карякулы позже отредактирую
