Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////////////////////////////////////////////////////////
- // Name: Call of Duty 2 [COD2] //
- // Author: Rapha3L, Hollywood/DJTunes, JJB562 //
- // Script Version: 0.1 //
- // Last Update: Never //
- // Helpers: [_MS_]BodyBuilder, CaptainPrice //
- // Thanks to: [_MS_]BodyBuilder //
- // Info: This is a simple base to DM Servers. Check out the updates. //
- // Notice: This is an edited version of Rapha3L's TDM script. //
- ////////////////////////////////////////////////////////////////////////////////
- // Updates //
- // ||--- 6/17/2013 Updates ---|| //
- // - Added Login & Register System. //
- // - Login & Register System bugged. //
- // ||--- 6/18/2013 Updates ---|| //
- // - Login & Register System bug was fixed by JJB562 //
- // - Added Welcome Messages to OnPlayerConnect //
- // - Added /help as a command. //
- // - Added /info as a command. //
- // - Added /credits as a command. //
- // - Added /svrinfo as a command. //
- // ||--- 6/19/2013 Updates ---|| //
- // - Added experience to each kill you get. //
- // - Added an AFK system. //
- // - Edited the /help command with new commands. //
- // - When buying pack2, it takes away 1000$ //
- // - When buying frags, it takes away 1000$ //
- // - When buying a medical kit, it takes away 500$ //
- // - Players no longer spawn with money. (money earned) //
- // - Added a new scripter. //
- // - Players now earn experience, and it saves as you log out. //
- ////////////////////////////////////////////////////////////////////////////////
- //---[Includes]---//
- #include <a_samp>
- #include <sscanf2>
- #include <zcmd>
- #include <YSI\y_ini>
- //---[Login Dialogs]---//
- #define DIALOG_REGISTER 1
- #define DIALOG_LOGIN 2
- #define DIALOG_SUCCESS_1 3
- #define DIALOG_SUCCESS_2 4
- #define PATH "/Users/%s.ini"
- //---[Colors---//
- #define COL_WHITE "{FFFFFF}"
- #define COL_RED "{F81414}"
- #define COL_GREEN "{00FF22}"
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xFF0000
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_LIME 0x10F441AA
- #define COLOR_MAGENTA 0xFF00FFFF
- #define COLOR_NAVY 0x000080AA
- #define COLOR_AQUA 0xF0F8FFAA
- #define COLOR_CRIMSON 0xDC143CAA
- #define COLOR_FLBLUE 0x6495EDAA
- #define COLOR_BISQUE 0xFFE4C4AA
- #define COLOR_BLACK 0x000000AA
- #define COLOR_CHARTREUSE 0x7FFF00AA
- #define COLOR_BROWN 0XA52A2AAA
- #define COLOR_CORAL 0xFF7F50AA
- #define COLOR_GOLD 0xB8860BAA
- #define COLOR_GREENYELLOW 0xADFF2FAA
- #define COLOR_INDIGO 0x4B00B0AA
- #define COLOR_IVORY 0xFFFF82AA
- #define COLOR_LAWNGREEN 0x7CFC00AA
- #define COLOR_SEAGREEN 0x20B2AAAA
- #define COLOR_LIMEGREEN 0x32CD32AA
- #define COLOR_MIDNIGHTBLUE 0X191970AA
- #define COLOR_MAROON 0x800000AA
- #define COLOR_OLIVE 0x808000AA
- #define COLOR_ORANGERED 0xFF4500AA
- #define COLOR_PINK 0xFFC0CBAA
- #define COLOR_SPRINGGREEN 0x00FF7FAA
- #define COLOR_TOMATO 0xFF6347AA
- #define COLOR_YELLOWGREEN 0x9ACD32AA
- #define COLOR_MEDIUMAQUA 0x83BFBFAA
- #define COLOR_MEDIUMMAGENTA 0x8B008BAA
- //---[Login & Register System Variables]---//
- enum pInfo
- {
- pPass,
- pCash,
- pAdmin,
- pKills,
- pDeaths,
- Xp
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- //---[Login & Register System Stocks]---//
- stock UserPath(playerid)
- {
- new string[128], playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),PATH,playername);
- return string;
- }
- 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;
- }
- //---[Login & Register System Functions]---//
- forward LoadUser_data(playerid,name[],value[]);
- public LoadUser_data(playerid,name[],value[])
- {
- INI_Int("Password",PlayerInfo[playerid][pPass]);
- INI_Int("Cash",PlayerInfo[playerid][pCash]);
- INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
- INI_Int("Kills",PlayerInfo[playerid][pKills]);
- INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
- return 1;
- }
- //---[AFK System]---//
- new pName[24]; //Setting up the variables.
- new afkstr[128]; //^^
- new pName2[24]; //^^
- new str2[128]; //^^
- new IsAFK[MAX_PLAYERS]; //^^
- //---[Random Messages Settings (Settings)---//
- new RandomMSG[][] =
- {
- "Welcome to Call of Duty 2, scripted by Hollywood (DJTunes)!",
- "The release of this script is posted on SA-MP forums.",
- "Please be sure to add reputation to DJTunes!"
- };
- //---[Random Messages Settings (Foward)]---//
- forward SendMSG();
- //---[Random Messages Settings (Settings)---//
- public SendMSG()
- {
- new randMSG = random(sizeof(RandomMSG));
- SendClientMessageToAll(COLOR_GREEN, RandomMSG[randMSG]);
- }
- //---[Random Spawns]---//
- new Float:RandomSpawns[][] =
- {
- {-1513.3469,2536.8325,55.6875,46.0863},
- {-1534.5206,2543.3533,55.8359,64.1873},
- {-1537.3022,2560.8057,55.8359,9.9801},
- {-1537.1564,2592.4919,55.8359,347.1066},
- {-1552.3397,2600.5630,55.8359,36.6137},
- {-1523.5328,2608.2029,55.8359,289.7661},
- {-1489.5654,2607.8162,55.8359,291.6460},
- {-1479.0426,2595.0493,55.8359,39.5787},
- {-1460.0007,2619.5195,58.7734,152.6931},
- {-1435.4955,2608.3745,55.8359,274.4125},
- {-1420.5632,2613.4656,55.8359,146.4264},
- {-1414.7498,2594.2373,55.8403,51.7988},
- {-1458.2444,2641.4443,55.8359,38.4703},
- {-1476.6389,2661.3892,55.8359,56.9571},
- {-1507.6934,2663.9001,55.8359,81.7107},
- {-1528.0374,2677.3118,55.8359,171.7108},
- {-1562.5850,2662.7412,55.8359,349.1795},
- {-1539.6945,2623.1128,55.8359,196.7286},
- {-1513.9823,2594.6506,55.8359,279.3923}
- };
- //---[Textdraw - Server Name]---//
- new Text:Textdraw1;
- //---[Server Configs + Objects & Skins]---//
- public OnGameModeInit()
- {
- SetTimer("SendMSG", 120000, true);
- SetGameModeText("COD2");
- SendRconCommand("mapname Downturn");
- UsePlayerPedAnims();
- DisableInteriorEnterExits();
- Textdraw1= TextDrawCreate(1.0, 433.0, "Call of Duty 2 v0.1");
- TextDrawAlignment(Textdraw1,0);
- TextDrawBackgroundColor(Textdraw1,0x000000ff);
- TextDrawFont(Textdraw1,2);
- TextDrawLetterSize(Textdraw1,0.2999, 1.4);
- TextDrawBoxColor(Textdraw1,0x00000050);
- TextDrawColor(Textdraw1,0xffffffff);
- TextDrawSetOutline(Textdraw1,1);
- TextDrawSetProportional(Textdraw1,1);
- TextDrawSetShadow(Textdraw1,1);
- for(new i; i < MAX_PLAYERS; i ++)
- {
- if(IsPlayerConnected(i))
- {
- TextDrawShowForPlayer(i, Textdraw1);
- }
- }
- //---[Skins]---//
- AddPlayerClass(18, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
- AddPlayerClass(19, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
- AddPlayerClass(17, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
- AddPlayerClass(23, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
- AddPlayerClass(29, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
- AddPlayerClass(45, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
- AddPlayerClass(78, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
- AddPlayerClass(97, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
- AddPlayerClass(101, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
- AddPlayerClass(145, 1958.3783, 1343.1572, 15.3746, 269.1425, 24, 9999, 25, 9999, 34, 500);
- //---[Cars]---//
- AddStaticVehicleEx(475,-1507.6999500,2526.6999500,55.6000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(542,-1522.6999500,2526.6999500,55.6000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(562,-1482.6999500,2560.3000500,55.6000000,50.0000000,-1,-1,15);
- AddStaticVehicleEx(562,-1485.8000500,2545.6001000,55.6000000,203.9990000,-1,-1,15);
- AddStaticVehicleEx(477,-1522.5000000,2588.5000000,55.7000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(477,-1502.0999800,2635.3999000,55.7000000,196.0000000,-1,-1,15);
- AddStaticVehicleEx(411,-1472.1999500,2691.0000000,55.6000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(411,-1445.1999500,2682.5000000,55.6000000,124.0000000,-1,-1,15);
- AddStaticVehicleEx(411,-1400.0000000,2653.1999500,55.5000000,87.9970000,-1,-1,15);
- AddStaticVehicleEx(411,-1400.0000000,2638.1999500,55.5000000,87.9950000,-1,-1,15);
- AddStaticVehicleEx(555,-1432.4000200,2591.8999000,55.6000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(555,-1446.4000200,2589.0000000,55.6000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(555,-1464.1999500,2589.3000500,55.6000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(536,-1563.9000200,2687.8999000,55.5000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(567,-1559.8000500,2693.6999500,55.8000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(535,-1596.0999800,2692.6999500,54.8000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(401,-1560.0999800,2632.8000500,55.7000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(506,-1532.0000000,2641.8999000,55.6000000,60.0000000,-1,-1,15);
- AddStaticVehicleEx(477,-1567.9000200,2640.3999000,55.7000000,290.0000000,-1,-1,15);
- //---[Objects]---//
- //---[Drift]---//
- AddStaticVehicleEx(411,-342.8999900,1515.5999800,75.2000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(411,-339.7000100,1515.5000000,75.2000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(560,-330.2000100,1515.3000500,75.2000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(560,-333.2000100,1515.5000000,75.2000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(411,-336.2999900,1514.8000500,75.2000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(560,-327.3999900,1514.9000200,75.2000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(562,-324.1000100,1515.4000200,75.1000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(562,-321.1000100,1515.3000500,75.1000000,0.0000000,-1,-1,15);
- AddStaticVehicleEx(562,-318.0000000,1514.9000200,75.1000000,0.0000000,-1,-1,15);
- CreateObject(3749,-302.2999900,1510.0000000,80.2000000,0.0000000,0.0000000,0.0000000);
- CreateObject(3516,-304.0000000,1511.6999500,77.6000000,0.0000000,0.0000000,192.0000000);
- //---[Parkour]---//
- CreateObject(972,1531.47973600,-1359.22656300,328.45034800,0.00000000,0.00000000,0.00000000);
- CreateObject(972,1550.99121100,-1359.23681600,328.45581100,0.00000000,0.00000000,0.00000000);
- CreateObject(972,1542.70861800,-1365.28625500,328.15380900,0.00000000,0.00000000,-89.38141604);
- CreateObject(974,1551.05700700,-1345.10205100,331.23623700,0.00000000,0.00000000,0.00000000);
- CreateObject(974,1538.19177200,-1345.07312000,331.24121100,0.00000000,0.00000000,0.00000000);
- CreateObject(978,1544.50683600,-1337.02807600,329.04757700,94.53809349,0.00000000,-88.52197935);
- CreateObject(978,1544.70898400,-1345.88708500,327.34652700,-245.79883682,256.97151382,14.61042378);
- CreateObject(978,1544.23742700,-1324.61401400,329.04776000,94.53809349,0.00000000,-88.52197935);
- CreateObject(974,1544.29467800,-1316.17517100,328.01788300,91.95972612,0.00000000,0.00000000);
- CreateObject(974,1544.08886700,-1307.95434600,326.07467700,91.95972612,0.00000000,0.00000000);
- CreateObject(974,1544.86120600,-1299.68432600,328.92422500,91.95972612,0.00000000,0.00000000);
- CreateObject(974,1553.25988800,-1299.90087900,330.80770900,91.95972612,0.00000000,0.00000000);
- CreateObject(974,1560.94299300,-1300.69543500,328.54486100,91.95972612,0.00000000,0.00000000);
- CreateObject(974,1564.03942900,-1299.92248500,331.32266200,183.91950953,0.00000000,-89.38141604);
- CreateObject(974,1561.32983400,-1292.13647500,326.95224000,91.95972612,0.00000000,0.00000000);
- CreateObject(974,1562.18335000,-1287.30468800,324.15411400,91.95972612,0.00000000,0.00000000);
- CreateObject(3258,1559.69677700,-1287.83447300,322.73663300,118.60232089,0.00000000,-88.52197935);
- CreateObject(3257,1555.85412600,-1255.20996100,276.35571300,0.00000000,0.00000000,0.00000000);
- CreateObject(3287,1565.30419900,-1254.09912100,288.89392100,0.00000000,0.00000000,0.00000000);
- CreateObject(3287,1571.85827600,-1254.17468300,288.93530300,0.00000000,0.00000000,0.00000000);
- CreateObject(3502,1537.46252400,-1282.56335400,314.28128100,0.00000000,0.00000000,0.00000000);
- CreateObject(3502,1538.06433100,-1274.25805700,313.83450300,-6.01605685,0.00000000,-7.73493023);
- CreateObject(3502,1539.64648400,-1267.35376000,312.58728000,-12.03211370,0.00000000,-16.32929716);
- CreateObject(3502,1541.58178700,-1256.78161600,307.05413800,-85.08423258,0.00000000,-16.32929716);
- CreateObject(974,1541.15478500,-1254.38464400,311.65838600,91.95972612,0.00000000,0.00000000);
- CreateObject(974,1541.23645000,-1262.01538100,310.14981100,91.95972612,0.00000000,0.00000000);
- CreateObject(974,1546.33313000,-1258.03479000,310.41314700,91.95972612,0.00000000,0.00000000);
- CreateObject(974,1536.39111300,-1257.45532200,310.30587800,91.95972612,0.00000000,11.17267701);
- CreateObject(974,1540.46557600,-1255.21789600,298.40844700,91.95972612,0.00000000,3.43774677);
- CreateObject(974,1544.44763200,-1255.29968300,298.42996200,91.95972612,0.00000000,-4.29718346);
- CreateObject(3257,1585.73034700,-1253.02539100,272.12976100,0.00000000,0.00000000,-88.52197935);
- CreateObject(3257,1585.98681600,-1261.29406700,272.13314800,0.00000000,0.00000000,-268.14419083);
- CreateObject(3631,1594.14160200,-1257.08642600,286.86883500,0.00000000,0.00000000,1.71887339);
- CreateObject(3631,1604.56164600,-1256.77233900,286.85174600,0.00000000,0.00000000,1.71887339);
- CreateObject(3631,1615.55175800,-1256.58337400,286.85958900,0.00000000,0.00000000,1.71887339);
- CreateObject(3636,1633.98425300,-1255.84838900,276.36599700,82.50592250,0.00000000,-1.71887339);
- CreateObject(3636,1650.99963400,-1256.63537600,274.60452300,82.50592250,0.00000000,-1.71887339);
- CreateObject(3636,1666.38598600,-1255.20495600,272.61486800,82.50592250,0.00000000,17.18873385);
- CreateObject(3636,1681.09021000,-1248.78125000,273.70929000,82.50592250,0.00000000,27.50197417);
- CreateObject(3636,1694.77307100,-1239.38745100,274.84780900,82.50592250,0.00000000,39.53408786);
- CreateObject(6867,1714.95483400,-1178.67041000,297.15399200,0.00000000,0.00000000,-51.56620156);
- CreateObject(974,1706.98413100,-1211.47265600,277.03076200,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1701.03759800,-1204.87646500,276.81738300,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1693.76635700,-1197.61450200,276.82901000,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1702.92028800,-1178.17627000,279.18060300,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1697.31506300,-1182.87817400,279.61947600,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1690.98498500,-1185.70861800,280.65783700,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1707.23571800,-1118.80554200,273.88061500,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1711.80139200,-1115.36169400,276.67355300,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1716.70105000,-1121.03784200,278.09811400,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1722.69030800,-1124.65515100,279.08462500,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1727.63134800,-1129.97741700,280.64492800,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1732.61572300,-1125.55322300,282.77932700,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1740.99438500,-1120.95617700,280.22213700,90.24085273,0.00000000,-49.84732818);
- CreateObject(974,1744.08374000,-1121.66052200,281.85693400,183.06007284,0.00000000,39.53408786);
- CreateObject(974,1779.22509800,-1161.04113800,280.83062700,268.14419083,0.00000000,39.53408786);
- CreateObject(3330,1804.41137700,-1187.47509800,270.03402700,-31.79915763,0.00000000,37.81521448);
- CreateObject(3330,1820.63317900,-1210.19104000,233.51001000,-55.00394833,0.00000000,37.81521448);
- CreateObject(3411,1879.03271500,-1241.67932100,183.44625900,0.00000000,0.00000000,-53.28501765);
- CreateObject(4550,1957.40417500,-1183.40344200,126.30550400,124.61832044,0.00000000,126.33730842);
- //---[Biz 1 - Config]---//
- CreatePickup(1239, 1,-1519.2203,2609.5698,55.8359, 0);
- Create3DTextLabel("Biz", COLOR_GREENYELLOW, -1519.1837,2609.2742,56.3359, 20, 0);
- return 1;
- }
- //---[Server Configs #2]---//
- public OnGameModeExit()
- {
- TextDrawHideForAll(Textdraw1);
- TextDrawDestroy(Textdraw1);
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 2004.7404,1913.8379,40.3516);
- SetPlayerFacingAngle(playerid,264.7556);
- SetPlayerTime(playerid, 0,0);
- InterpolateCameraPos(playerid,2013.6698,1913.9120,35.0304,2013.6698,1913.9120,35.0304+100,10000);
- InterpolateCameraLookAt(playerid,2004.7404,1913.8379,40.3516,2004.7404,1913.8379,40.3516+50,10000);
- return 1;
- }
- //---[Server Opening]---//
- public OnPlayerConnect(playerid)
- {
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
- }
- new string[78], pnome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pnome, sizeof(pnome));
- format(string, sizeof(string), "{1E90FF}%s {006400}(ID:%d) {B22222}Connected to Call of Duty 2.", pnome, playerid);
- SendClientMessageToAll(-1, string);
- TextDrawShowForPlayer(playerid, Textdraw1);
- PlayAudioStreamForPlayer(playerid, "http://rapha3l.comyr.com/eldm/songs/intro.mp3");
- IsAFK[playerid] = 0;
- //---[OnPlayerConnect Welcome Messages]---//
- SendClientMessage(playerid, COLOR_GREEN, "Welcome to Call of Duty 2... Login screen loading.");
- SendClientMessage(playerid, COLOR_GREEN, "This script has been edited by DJTunes, and includes big updates.");
- SendClientMessage(playerid, COLOR_YELLOW, "This script has been released on SA-MP forums by DJTunes.");
- SendClientMessage(playerid, COLOR_YELLOW, "Please type /help for a list of commands, and information.");
- return 1;
- }
- //---[Spawn]---//
- public OnPlayerSpawn(playerid)
- {
- GivePlayerWeapon(playerid,4,1);
- GivePlayerWeapon(playerid,31,9999);
- GivePlayerWeapon(playerid,1,0);
- new Random = random(sizeof(RandomSpawns));
- SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
- SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
- StopAudioStreamForPlayer(playerid);
- return 1;
- }
- //---[Leaving Server]---//
- public OnPlayerDisconnect(playerid, reason)
- {
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
- INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
- INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
- INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
- INI_WriteInt(File,"Experience",PlayerInfo[playerid][Xp]);
- INI_Close(File);
- new
- string[64],
- playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,MAX_PLAYER_NAME);
- switch(reason)
- {
- case 0: format(string,sizeof string,"{1E90FF}%s {006400}(ID:%d) {B22222}left the battle. {006400}(Timed out)",playername);
- case 1: format(string,sizeof string,"{1E90FF}%s {006400}(ID:%d) {B22222}left the battle. {006400}(Leaving)",playername);
- case 2: format(string,sizeof string,"{1E90FF}%s {006400}(ID:%d) {B22222}left the battle. {006400}(Kicked/Banned)",playername);
- }
- return 1;
- }
- //---[Commands]---//
- //---[Server Info]---//
- CMD:svrinfo(playerid, params[])
- {
- SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Server Info]-------------------");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Notice:: {FFFFFF}This script is a basic edit from Rapha3Ls TDM.");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Owner: {FFFFFF}DJTunes");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Scripter: {FFFFFF}DJTunes, Rapha3L, JJB562");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Mapper: {FFFFFF}Rapha3L");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Website: {FFFFFF}http://mafiacity-rp.net/");
- SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Server Info]-------------------");
- return 1;
- }
- //---[Credits]---//
- CMD:credits(playerid, params[])
- {
- SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Credits]-------------------");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Notice:: {FFFFFF}This script is a basic edit from Rapha3Ls TDM.");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Scripter(s): {FFFFFF}DJTunes, Rapha3L, JJB562.");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Script Mapper: {FFFFFF}Rapha3L");
- SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Credits]-------------------");
- return 1;
- }
- //---[Information]---//
- CMD:info(playerid, params[])
- {
- SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Information]-------------------");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Notice:: {FFFFFF}This script is a basic edit from Rapha3Ls TDM.");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Script Started: {FFFFFF}6/17/2013");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Script Status: {FFFFFF}Active");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Script Maker: {FFFFFF}DJTunes");
- SendClientMessage(playerid, COLOR_GREEN, "{DB881A}Script Mapper: {FFFFFF}Rapha3L");
- SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Information]-------------------");
- return 1;
- }
- //---[Help]---//
- CMD:help(playerid, params[])
- {
- SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Help Commands]-------------------");
- SendClientMessage(playerid, COLOR_GREEN, "{37DB45}[COD2 Help] {FFFFFF}Loading all server commands, please stand by...");
- SendClientMessage(playerid, COLOR_WHITE, "{DB881A}[COD2 Map CMDs] {FFFFFF}/runw, /drift, /parkour");
- SendClientMessage(playerid, COLOR_BLUE, "{1B1BE0}[COD2 Biz CMDs] {FFFFFF}/enter, /exit, /heal, /nadepack, /pack2");
- SendClientMessage(playerid, COLOR_WHITE, "{37DB45}[COD2 General CMDs] {FFFFFF}/help, /info, /credits, /svrinfo");
- SendClientMessage(playerid, COLOR_WHITE, "{37DB45}[COD2 General CMDs] {FFFFFF}/kill, /afk, /back, /afklist");
- SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}-------------------[Help Commands]-------------------");
- return 1;
- }
- //---[Kill]---//
- CMD:kill(playerid)
- {
- SetPlayerHealth(playerid,0.0);
- new str[78], pnome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pnome, sizeof(pnome));
- format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}has done suicide. {FFA54F}/kill.", pnome, playerid);
- SendClientMessageToAll(-1, str);
- return 1;
- }
- //---[AFK System]---//
- command(afk, playerid, params[])
- {
- if(IsAFK[playerid] == 0)
- {
- TogglePlayerControllable(playerid,0);
- GetPlayerName(playerid, pName, 24);
- format(afkstr, 128, "%s has gone AFK! (Away from keyboard)", pName);
- IsAFK[playerid] = 1;
- }
- else return SendClientMessage(playerid, COLOR_BLUE, "You are already AFK!");
- return 1;
- }
- command(back, playerid, params[])
- {
- if(IsAFK[playerid] == 1)
- {
- TogglePlayerControllable(playerid,1);
- GetPlayerName(playerid, pName2, 24);
- format(str2, 128, "%s is now back from being AFK!", pName2);
- SendClientMessageToAll(COLOR_BLUE, str2);
- IsAFK[playerid] = 0;
- }
- else return SendClientMessage(playerid, COLOR_BLUE, "You aren't AFK!");
- return 1;
- }
- command(afklist, playerid, params)
- {
- new pString[MAX_PLAYER_NAME], pName3[MAX_PLAYER_NAME];
- for(new pID = 0; pID < MAX_PLAYERS; pID ++)
- {
- if(IsPlayerConnected(pID))
- {
- if(IsAFK[pID] == 1)
- {
- SendClientMessage(playerid, 0xFFFFFFFF, "Players currently AFK:");
- GetPlayerName(playerid, pName3, sizeof(pName3));
- format(pString, sizeof(pString), "%s", pName3);
- SendClientMessage(playerid, 0xFFFFFFFF, pString);
- }
- }
- }
- return 1;
- }
- //---[Run Weapons Arena]---//
- CMD:runw(playerid)
- {
- SetPlayerPos(playerid, 1373.8341, 2196.1016, 14.2495);
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid,4,1);
- GivePlayerWeapon(playerid,24,9999);
- GivePlayerWeapon(playerid,26,9999);
- GivePlayerWeapon(playerid,28,9999);
- SetPlayerHealth(playerid, 100);
- SetPlayerArmour(playerid, 100);
- new str[78], pnome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pnome, sizeof(pnome));
- format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}Teleported to the Arena.", pnome, playerid);
- SendClientMessageToAll(-1, str);
- return 1;
- }
- //---[Drift]---//
- CMD:drift(playerid)
- {
- SetPlayerPos(playerid, -303.8535,1532.6465,75.3594);
- ResetPlayerWeapons(playerid);
- new str[78], pnome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pnome, sizeof(pnome));
- format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}Teleported to the Drift Zone.", pnome, playerid);
- SendClientMessageToAll(-1, str);
- return 1;
- }
- //---[Parkour]---//
- CMD:parkour(playerid)
- {
- SetPlayerPos(playerid,1544.9849,-1353.7681,329.4735);
- new name[128];
- new string[256];
- GetPlayerName(playerid,name,128);
- format(string, sizeof(string), "{1E90FF}%s {006400}(ID:%d) {B22222}Teleported to the Parkour Zone.",name);
- SendClientMessageToAll(0x99FFFFAA, string);
- SetPlayerInterior(playerid, 0);
- PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
- return 1;
- }
- //---[Biz Commands]---//
- CMD:enter(playerid)
- {
- if(IsPlayerInRangeOfPoint(playerid,5.0,-1519.2583,2608.9690,55.8359))
- {
- SetPlayerPos(playerid, 1118.8878,-10.2737,1002.0859);
- SetPlayerInterior(playerid, 12);
- }
- return 1;
- }
- CMD:exit(playerid)
- {
- if(IsPlayerInRangeOfPoint(playerid,5.0,1118.8878,-10.2737,1002.0859))
- {
- SetPlayerPos(playerid, -1519.2583,2608.9690,55.8359);
- SetPlayerInterior(playerid, 0);
- }
- return 1;
- }
- CMD:heal(playerid)
- {
- if(IsPlayerInRangeOfPoint(playerid,5.0,1118.8878,-10.2737,1002.0859))
- {
- GivePlayerMoney(playerid, -500);
- SetPlayerHealth(playerid, 100);
- SetPlayerArmour(playerid, 100);
- new str[78], pnome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pnome, sizeof(pnome));
- format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}Bought a medical kit!", pnome, playerid);
- SendClientMessageToAll(-1, str);
- }
- return 1;
- }
- CMD:nadepack(playerid)
- {
- if(IsPlayerInRangeOfPoint(playerid,5.0,1118.8878,-10.2737,1002.0859))
- {
- GivePlayerMoney(playerid, -1000);
- GivePlayerWeapon(playerid,16,10);
- new str[78], pnome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pnome, sizeof(pnome));
- format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}Bought 10 frags!", pnome, playerid);
- SendClientMessageToAll(-1, str);
- }
- return 1;
- }
- CMD:pack2(playerid)
- {
- if(IsPlayerInRangeOfPoint(playerid,5.0,1118.8878,-10.2737,1002.0859))
- {
- GivePlayerMoney(playerid, -1000);
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid,8,1);
- GivePlayerWeapon(playerid,23,1000);
- GivePlayerWeapon(playerid,27,1000);
- GivePlayerWeapon(playerid,33,1000);
- GivePlayerWeapon(playerid,29,1000);
- new str[78], pnome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pnome, sizeof(pnome));
- format(str, sizeof(str), "{1E90FF}%s {006400}(ID:%d) {B22222}has bought Weapons Package 2!", pnome, playerid);
- SendClientMessageToAll(-1, str);
- }
- return 1;
- }
- //---[Death's]---//
- public OnPlayerDeath(playerid, killerid, reason)
- {
- PlayerInfo[killerid][pKills]++;
- PlayerInfo[playerid][pDeaths]++;
- PlayerInfo[killerid][Xp]+= 1;
- GivePlayerMoney(killerid, 100);
- GivePlayerMoney(playerid, -50);
- SendDeathMessage(killerid, playerid, reason);
- return 1;
- }
- //---[Login & Register System OnDialogResponse]---//
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- switch( dialogid )
- {
- case DIALOG_REGISTER:
- {
- if (!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
- new INI:File = INI_Open(UserPath(playerid));
- INI_SetTag(File,"data");
- INI_WriteInt(File,"Password",udb_hash(inputtext));
- INI_WriteInt(File,"Cash",0);
- INI_WriteInt(File,"Admin",0);
- INI_WriteInt(File,"Kills",0);
- INI_WriteInt(File,"Deaths",0);
- INI_Close(File);
- SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
- SpawnPlayer(playerid);
- ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");
- }
- }
- 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);
- GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
- ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
- }
- return 1;
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement