Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ATROX DM
- v1.0 by Aggressive
- */
- //-------------------------------- INCLUDE FILES -----------------------------//
- #include < a_samp >
- #include < streamer >
- #include < a_mysql >
- #include < foreach >
- #include < Pawn.CMD >
- #include < sscanf2 >
- //-------------------------------- DAMAGE INFORMER ---------------------------//
- #include < weapon-config >
- #include < SKY >
- #if defined _ALS_OnPlayerGiveDamage
- #undef OnPlayerGiveDamage
- #else
- #define _ALS_OnPlayerGiveDamage
- #endif
- #define OnPlayerGiveDamage NULL_OnPlayerGiveDamage
- #if defined NULL_OnPlayerGiveDamage
- forward NULL_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid);
- #endif
- #if defined _ALS_OnPlayerTakeDamage
- #undef OnPlayerTakeDamage
- #else
- #define _ALS_OnPlayerTakeDamage
- #endif
- #define OnPlayerTakeDamage NULL_OnPlayerTakeDamage
- #if defined NULL_OnPlayerTakeDamage
- forward NULL_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid);
- #endif
- //---------------------------------- DEFINES ---------------------------------//
- #define MYSQL_HOST "127.0.0.1"
- #define MYSQL_USER "root"
- #define MYSQL_PASSWORD ""
- #define MYSQL_DATABASE "adm"
- //--------------------------------- DIALOGS ----------------------------------//
- enum
- {
- DIALOG_REGISTER,
- DIALOG_LOGIN,
- DIALOG_NORESPONSE,
- DIALOG_HELP,
- DIALOG_DMARENE,
- DIALOG_DUEL
- }
- //----------------------------------- ENUM -----------------------------------//
- enum PLAYER_INFO
- {
- pID,
- pName[25],
- pPassword[65],
- pSalt[11],
- pPasswordFails,
- pKills,
- pDeaths,
- pScore,
- pCash,
- pAdmin,
- pSkin,
- pBanned,
- pBanReason[50],
- Cache:Player_Cache
- }
- //---------------------------------- NEWS ------------------------------------//
- new PI[MAX_PLAYERS][PLAYER_INFO];
- new MySQL:Database, Corrupt_Check[MAX_PLAYERS];
- //----------------------------------------------------------------------------//
- new Text:InGameTD[9], PlayerText:KillsTD[MAX_PLAYERS], PlayerText:DeathsTD[MAX_PLAYERS],
- PlayerText:RankTD[MAX_PLAYERS], PlayerText:NickTD[MAX_PLAYERS];
- //----------------------------------------------------------------------------//
- new bool:NexACDetect[MAX_PLAYERS], bool:UlogovanIgrac[MAX_PLAYERS], TextCD[MAX_PLAYERS],
- UDMAreni[MAX_PLAYERS], CMDCD[MAX_PLAYERS], DuelIgrac[MAX_PLAYERS], ZahtevZaDuel[MAX_PLAYERS],
- InDM1, InDM2, InDM3, InDM4, InDM5, IgracevRank[MAX_PLAYERS][30], DuelOpcije[MAX_PLAYERS][4],
- Float:DuelHP[MAX_PLAYERS], Float:DuelArmour[MAX_PLAYERS], SekundeDuel[MAX_PLAYERS], TimerODuel[MAX_PLAYERS];
- //--------------------------- Random DM Arene Spawn --------------------------//
- new Float:LVPD[7][3]=
- {
- {289.4713,168.9777,1007.1719},
- {296.6701,187.1066,1007.1719},
- {255.0509,189.9045,1008.1719},
- {213.5514,141.5470,1003.0234},
- {191.8244,158.4517,1003.0234},
- {190.1116,179.0616,1003.0234},
- {230.2902,179.1490,1003.0313}
- };
- new Float:GTOWN[6][3]=
- {
- {-372.0640,2269.2002,42.1420},
- {-350.4502,2241.4490,42.4844},
- {-350.8359,2216.3533,42.4844},
- {-361.0794,2203.4553,42.4844},
- {-402.6833,2199.9370,42.4297},
- {-443.3412,2220.3752,42.4297}
- };
- new Float:RCRAND[8][3]=
- {
- {-974.9233,1089.6772,1344.9744},
- {-974.8738,1060.5751,1345.6719},
- {-1010.3456,1099.0929,1341.9373},
- {-1067.5536,1094.2667,1343.1432},
- {-1054.7448,1021.2515,1343.1893},
- {-1102.0070,1019.5742,1342.0938},
- {-1132.0172,1029.3613,1345.7325},
- {-1130.7610,1057.9550,1346.4141}
- };
- new Float:JM[7][3]=
- {
- {2224.3181,-1143.9808,1025.7969},
- {2215.2036,-1150.2555,1025.7969},
- {2220.6833,-1138.9036,1027.7969},
- {2235.7795,-1193.9183,1029.8043},
- {2240.5454,-1192.5084,1033.7969},
- {2227.5332,-1183.2355,1029.8043},
- {2188.3896,-1181.7401,1029.7969}
- };
- new Float:MF[7][3]=
- {
- {963.418762,2108.292480,1011.030273},
- {961.1073,2099.6902,1011.0250},
- {948.4927,2105.8589,1011.0234},
- {959.3273,2145.4019,1011.0289},
- {934.0167,2144.2883,1011.0234},
- {933.7863,2164.0837,1011.0303},
- {954.0387,2176.6511,1011.0234}
- };
- //--------------------------------- MAIN -------------------------------------//
- main() { }
- //-------------------------------- PUBLIC ------------------------------------//
- public OnGameModeInit()
- {
- new MySQLOpt: option_id = mysql_init_options();
- mysql_set_option(option_id, AUTO_RECONNECT, true);
- //------------------------------------------------------------------------//
- Database = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE, option_id);
- //------------------------------------------------------------------------//
- if(Database == MYSQL_INVALID_HANDLE || mysql_errno(Database) != 0)
- {
- print("I couldn't connect to the MySQL server, closing.");
- SendRconCommand("exit");
- return 1;
- }
- //------------------------------------------------------------------------//
- print("I have connected to the MySQL server.");
- //------------------------------------------------------------------------//
- InGameTD[0] = TextDrawCreate(557.357421, 395.333343, "LD_SPAC:white");
- TextDrawLetterSize(InGameTD[0], 0.000000, 0.000000);
- TextDrawTextSize(InGameTD[0], 83.000000, 71.000000);
- TextDrawAlignment(InGameTD[0], 1);
- TextDrawColor(InGameTD[0], 255);
- TextDrawSetShadow(InGameTD[0], 0);
- TextDrawSetOutline(InGameTD[0], 0);
- TextDrawBackgroundColor(InGameTD[0], 255);
- TextDrawFont(InGameTD[0], 4);
- TextDrawSetProportional(InGameTD[0], 0);
- TextDrawSetShadow(InGameTD[0], 0);
- InGameTD[1] = TextDrawCreate(559.231567, 397.666687, "LD_SPAC:white");
- TextDrawLetterSize(InGameTD[1], 0.000000, 0.000000);
- TextDrawTextSize(InGameTD[1], 83.000000, 71.000000);
- TextDrawAlignment(InGameTD[1], 1);
- TextDrawColor(InGameTD[1], 303174399);
- TextDrawSetShadow(InGameTD[1], 0);
- TextDrawSetOutline(InGameTD[1], 0);
- TextDrawBackgroundColor(InGameTD[1], 255);
- TextDrawFont(InGameTD[1], 4);
- TextDrawSetProportional(InGameTD[1], 0);
- TextDrawSetShadow(InGameTD[1], 0);
- InGameTD[2] = TextDrawCreate(561.574157, 402.333343, "LD_SPAC:white");
- TextDrawLetterSize(InGameTD[2], 0.000000, 0.000000);
- TextDrawTextSize(InGameTD[2], 76.000000, 10.000000);
- TextDrawAlignment(InGameTD[2], 1);
- TextDrawColor(InGameTD[2], 255);
- TextDrawSetShadow(InGameTD[2], 0);
- TextDrawSetOutline(InGameTD[2], 0);
- TextDrawBackgroundColor(InGameTD[2], 255);
- TextDrawFont(InGameTD[2], 4);
- TextDrawSetProportional(InGameTD[2], 0);
- TextDrawSetShadow(InGameTD[2], 0);
- InGameTD[3] = TextDrawCreate(561.574218, 415.166748, "LD_SPAC:white");
- TextDrawLetterSize(InGameTD[3], 0.000000, 0.000000);
- TextDrawTextSize(InGameTD[3], 76.000000, 10.000000);
- TextDrawAlignment(InGameTD[3], 1);
- TextDrawColor(InGameTD[3], 255);
- TextDrawSetShadow(InGameTD[3], 0);
- TextDrawSetOutline(InGameTD[3], 0);
- TextDrawBackgroundColor(InGameTD[3], 255);
- TextDrawFont(InGameTD[3], 4);
- TextDrawSetProportional(InGameTD[3], 0);
- TextDrawSetShadow(InGameTD[3], 0);
- InGameTD[4] = TextDrawCreate(561.574218, 427.416778, "LD_SPAC:white");
- TextDrawLetterSize(InGameTD[4], 0.000000, 0.000000);
- TextDrawTextSize(InGameTD[4], 76.000000, 10.000000);
- TextDrawAlignment(InGameTD[4], 1);
- TextDrawColor(InGameTD[4], 255);
- TextDrawSetShadow(InGameTD[4], 0);
- TextDrawSetOutline(InGameTD[4], 0);
- TextDrawBackgroundColor(InGameTD[4], 255);
- TextDrawFont(InGameTD[4], 4);
- TextDrawSetProportional(InGameTD[4], 0);
- TextDrawSetShadow(InGameTD[4], 0);
- InGameTD[5] = TextDrawCreate(557.357543, 440.250091, "LD_SPAC:white");
- TextDrawLetterSize(InGameTD[5], 0.000000, 0.000000);
- TextDrawTextSize(InGameTD[5], 131.000000, 10.000000);
- TextDrawAlignment(InGameTD[5], 1);
- TextDrawColor(InGameTD[5], 255);
- TextDrawSetShadow(InGameTD[5], 0);
- TextDrawSetOutline(InGameTD[5], 0);
- TextDrawBackgroundColor(InGameTD[5], 255);
- TextDrawFont(InGameTD[5], 4);
- TextDrawSetProportional(InGameTD[5], 0);
- TextDrawSetShadow(InGameTD[5], 0);
- InGameTD[6] = TextDrawCreate(564.085144, 402.916564, "Kills:");
- TextDrawLetterSize(InGameTD[6], 0.252415, 0.765833);
- TextDrawAlignment(InGameTD[6], 1);
- TextDrawColor(InGameTD[6], -1);
- TextDrawSetShadow(InGameTD[6], 0);
- TextDrawSetOutline(InGameTD[6], 0);
- TextDrawBackgroundColor(InGameTD[6], 255);
- TextDrawFont(InGameTD[6], 1);
- TextDrawSetProportional(InGameTD[6], 1);
- TextDrawSetShadow(InGameTD[6], 0);
- InGameTD[7] = TextDrawCreate(564.085083, 416.333251, "Deaths:");
- TextDrawLetterSize(InGameTD[7], 0.252415, 0.765833);
- TextDrawAlignment(InGameTD[7], 1);
- TextDrawColor(InGameTD[7], -1);
- TextDrawSetShadow(InGameTD[7], 0);
- TextDrawSetOutline(InGameTD[7], 0);
- TextDrawBackgroundColor(InGameTD[7], 255);
- TextDrawFont(InGameTD[7], 1);
- TextDrawSetProportional(InGameTD[7], 1);
- TextDrawSetShadow(InGameTD[7], 0);
- InGameTD[8] = TextDrawCreate(564.553588, 428.583312, "Rank:");
- TextDrawLetterSize(InGameTD[8], 0.252415, 0.765833);
- TextDrawAlignment(InGameTD[8], 1);
- TextDrawColor(InGameTD[8], -1);
- TextDrawSetShadow(InGameTD[8], 0);
- TextDrawSetOutline(InGameTD[8], 0);
- TextDrawBackgroundColor(InGameTD[8], 255);
- TextDrawFont(InGameTD[8], 1);
- TextDrawSetProportional(InGameTD[8], 1);
- TextDrawSetShadow(InGameTD[8], 0);
- //------------------------------------------------------------------------//
- SetGameModeText("- A DeathMatch v1.0 -");
- DisableInteriorEnterExits();
- //------------------------------------------------------------------------//
- mysql_tquery(Database, "CREATE TABLE IF NOT EXISTS `PLAYERS` (`ID` int(11) NOT NULL AUTO_INCREMENT,`USERNAME` varchar(24) NOT NULL,`PASSWORD` char(65) NOT NULL,`SALT` char(11) NOT NULL,`RANK` varchar(30) NOT NULL, `SCORE` mediumint(7), `SKIN` mediumint(7), `ADMIN` mediumint(7), `CASH` mediumint(7) NOT NULL DEFAULT '0', `KILLS` mediumint(7),`DEATHS` mediumint(7) NOT NULL DEFAULT '0', `BANNED` mediumint(7), `BANREASON` varchar(50) NOT NULL, PRIMARY KEY (`ID`), UNIQUE KEY `USERNAME` (`USERNAME`))");
- //------------------------------------------------------------------------//
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnGameModeExit()
- {
- foreach(new i: Player)
- {
- if(IsPlayerConnected(i))
- {
- OnPlayerDisconnect(i, 1);
- }
- }
- //------------------------------------------------------------------------//
- mysql_close(Database);
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerText(playerid, text[])
- {
- if(!UlogovanIgrac[playerid]) return SendClientMessage(playerid, 0x0077C7FF, "[A-AC] {FFFFFF}Morate biti ulogovani da biste pisali.");
- new chatcd = gettime();
- if(chatcd < (TextCD[playerid] + 3) && PI[playerid][pAdmin] < 1)
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-AC] {FFFFFF}Mozete pisati svakih 3 sekunde.");
- return 0;
- }
- TextCD[playerid] = gettime();
- new str[200];
- if(PI[playerid][pAdmin] < 1) format(str, sizeof(str), "[%s] {FFFFFF}%s: %s.", IgracevRank[playerid], ImeIgraca(playerid), text);
- else format(str, sizeof(str), "[Admin %d] {FFFFFF}%s: %s.", PI[playerid][pAdmin], ImeIgraca(playerid), text);
- SendClientMessageToAll(0x0077C7FF, str);
- return 0;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerConnect(playerid)
- {
- new DB_Query[115];
- //------------------------------------------------------------------------//
- PI[playerid][pKills] = 0;
- PI[playerid][pDeaths] = 0;
- PI[playerid][pPasswordFails] = 0;
- NexACDetect[playerid] = false;
- UDMAreni[playerid] = 0;
- DuelIgrac[playerid] = -1;
- ZahtevZaDuel[playerid] = -1;
- //------------------------------------------------------------------------//
- KillsTD[playerid] = CreatePlayerTextDraw(playerid, 583.763183, 403.499816, "1000");
- PlayerTextDrawLetterSize(playerid, KillsTD[playerid], 0.252415, 0.765833);
- PlayerTextDrawAlignment(playerid, KillsTD[playerid], 1);
- PlayerTextDrawColor(playerid, KillsTD[playerid], 7849983);
- PlayerTextDrawSetShadow(playerid, KillsTD[playerid], 0);
- PlayerTextDrawSetOutline(playerid, KillsTD[playerid], 0);
- PlayerTextDrawBackgroundColor(playerid, KillsTD[playerid], 255);
- PlayerTextDrawFont(playerid, KillsTD[playerid], 1);
- PlayerTextDrawSetProportional(playerid, KillsTD[playerid], 1);
- PlayerTextDrawSetShadow(playerid, KillsTD[playerid], 0);
- //------------------------------------------------------------------------//
- DeathsTD[playerid] = CreatePlayerTextDraw(playerid, 595.007629, 416.333129, "1000");
- PlayerTextDrawLetterSize(playerid, DeathsTD[playerid], 0.252415, 0.765833);
- PlayerTextDrawAlignment(playerid, DeathsTD[playerid], 1);
- PlayerTextDrawColor(playerid, DeathsTD[playerid], 7849983);
- PlayerTextDrawSetShadow(playerid, DeathsTD[playerid], 0);
- PlayerTextDrawSetOutline(playerid, DeathsTD[playerid], 0);
- PlayerTextDrawBackgroundColor(playerid, DeathsTD[playerid], 255);
- PlayerTextDrawFont(playerid, DeathsTD[playerid], 1);
- PlayerTextDrawSetProportional(playerid, DeathsTD[playerid], 1);
- PlayerTextDrawSetShadow(playerid, DeathsTD[playerid], 0);
- //------------------------------------------------------------------------//
- RankTD[playerid] = CreatePlayerTextDraw(playerid, 587.979858, 428.583221, "Transformer");
- PlayerTextDrawLetterSize(playerid, RankTD[playerid], 0.242108, 0.742500);
- PlayerTextDrawAlignment(playerid, RankTD[playerid], 1);
- PlayerTextDrawColor(playerid, RankTD[playerid], 7849983);
- PlayerTextDrawSetShadow(playerid, RankTD[playerid], 0);
- PlayerTextDrawSetOutline(playerid, RankTD[playerid], 0);
- PlayerTextDrawBackgroundColor(playerid, RankTD[playerid], 255);
- PlayerTextDrawFont(playerid, RankTD[playerid], 1);
- PlayerTextDrawSetProportional(playerid, RankTD[playerid], 1);
- PlayerTextDrawSetShadow(playerid, RankTD[playerid], 0);
- //------------------------------------------------------------------------//
- NickTD[playerid] = CreatePlayerTextDraw(playerid, 599.224670, 440.833221, "Atrox_DM");
- PlayerTextDrawLetterSize(playerid, NickTD[playerid], 0.203689, 0.567500);
- PlayerTextDrawAlignment(playerid, NickTD[playerid], 2);
- PlayerTextDrawColor(playerid, NickTD[playerid], 7849983);
- PlayerTextDrawSetShadow(playerid, NickTD[playerid], 0);
- PlayerTextDrawSetOutline(playerid, NickTD[playerid], 0);
- PlayerTextDrawBackgroundColor(playerid, NickTD[playerid], 255);
- PlayerTextDrawFont(playerid, NickTD[playerid], 1);
- PlayerTextDrawSetProportional(playerid, NickTD[playerid], 1);
- PlayerTextDrawSetShadow(playerid, NickTD[playerid], 0);
- //------------------------------------------------------------------------//
- GetPlayerName(playerid, PI[playerid][pName], MAX_PLAYER_NAME);
- Corrupt_Check[playerid]++;
- //------------------------------------------------------------------------//
- mysql_format(Database, DB_Query, sizeof(DB_Query), "SELECT * FROM `PLAYERS` WHERE `USERNAME` = '%e' LIMIT 1", PI[playerid][pName]);
- mysql_tquery(Database, DB_Query, "OnPlayerDataCheck", "ii", playerid, Corrupt_Check[playerid]);
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerDisconnect(playerid, reason)
- {
- Corrupt_Check[playerid]++;
- //------------------------------------------------------------------------//
- new DB_Query[256];
- mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `SCORE` = %d, `CASH` = %d, `SKIN` = %d, `KILLS` = %d, `DEATHS` = %d WHERE `ID` = %d LIMIT 1",
- PI[playerid][pScore], PI[playerid][pCash], PI[playerid][pKills], PI[playerid][pDeaths], PI[playerid][pSkin], PI[playerid][pID]);
- PI[playerid][pSkin] = GetPlayerSkin(playerid);
- //------------------------------------------------------------------------//
- mysql_tquery(Database, DB_Query);
- //------------------------------------------------------------------------//
- if(cache_is_valid(PI[playerid][Player_Cache]))
- {
- cache_delete(PI[playerid][Player_Cache]);
- PI[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
- }
- //------------------------------------------------------------------------//
- UlogovanIgrac[playerid] = false;
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerDeath(playerid, killerid, reason)
- {
- SendDeathMessage(killerid, playerid, reason);
- //------------------------------------------------------------------------//
- if(UDMAreni[playerid] > 0)
- {
- switch(UDMAreni[playerid])
- {
- case 1:
- {
- new rand = random(sizeof(LVPD));
- SetPlayerVirtualWorld(playerid, 1001);
- SetPlayerInterior(playerid, 3);
- SetSpawnInfo(playerid, 0, PI[playerid][pSkin], LVPD[rand][0], LVPD[rand][1], LVPD[rand][2], 0.0, 24, 200, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- SetPlayerHealth(playerid, 99.0);
- SetPlayerArmour(playerid, 99.0);
- UDMAreni[playerid] = 1;
- }
- case 2:
- {
- new rand = random(sizeof(GTOWN));
- SetPlayerVirtualWorld(playerid, 1001);
- SetPlayerInterior(playerid, 3);
- SetSpawnInfo(playerid, 0, PI[playerid][pSkin], GTOWN[rand][0], GTOWN[rand][1], GTOWN[rand][2], 0.0, 24, 200, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- SetPlayerHealth(playerid, 99.0);
- SetPlayerArmour(playerid, 99.0);
- UDMAreni[playerid] = 2;
- }
- case 3:
- {
- new rand = random(sizeof(RCRAND));
- SetPlayerVirtualWorld(playerid, 1001);
- SetPlayerInterior(playerid, 3);
- SetSpawnInfo(playerid, 0, PI[playerid][pSkin], RCRAND[rand][0], RCRAND[rand][1], RCRAND[rand][2], 0.0, 24, 200, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- SetPlayerHealth(playerid, 99.0);
- SetPlayerArmour(playerid, 99.0);
- UDMAreni[playerid] = 3;
- }
- case 4:
- {
- new rand = random(sizeof(JM));
- SetPlayerVirtualWorld(playerid, 1001);
- SetPlayerInterior(playerid, 3);
- SetSpawnInfo(playerid, 0, PI[playerid][pSkin], JM[rand][0], JM[rand][1], JM[rand][2], 0.0, 24, 200, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- SetPlayerHealth(playerid, 99.0);
- SetPlayerArmour(playerid, 99.0);
- UDMAreni[playerid] = 4;
- }
- case 5:
- {
- new rand = random(sizeof(MF));
- SetPlayerVirtualWorld(playerid, 1001);
- SetPlayerInterior(playerid, 3);
- SetSpawnInfo(playerid, 0, PI[playerid][pSkin], MF[rand][0], MF[rand][1], MF[rand][2], 0.0, 24, 200, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- SetPlayerHealth(playerid, 99.0);
- SetPlayerArmour(playerid, 99.0);
- UDMAreni[playerid] = 5;
- }
- }
- }
- if(DuelIgrac[playerid] != -1)
- {
- new i = DuelIgrac[playerid], str[100];
- ResetPlayerWeapons(i);
- SetPlayerPos(i, 1958.33, 1343.12, 15.36);
- SetPlayerVirtualWorld(i, 0);
- SetPlayerInterior(i, 0);
- format(str, sizeof(str), "[DUEL] {FFFFFF}Igrac %s je pobedio %s u duelu.", ImeIgraca(i), ImeIgraca(playerid));
- SendClientMessageToAll(0x0077C7FF, str);
- SetSpawnInfo(playerid, 0, PI[playerid][pSkin], 1958.33, 1343.12, 15.36, 0.0, 24, 200, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- DuelIgrac[i] = -1;
- DuelIgrac[playerid] = -1;
- }
- if(killerid != INVALID_PLAYER_ID)
- {
- PI[killerid][pKills]++;
- PI[playerid][pDeaths]++;
- new str1[30];
- format(str1, sizeof(str1), "%d", PI[killerid][pKills]);
- PlayerTextDrawSetString(killerid, KillsTD[killerid], str1);
- format(str1, sizeof(str1), "%d", PI[playerid][pDeaths]);
- PlayerTextDrawSetString(playerid, DeathsTD[playerid], str1);
- switch(PI[killerid][pKills])
- {
- case 20:
- {
- new DB_Query[250], str[30];
- IgracevRank[killerid] = "Pee-Wee";
- SendClientMessage(killerid, 0x0077C7FF, "[A-DM] {FFFFFF}Cestitamo, unapredjeni ste u rank 'Pee-Wee' !");
- mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `RANK` = '%s' WHERE `ID` = %d LIMIT 1",
- IgracevRank[killerid], PI[killerid][pID]);
- mysql_tquery(Database, DB_Query);
- format(str, sizeof(str), "%s", IgracevRank[killerid]);
- PlayerTextDrawSetString(playerid, RankTD[killerid], str);
- }
- case 40:
- {
- new DB_Query[250], str[30];
- IgracevRank[killerid] = "Transformer";
- SendClientMessage(killerid, 0x0077C7FF, "[A-DM] {FFFFFF}Cestitamo, unapredjeni ste u rank 'Transformer' !");
- mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `RANK` = '%s' WHERE `ID` = %d LIMIT 1",
- IgracevRank[killerid], PI[killerid][pID]);
- mysql_tquery(Database, DB_Query);
- format(str, sizeof(str), "%s", IgracevRank[killerid]);
- PlayerTextDrawSetString(playerid, RankTD[killerid], str);
- }
- case 60:
- {
- new DB_Query[250], str[30];
- IgracevRank[killerid] = "HomeBoy";
- SendClientMessage(killerid, 0x0077C7FF, "[A-DM] {FFFFFF}Cestitamo, unapredjeni ste u rank 'HomeBoy' !");
- mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `RANK` = '%s' WHERE `ID` = %d LIMIT 1",
- IgracevRank[killerid], PI[killerid][pID]);
- mysql_tquery(Database, DB_Query);
- format(str, sizeof(str), "%s", IgracevRank[killerid]);
- PlayerTextDrawSetString(playerid, RankTD[killerid], str);
- }
- case 80:
- {
- new DB_Query[250], str[30];
- IgracevRank[killerid] = "Soldier";
- SendClientMessage(killerid, 0x0077C7FF, "[A-DM] {FFFFFF}Cestitamo, unapredjeni ste u rank 'Soldier' !");
- mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `RANK` = '%s' WHERE `ID` = %d LIMIT 1",
- IgracevRank[killerid], PI[killerid][pID]);
- mysql_tquery(Database, DB_Query);
- format(str, sizeof(str), "%s", IgracevRank[killerid]);
- PlayerTextDrawSetString(playerid, RankTD[killerid], str);
- }
- case 100:
- {
- new DB_Query[250], str[30];
- IgracevRank[killerid] = "High Roller";
- SendClientMessage(killerid, 0x0077C7FF, "[A-DM] {FFFFFF}Cestitamo, unapredjeni ste u rank 'High Roller' !");
- mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `RANK` = '%s' WHERE `ID` = %d LIMIT 1",
- IgracevRank[killerid], PI[killerid][pID]);
- mysql_tquery(Database, DB_Query);
- format(str, sizeof(str), "%s", IgracevRank[killerid]);
- PlayerTextDrawSetString(playerid, RankTD[killerid], str);
- }
- case 120:
- {
- new DB_Query[250], str[150];
- IgracevRank[killerid] = "GodFather";
- SendClientMessage(killerid, 0x0077C7FF, "[A-DM] {FFFFFF}Cestitamo, unapredjeni ste u rank 'GodFather' !");
- format(str, sizeof(str), "[ADM-INFO] {FFFFFF}Cestitamo ! Igrac %s je dostigao najveci rank - GodFather !", ImeIgraca(killerid));
- SendClientMessageToAll(0x0077C7FF, str);
- mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `RANK` = '%s' WHERE `ID` = %d LIMIT 1",
- IgracevRank[killerid], PI[killerid][pID]);
- mysql_tquery(Database, DB_Query);
- format(str, sizeof(str), "%s", IgracevRank[killerid]);
- PlayerTextDrawSetString(playerid, RankTD[killerid], str);
- }
- }
- }
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerRequestSpawn(playerid)
- {
- if(!UlogovanIgrac[playerid]) return 0;
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch (dialogid)
- {
- case DIALOG_LOGIN:
- {
- if(!response) return Kick(playerid);
- //----------------------------------------------------------------//
- new Salted_Key[65];
- SHA256_PassHash(inputtext, PI[playerid][pSalt], Salted_Key, 65);
- //----------------------------------------------------------------//
- if(strcmp(Salted_Key, PI[playerid][pPassword]) == 0)
- {
- cache_set_active(PI[playerid][Player_Cache]);
- //------------------------------------------------------------//
- cache_get_value_int(0, "ID", PI[playerid][pID]);
- cache_get_value_name(0, "RANK", IgracevRank[playerid], 30);
- cache_get_value_int(0, "ADMIN", PI[playerid][pAdmin]);
- cache_get_value_int(0, "KILLS", PI[playerid][pKills]);
- cache_get_value_int(0, "DEATHS", PI[playerid][pDeaths]);
- cache_get_value_name_int(0, "Skin", PI[playerid][pSkin]);
- cache_get_value_int(0, "SCORE", PI[playerid][pScore]);
- cache_get_value_int(0, "CASH", PI[playerid][pCash]);
- //------------------------------------------------------------//
- SetPlayerScore(playerid, PI[playerid][pScore]);
- //------------------------------------------------------------//
- SetPlayerSkin(playerid, PI[playerid][pSkin]);
- //------------------------------------------------------------//
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, PI[playerid][pCash]);
- //------------------------------------------------------------//
- cache_delete(PI[playerid][Player_Cache]);
- PI[playerid][Player_Cache] = MYSQL_INVALID_CACHE;
- //------------------------------------------------------------//
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Uspesno ste se prijavili.");
- SetSpawnInfo(playerid, 0, PI[playerid][pSkin], 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- }
- else
- {
- new String[150];
- //------------------------------------------------------------//
- PI[playerid][pPasswordFails] += 1;
- //------------------------------------------------------------//
- if (PI[playerid][pPasswordFails] >= 3)
- {
- format(String, sizeof(String), "[A-AC] {FFFFFF}%s je izbacen sa servera. Razlog: {0077C7}(3/3) Login greski.", PI[playerid][pName]);
- SendAdminMessage(0x0077C7FF, String);
- Kick(playerid);
- }
- else
- {
- format(String, sizeof(String), "Pogresna sifra, imas jos %d pokusaja.", 3-PI[playerid][pPasswordFails]);
- SendClientMessage(playerid, 0xFF0000FF, String);
- format(String, sizeof(String), "{FFFFFF}Dobrodosao nazad, {0077C7}%s.\n\n{FFFFFF}Upisite lozinku kako biste nastavili sa igrom.", PI[playerid][pName]);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{0077C7}ATROX {0077C7}D{FFFFFF}M", String, "Login", "Izlaz");
- }
- }
- }
- case DIALOG_REGISTER:
- {
- if(!response) return Kick(playerid);
- if(strlen(inputtext) <= 5 || strlen(inputtext) > 60)
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Lozinka mora sadrzati najmanje 5 slova, a najvise 60.");
- //------------------------------------------------------------//
- new String[150];
- //------------------------------------------------------------//
- format(String, sizeof(String), "{FFFFFF}Dobrodosao {0077C7}%s.\n\n{FFFFFF}Upisite zeljenu lozinku kako biste napravili nalog.\n\n", PI[playerid][pName]);
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{0077C7}ATROX {0077C7}D{FFFFFF}M", String, "Register", "Izlaz");
- }
- else
- {
- for (new i = 0; i < 10; i++)
- {
- PI[playerid][pSalt][i] = random(79) + 47;
- }
- //------------------------------------------------------------//
- PI[playerid][pSalt][10] = 0;
- SHA256_PassHash(inputtext, PI[playerid][pSalt], PI[playerid][pPassword], 65);
- //------------------------------------------------------------//
- new DB_Query[350], str[13];
- format(str, sizeof(str), "NIJE BANOVAN");
- IgracevRank[playerid] = "Newbie";
- PI[playerid][pSkin] = 1;
- //------------------------------------------------------------//
- mysql_format(Database, DB_Query, sizeof(DB_Query), "INSERT INTO `PLAYERS` (`USERNAME`, `PASSWORD`, `RANK`, `ADMIN`, `SALT`, `SCORE`, `KILLS`, `CASH`, `DEATHS`, `BANNED`, `BANREASON`)\
- VALUES ('%e', '%s', '%e', '0', '%e', '0', '0', '0', '0', '0', '%s')", PI[playerid][pName], PI[playerid][pPassword], IgracevRank[playerid], PI[playerid][pSalt], str);
- mysql_tquery(Database, DB_Query, "OnPlayerRegister", "d", playerid);
- }
- }
- case DIALOG_DMARENE:
- {
- if(!response) return 1;
- switch(listitem)
- {
- case 0:
- {
- if(InDM1 == 10) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Ta arena je puna (10/10).");
- new rand = random(sizeof(LVPD));
- SetPlayerVirtualWorld(playerid, 1001);
- SetPlayerInterior(playerid, 3);
- SetPlayerPos(playerid, LVPD[rand][0], LVPD[rand][1], LVPD[rand][2]);
- GivePlayerWeapon(playerid, 24, 200);
- SetPlayerHealth(playerid, 99.0);
- SetPlayerArmour(playerid, 99.0);
- UDMAreni[playerid] = 1;
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Usao si u DM Arenu 1 (LVPD).");
- InDM1 += 1;
- }
- case 1:
- {
- if(InDM2 == 10) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Ta arena je puna (10/10).");
- new rand = random(sizeof(GTOWN));
- SetPlayerVirtualWorld(playerid, 1002);
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, GTOWN[rand][0], GTOWN[rand][1], GTOWN[rand][2]);
- GivePlayerWeapon(playerid, 24, 200);
- GivePlayerWeapon(playerid, 25, 150);
- GivePlayerWeapon(playerid, 33,50);
- SetPlayerHealth(playerid, 99.0);
- SetPlayerArmour(playerid, 99.0);
- UDMAreni[playerid] = 2;
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Usao si u DM Arenu 2 (Ghost Town).");
- InDM2 += 1;
- }
- case 2:
- {
- if(InDM3 == 10) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Ta arena je puna (10/10).");
- new rand = random(sizeof(RCRAND));
- SetPlayerVirtualWorld(playerid, 1003);
- SetPlayerInterior(playerid, 10);
- SetPlayerPos(playerid, RCRAND[rand][0], RCRAND[rand][1], RCRAND[rand][2]);
- GivePlayerWeapon(playerid, 24, 200);
- GivePlayerWeapon(playerid, 25, 150);
- GivePlayerWeapon(playerid, 31, 300);
- GivePlayerWeapon(playerid, 34,50);
- SetPlayerHealth(playerid, 99.0);
- SetPlayerArmour(playerid, 99.0);
- UDMAreni[playerid] = 3;
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Usao si u DM Arenu 3 (RC Battlefield).");
- InDM3 += 1;
- }
- case 3:
- {
- if(InDM4 == 10) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Ta arena je puna (10/10).");
- new rand = random(sizeof(JM));
- SetPlayerVirtualWorld(playerid, 1004);
- SetPlayerInterior(playerid, 15);
- SetPlayerPos(playerid, JM[rand][0], JM[rand][1], JM[rand][2]);
- GivePlayerWeapon(playerid, 24, 200);
- GivePlayerWeapon(playerid, 25, 150);
- SetPlayerHealth(playerid, 99.0);
- SetPlayerArmour(playerid, 99.0);
- UDMAreni[playerid] = 4;
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Usao si u DM Arenu 4 (Jefferson Motel).");
- InDM4 += 1;
- }
- case 4:
- {
- if(InDM5 == 10) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Ta arena je puna (10/10).");
- new rand = random(sizeof(MF));
- SetPlayerVirtualWorld(playerid, 1005);
- SetPlayerInterior(playerid, 1);
- SetPlayerPos(playerid, MF[rand][0], MF[rand][1], MF[rand][2]);
- GivePlayerWeapon(playerid, 24, 200);
- GivePlayerWeapon(playerid, 25, 150);
- SetPlayerHealth(playerid, 99.0);
- SetPlayerArmour(playerid, 99.0);
- UDMAreni[playerid] = 5;
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Usao si u DM Arenu 5 (Meat Factory).");
- InDM5 += 1;
- }
- }
- }
- case DIALOG_DUEL:
- {
- if(response)
- {
- SetPlayerPos(playerid, 1560.6750,-1347.2893,329.4609);
- SetPlayerPos(ZahtevZaDuel[playerid], 1526.8954,-1358.4513,329.4609);
- DuelIgrac[playerid] = ZahtevZaDuel[playerid];
- DuelIgrac[ZahtevZaDuel[playerid]] = playerid;
- ZahtevZaDuel[playerid] = -1;
- ZahtevZaDuel[DuelIgrac[playerid]] = -1;
- GivePlayerWeapon(playerid, DuelOpcije[DuelIgrac[playerid]][0], DuelOpcije[DuelIgrac[playerid]][2]);
- GivePlayerWeapon(DuelIgrac[playerid], DuelOpcije[DuelIgrac[playerid]][0], DuelOpcije[DuelIgrac[playerid]][2]);
- GivePlayerWeapon(playerid, DuelOpcije[DuelIgrac[playerid]][1], DuelOpcije[DuelIgrac[playerid]][3]);
- GivePlayerWeapon(DuelIgrac[playerid], DuelOpcije[DuelIgrac[playerid]][1], DuelOpcije[DuelIgrac[playerid]][3]);
- SetPlayerHealth(playerid, DuelHP[DuelIgrac[playerid]]);
- SetPlayerArmour(playerid, DuelArmour[DuelIgrac[playerid]]);
- SetPlayerHealth(DuelIgrac[playerid], DuelHP[DuelIgrac[playerid]]);
- SetPlayerArmour(DuelIgrac[playerid], DuelArmour[DuelIgrac[playerid]]);
- SetPlayerVirtualWorld(playerid, 1006);
- SetPlayerVirtualWorld(DuelIgrac[playerid], 1006);
- SetPlayerInterior(playerid, 0);
- SetPlayerInterior(DuelIgrac[playerid], 0);
- UDMAreni[playerid] = 0;
- SekundeDuel[playerid] = 3;
- TimerODuel[playerid] = SetTimerEx("DuelOTimer", 1000, true, "uu", playerid, DuelIgrac[playerid]);
- GameTextForPlayer(playerid, "~r~3", 1000, 3);
- GameTextForPlayer(DuelIgrac[playerid], "~r~3", 1000, 3);
- TogglePlayerControllable(playerid, 0);
- TogglePlayerControllable(DuelIgrac[playerid], 0);
- }
- else
- {
- SendClientMessage(ZahtevZaDuel[playerid], 0x0077C7FF, "Igrac je odbio Vas zahtev za duel.");
- DuelOpcije[ZahtevZaDuel[playerid]][0] = 0; DuelOpcije[ZahtevZaDuel[playerid]][1] = 0;
- DuelOpcije[ZahtevZaDuel[playerid]][2] = 0; DuelOpcije[ZahtevZaDuel[playerid]][3] = 0;
- DuelHP[ZahtevZaDuel[playerid]] = 0; DuelArmour[ZahtevZaDuel[playerid]] = 0;
- ZahtevZaDuel[ZahtevZaDuel[playerid]] = -1;
- ZahtevZaDuel[playerid] = -1;
- }
- }
- }
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerSpawn(playerid)
- {
- UlogovanIgrac[playerid] = true;
- SendClientMessage(playerid, 0x0077C7FF, "========== {FFFFFF}ATROX DM{0077C7} ==========");
- SendClientMessage(playerid, 0x0077C7FF, "Dobrodosli na {FFFFFF}ATROX DM !");
- SendClientMessage(playerid, 0x0077C7FF, "Da vidite listu komadni, kucajte {FFFFFF}/help");
- SendClientMessage(playerid, 0x0077C7FF, "Ugodnu igru na serveru zeli vam {FFFFFF}A-DM Staff Team !");
- //------------------------------------------------------------------------//
- for(new i; i < 9; i++) TextDrawShowForPlayer(playerid, InGameTD[i]);
- PlayerTextDrawShow(playerid, KillsTD[playerid]); PlayerTextDrawShow(playerid, DeathsTD[playerid]);
- PlayerTextDrawShow(playerid, RankTD[playerid]); PlayerTextDrawShow(playerid, NickTD[playerid]);
- new str[30];
- format(str, sizeof(str), "%d", PI[playerid][pKills]);
- PlayerTextDrawSetString(playerid, KillsTD[playerid], str);
- format(str, sizeof(str), "%d", PI[playerid][pDeaths]);
- PlayerTextDrawSetString(playerid, DeathsTD[playerid], str);
- format(str, sizeof(str), "%s", IgracevRank[playerid]);
- PlayerTextDrawSetString(playerid, RankTD[playerid], str);
- format(str, sizeof(str), "%s", ImeIgraca(playerid));
- PlayerTextDrawSetString(playerid, NickTD[playerid], str);
- //------------------------------------------------------------------------//
- SetPlayerSkin(playerid, PI[playerid][pSkin]);
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
- {
- if(UDMAreni[playerid] == 0 && UDMAreni[issuerid] == 0)
- {
- new Float:hp;
- GetPlayerHealth(playerid, hp);
- SetPlayerHealth(playerid, hp+amount);
- if(weaponid > 0)
- {
- new str[150];
- format(str, sizeof(str), "[A-AC] {FFFFFF}Igrac %s ima oruzije ID: %d na spawnu!", ImeIgraca(issuerid), weaponid);
- ResetPlayerWeapons(issuerid);
- SendAdminMessage(0x0077C7FF, str);
- }
- }
- return 1;
- }
- //----------------------------------------------------------------------------//
- public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
- {
- if(!UlogovanIgrac[playerid])
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Morate biti ulogovani kako biste koristili komande.");
- return 0;
- }
- if(result == -1) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Nepoznata komanda, za listu komandi - /help !");
- new chatcd = gettime();
- if(chatcd < (CMDCD[playerid] + 3) && PI[playerid][pAdmin] < 1)
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-AC] {FFFFFF}Mozete koristiti komandu svakih 3 sekunde.");
- return 0;
- }
- CMDCD[playerid] = gettime();
- return 1;
- }
- //---------------------------- FORWARD + PUBLIC ------------------------------//
- forward DuelOTimer(playerid, id);
- public DuelOTimer(playerid, id)
- {
- new str[10];
- SekundeDuel[playerid]--;
- format(str, sizeof(str), "~r~%d", SekundeDuel[playerid]);
- GameTextForPlayer(playerid, str, 1000, 3);
- GameTextForPlayer(id, str, 1000, 3);
- if(SekundeDuel[playerid] == 0)
- {
- GameTextForPlayer(playerid, "~g~GO!!!", 2000, 3);
- GameTextForPlayer(id, "~g~GO!!!", 2000, 3);
- TogglePlayerControllable(playerid, true);
- KillTimer(TimerODuel[playerid]);
- TogglePlayerControllable(id, true);
- }
- return 1;
- }
- //----------------------------------------------------------------------------//
- forward OnCheatDetected(playerid, ip_address[], type, code);
- public OnCheatDetected(playerid, ip_address[], type, code)
- {
- if(!NexACDetect[playerid])
- {
- new str[200];
- format(str, sizeof(str), "[A-AC] {FFFFFF}Igrac %s moguce da ima %d hack, koristi /spec %d !", ImeIgraca(playerid), playerid);
- SendAdminMessage(0x0077C7FF, str);
- }
- return 1;
- }
- //----------------------------------------------------------------------------//
- forward public OnPlayerDataCheck(playerid, corrupt_check);
- public OnPlayerDataCheck(playerid, corrupt_check)
- {
- if (corrupt_check != Corrupt_Check[playerid]) return Kick(playerid);
- //------------------------------------------------------------------------//
- new String[150];
- //------------------------------------------------------------------------//
- if(cache_num_rows() > 0)
- {
- cache_get_value(0, "PASSWORD", PI[playerid][pPassword], 65);
- cache_get_value(0, "SALT", PI[playerid][pSalt], 11);
- cache_get_value_name_int(0, "BANNED", PI[playerid][pBanned]);
- cache_get_value(0, "BANREASON", PI[playerid][pBanReason], 50);
- //--------------------------------------------------------------------//
- if(PI[playerid][pBanned] == 1)
- {
- new str[200];
- format(str, sizeof(str), "{FFFFFF}BANNED !\n\nAdmin Vas je banovao. Razlog: %s.\nUkoliko ovo smatrate greskom, prijavite na forum.\nForum:www.atrox.epizy.com", PI[playerid][pBanReason]);
- ShowPlayerDialog(playerid, DIALOG_NORESPONSE, DIALOG_STYLE_MSGBOX, "{0077C7}ATROX {0077C7}D{FFFFFF}M", str, "U redu","");
- Agg_Kick(playerid);
- return 1;
- }
- //--------------------------------------------------------------------//
- PI[playerid][Player_Cache] = cache_save();
- //--------------------------------------------------------------------//
- format(String, sizeof(String), "{FFFFFF}Dobrodosao nazad, {0077C7}%s.\n\n{FFFFFF}Upisite lozinku kako biste nastavili sa igrom.", PI[playerid][pName]);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "{0077C7}ATROX {0077C7}D{FFFFFF}M", String, "Login", "Izlaz");
- }
- else
- {
- format(String, sizeof(String), "{FFFFFF}Dobrodosao {0077C7}%s.\n\n{FFFFFF}Upisite zeljenu lozinku kako biste napravili nalog.\n\n", PI[playerid][pName]);
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "{0077C7}ATROX {0077C7}D{FFFFFF}M", String, "Register", "Izlaz");
- }
- return 1;
- }
- //----------------------------------------------------------------------------//
- forward public OnPlayerRegister(playerid);
- public OnPlayerRegister(playerid)
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Uspesno ste kreirali nalog.");
- SetSpawnInfo(playerid, 0, PI[playerid][pSkin], 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- return 1;
- }
- //----------------------------------------------------------------------------//
- forward Agg_Kick(playerid);
- public Agg_Kick(playerid)
- {
- SetTimerEx("KickIgraca", 500, false, "d", playerid);
- return 1;
- }
- //----------------------------------------------------------------------------//
- forward KickIgraca(playerid);
- public KickIgraca(playerid)
- {
- Kick(playerid);
- return 1;
- }
- //-------------------------------- FUNCTIONS ---------------------------------//
- SendAdminMessage(color, string[])
- {
- for(new i; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i) && PI[i][pAdmin] > 0)
- {
- SendClientMessage(i, color, string);
- }
- }
- return 1;
- }
- //----------------------------------------------------------------------------//
- ImeIgraca(id)
- {
- new ime[MAX_PLAYER_NAME];
- GetPlayerName(id, ime, sizeof ime);
- return ime;
- }
- //----------------------------------------------------------------------------//
- GetName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, sizeof(name));
- return name;
- }
- //-------------------------------- Admin's Commands --------------------------//
- CMD:makeadmin(playerid, params[])
- {
- new id, lvl, str[250], DB_Query[200];
- if(PI[playerid][pAdmin] < 3 && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Niste ovlasceni.");
- if(sscanf(params, "ud", id, lvl)) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}/makeadmin [ID] [Level 0-3]");
- if(!UlogovanIgrac[id]) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Taj igrac nije ulogovan.");
- if(lvl < 0 || lvl > 3) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Level admina 0-3.");
- if(lvl == PI[id][pAdmin]) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Taj igrac vec ima admina tog levela.");
- if(!strcmp(ImeIgraca(id), "Aggressive", true) && lvl < PI[id][pAdmin])
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Pokusao si Aggressive da spustis admin level? Prijavljen si!");
- format(str, sizeof(str), "Igrac %s je pokusao da ti spusti admin level na %d !", ImeIgraca(playerid), lvl);
- SendClientMessage(id, 0xFF1414FF, str);
- return 1;
- }
- new Year, Month, Day, Hour, Minute, Second;
- getdate(Year, Month, Day);
- gettime(Hour, Minute, Second);
- if(lvl == 0)
- {
- PI[id][pAdmin] = 0;
- format(str, sizeof(str), "[A-AC] {FFFFFF}Admin %s je skinuo admina igracu %s.", ImeIgraca(playerid), ImeIgraca(id));
- SendAdminMessage(0x0077C7FF, str);
- format(str, sizeof(str), "[A-DM] {FFFFFF}Admin %s Vam je skinuo admina.", ImeIgraca(playerid));
- SendClientMessage(id, 0x0077C7FF, "============= {FFFFFF}SKIDANJE ADMINA {0077C7}=============");
- SendClientMessage(id, 0x0077C7FF, str);
- SendClientMessage(id, 0x0077C7FF, "[A-DM] {FFFFFF}Ukoliko imate zalbu, postavite na forum.");
- SendClientMessage(id, 0x0077C7FF, "[A-DM] {FFFFFF}www.atrox.epizy.com");
- format(str, sizeof(str), "[A-DM] {FFFFFF}%d.%d.%d. %d:%d:%d", Day, Month, Year, Hour, Minute, Second);
- SendClientMessage(id, 0x0077C7FF, str);
- mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `ADMIN` = %d WHERE `ID` = %d LIMIT 1",
- PI[id][pAdmin], PI[id][pID]);
- mysql_tquery(Database, DB_Query);
- }
- else if(lvl < PI[id][pAdmin])
- {
- PI[id][pAdmin] = lvl;
- format(str, sizeof(str), "[A-AC] {FFFFFF}Admin %s je spustio admina igracu %s na %d.", ImeIgraca(playerid), ImeIgraca(id), lvl);
- SendAdminMessage(0x0077C7FF, str);
- format(str, sizeof(str), "[A-DM] {FFFFFF}Admin %s Vam je spustio admin level na %d.", ImeIgraca(playerid), lvl);
- SendClientMessage(id, 0x0077C7FF, "============= {FFFFFF}SPUSTANJE ADMIN LEVELA {0077C7}=============");
- SendClientMessage(id, 0x0077C7FF, str);
- SendClientMessage(id, 0x0077C7FF, "[A-DM] {FFFFFF}Ukoliko imate zalbu, postavite na forum.");
- SendClientMessage(id, 0x0077C7FF, "[A-DM] {FFFFFF}www.atrox.epizy.com");
- format(str, sizeof(str), "[A-DM] {FFFFFF}%d.%d.%d. %d:%d:%d", Day, Month, Year, Hour, Minute, Second);
- SendClientMessage(id, 0x0077C7FF, str);
- mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `ADMIN` = %d WHERE `ID` = %d LIMIT 1",
- PI[id][pAdmin], PI[id][pID]);
- mysql_tquery(Database, DB_Query);
- }
- else if(lvl > PI[id][pAdmin])
- {
- format(str, sizeof(str), "{FFFFFF}Cestitamo!\n\nPostali ste admin level {0077C7}%d{FFFFFF}.\nAdmina %d Vam je dao admin %s.\n\nSrecno, opdavdajte svoju poziciju!", lvl, lvl, ImeIgraca(playerid));
- ShowPlayerDialog(id, DIALOG_NORESPONSE, DIALOG_STYLE_MSGBOX, "{0077C7}ATROX {0077C7}D{FFFFFF}M", str, "U redu","");
- format(str, sizeof(str), "[A-AC] {FFFFFF}Admin %s je dao admina level %d igracu %s.", ImeIgraca(playerid), lvl, ImeIgraca(id));
- SendAdminMessage(0x0077C7FF, str);
- PI[id][pAdmin] = lvl;
- mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `ADMIN` = %d WHERE `ID` = %d LIMIT 1",
- PI[id][pAdmin], PI[id][pID]);
- mysql_tquery(Database, DB_Query);
- }
- return 1;
- }
- CMD:ban(playerid, params[])
- {
- new id, razlog[50], str[200];
- if(PI[playerid][pAdmin] < 1) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Niste ovlasceni.");
- if(sscanf(params, "us[50]", id, razlog)) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}/ban [ID] [Razlog]");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Pogresan ID.");
- if(!strcmp(ImeIgraca(id), "Aggressive", true))
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Pokusao si Aggressive da banujes? Prijavljen si!");
- format(str, sizeof(str), "Igrac %s je pokusao da te banuje !", ImeIgraca(playerid));
- SendClientMessage(id, 0xFF1414FF, str);
- return 1;
- }
- if(PI[id][pAdmin] > PI[playerid][pAdmin])
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Pokusao si veceg admina od sebe da banujes? Prijavljen si!");
- format(str, sizeof(str), "Igrac %s je pokusao da te banuje !", ImeIgraca(playerid));
- SendClientMessage(id, 0xFF1414FF, str);
- return 1;
- }
- new Year, Month, Day, Hour, Minute, Second, query[150];
- getdate(Year, Month, Day);
- gettime(Hour, Minute, Second);
- format(str, sizeof(str), "[BAN] {FFFFFF}Igrac %s je banovan od strane admina. Razlog: {0077C7}%s.", ImeIgraca(id), razlog);
- SendClientMessageToAll(0x0077C7FF, str);
- format(str, sizeof(str), "[A-AC] {FFFFFF}Admin %s je banovao %s. Razlog: %s.", ImeIgraca(playerid), ImeIgraca(id), razlog);
- SendAdminMessage(0x0077C7FF, str);
- format(str, sizeof(str), "{FFFFFF}BANNED !\n\nAdmin %s Vas je banovao. Razlog: %s.\nUkoliko ovo smatrate greskom, prijavite na forum.\nForum:www.atrox.epizy.com\n\n%d.%d.%d. %d:%d:%d", ImeIgraca(playerid), razlog, Day, Month, Year, Hour, Minute, Second);
- ShowPlayerDialog(playerid, DIALOG_NORESPONSE, DIALOG_STYLE_MSGBOX, "{0077C7}ATROX {0077C7}D{FFFFFF}M", str, "U redu","");
- mysql_format(Database, query, sizeof(query), "UPDATE `PLAYERS` SET `BANNED` = '1', `BANREASON` = '%s' WHERE `ID` = %d LIMIT 1", razlog, PI[id][pID]);
- mysql_tquery(Database, query);
- Agg_Kick(id);
- return 1;
- }
- CMD:unban(playerid, params[])
- {
- new pname[MAX_PLAYER_NAME], str[80], query[130];
- if(PI[playerid][pAdmin] < 1) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Niste ovlasceni.");
- if(sscanf(params, "s[MAX_PLAYER_NAME]", pname)) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}/unban [Ime Igraca]");
- mysql_format(Database, query, sizeof(query), "UPDATE `PLAYERS` SET `BANNED` = '0', `BANREASON` = 'NIJE BANOVAN' WHERE `USERNAME` = '%s' LIMIT 1", pname);
- mysql_tquery(Database, query);
- format(str, sizeof(str), "[A-AC] {FFFFFF}Admin %s je unban %s.", ImeIgraca(playerid), pname);
- SendAdminMessage(0x0077C7FF, str);
- return 1;
- }
- CMD:kick(playerid, params[])
- {
- new id, razlog[50], str[200];
- if(PI[playerid][pAdmin] < 1) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Niste ovlasceni.");
- if(sscanf(params, "us[50]", id, razlog)) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}/kick [ID] [Razlog]");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Pogresan ID.");
- if(!strcmp(ImeIgraca(id), "Aggressive", true))
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Pokusao si Aggressive da kickujes? Prijavljen si!");
- format(str, sizeof(str), "Igrac %s je pokusao da te kickuje !", ImeIgraca(playerid));
- SendClientMessage(id, 0xFF1414FF, str);
- return 1;
- }
- if(PI[id][pAdmin] > PI[playerid][pAdmin])
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Pokusao si veceg admina od sebe da kickujes? Prijavljen si!");
- format(str, sizeof(str), "Igrac %s je pokusao da te kickuje !", ImeIgraca(playerid));
- SendClientMessage(id, 0xFF1414FF, str);
- return 1;
- }
- format(str, sizeof(str), "[KICK] {FFFFFF}Izbaceni ste sa servera. Razlog: {0077C7}%s.", razlog);
- SendClientMessage(playerid, 0x0077C7FF, str);
- format(str, sizeof(str), "[A-AC] {FFFFFF}Admin %s je kick %s. Razlog: %s.", ImeIgraca(playerid), ImeIgraca(id), razlog);
- SendAdminMessage(0x0077C7FF, str);
- Agg_Kick(id);
- return 1;
- }
- CMD:gethere(playerid,params[])
- {
- new id, targetid, Float:x, Float:y, Float:z;
- if(PI[playerid][pAdmin] < 1) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Niste ovlasceni.");
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}/gethere [ID]");
- if(!UlogovanIgrac[id]) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Taj igrac nije ulogovan.");
- GetPlayerPos(playerid, x, y, z);
- SetPlayerPos(targetid, x+1, y+1, z);
- return 1;
- }
- CMD:askin(playerid, params[])
- {
- if(PI[playerid][pAdmin] < 1)
- {
- new id, pplayerid, skin, skinid, string[128];
- if(sscanf(params, "ui", pplayerid,skin)) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}/askin [ID/Ime_Prezime][ID/Skin]");
- if(!UlogovanIgrac[id]) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Taj igrac nije ulogovan.");
- if(skinid < 0 || skinid > 311) SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}ID Skina 0-311");
- PI[pplayerid][pSkin] = skin;
- SetPlayerSkin(pplayerid, skin);
- format(string, sizeof(string), "{FFFFFF}[A-DM] {ffffff}Admin %s vam je setovao skin ID %d!",GetName(playerid),skin);
- SendClientMessage(pplayerid,-1,string);
- format(string, sizeof(string), "{FFFFFF}[A-DM] {ffffff}Uspesno ste postavili skin igracu %s!",GetName(pplayerid));
- SendClientMessage(playerid,-1,string);
- }
- else
- {
- SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Niste ovlasceni.");
- }
- return 1;
- }
- //------------------------------ Player's Commands ---------------------------//
- CMD:dm(playerid, params[])
- {
- if(UDMAreni[playerid] > 0) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Prvo izadjite iz DM arene, /lobby !");
- if(DuelIgrac[playerid] != -1) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Prvo izadjite iz duela, /napustiduel !");
- new string[280];
- format(string, sizeof(string), "LVPD (%d/10 igraca)\nGhost Town (%d/10 igraca)\nRC Battlefield (%d/10 igraca)\nJeferson Motel (%d/10 igraca)\nMeat Factory (%d/10 igraca)", InDM1, InDM2, InDM3, InDM4, InDM5);
- ShowPlayerDialog(playerid, DIALOG_DMARENE, DIALOG_STYLE_LIST, "{0077C7}ATROX {0077C7}D{FFFFFF}M", string, "Izaberi","Izlaz");
- return 1;
- }
- CMD:duel(playerid, params[])
- {
- new id, w1, w2, wa1, wa2, Float:hp, Float:ar, str[150];
- if(sscanf(params, "uddddff", id, w1, w2, wa1, wa2, hp, ar)) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}/duel [ID] [Weapon 1] [Weapon 2] [Weapon Ammo 1] [Weapon Ammo 2] [Health] [Armour]");
- if(w1 < 1 || w1 > 34 || w2 < 1 || w2 > 34) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}ID Oruzija 1-34");
- if(wa1 < 50 || wa2 < 50) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Municija oruzija (Ammo) ne sme biti manja od 50.");
- if(hp < 10 || hp > 100 || ar > 100 || ar < 0) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Health 10-100, Armour 0-100");
- if(!UlogovanIgrac[id]) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Taj igrac nije ulogovan.");
- if(UDMAreni[playerid] > 0) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Prvo izadjite iz DM arene, /lobby !");
- if(DuelIgrac[playerid] != -1) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Vec ste u duelu.");
- if(DuelIgrac[id] != -1) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Taj igrac je vec u duelu.");
- if(ZahtevZaDuel[playerid] != -1) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Vec ste poslali zahtev.");
- if(ZahtevZaDuel[id] != -1) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Taj igrac je vec primio zahtev za duel.");
- //if(playerid == id) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Ne mozete samog sebe pozvati na duel.");
- format(str, sizeof(str), "{FFFFFF}Igrac %s Vas je izazvao na duel.\nDa prihvatite, pritisnite 'Prihvati'.\nDa odbijete, pritisnite 'Odbij'.", ImeIgraca(playerid));
- ShowPlayerDialog(id, DIALOG_DUEL, DIALOG_STYLE_MSGBOX, "{0077C7}ATROX {0077C7}D{FFFFFF}M", str, "Prihvati","Odbij");
- ZahtevZaDuel[id] = playerid;
- ZahtevZaDuel[playerid] = id;
- DuelOpcije[playerid][0] = w1; DuelOpcije[playerid][1] = w2;
- DuelOpcije[playerid][2] = wa1; DuelOpcije[playerid][3] = wa2;
- DuelHP[playerid] = hp; DuelArmour[playerid] = ar;
- SendClientMessage(playerid, 0x0077C7FF, "Poslali ste zahtev za duel.");
- return 1;
- }
- CMD:lobby(playerid, params[])
- {
- if(UDMAreni[playerid] == 0) return SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}Niste u DM areni.");
- ResetPlayerWeapons(playerid);
- UDMAreni[playerid] = 0;
- SetPlayerPos(playerid, 1958.33, 1343.12, 15.36);
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerInterior(playerid, 0);
- return 1;
- }
- CMD:skin(playerid,params[])
- {
- new skinnumber, skinid, string[128];
- if(sscanf(params, "d", skinid)) SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}/skin [ID]");
- else if(skinid < 1 || skinid > 299) SendClientMessage(playerid, 0x0077C7FF, "[A-DM] {FFFFFF}ID Skina 1-299");
- else
- {
- SetPlayerSkin(playerid, skinid);
- skinnumber = GetPlayerSkin(playerid);
- format(string, sizeof(string), "{FFFFFF}[A-DM] {ffffff}Uspijesno ste promijenili skin %d", skinnumber);
- SendClientMessage(playerid, -1, string);
- }
- return 1;
- }
- CMD:help(playerid, params[])
- {
- ShowPlayerDialog(playerid, DIALOG_NORESPONSE, DIALOG_STYLE_MSGBOX, "{0077C7}ATROX {0077C7}D{FFFFFF}M", "/dm /duel /lobby /skin", "U redu","");
- return 1;
- }
- /*
- Zavrsetak skripte ATROX DM v1.0 by Aggressive
- © All rights reserved
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement