Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is my first gamemode.
- // Credits:
- // Login & Register = Kushi
- // Gamemode = By Me!
- /* !!!!!!!!!DO NOT REMOVE CREDITS!!!!!!!!! */
- #include <a_samp>
- #include <YSI\y_ini>
- #include <sscanf>
- #include <zcmd>
- #include <a_samp>
- #include <core>
- #include <float>
- #include "../include/gl_spawns.inc"
- #include "../include/gl_common.inc"
- #pragma tabsize 0
- // Dialogs:
- #define DIALOG_REGISTER 1
- #define DIALOG_LOGIN 2
- #define DIALOG_GUNSHOP 3
- #define DIALOG_HELP 4
- #define DIALOG_AHELP 5
- //Folder:
- #define FOLDER "Server Stats/Players/%s.ini"
- //Colors:
- #define COLOR_RED 0xF21616FF
- #define COLOR_GREY 0xDBDBDBFF
- #define COLOR_YELLOW 0xF7EA31FF
- #define COLOR_GREEN 0x509E2CFF
- #define COL_WHITE "{FFFFFF}"
- #define COL_RED "{F81414}"
- #define COL_GREEN "{00FF22}"
- #define COL_LIGHTBLUE "{00CED1}"
- //Enums:
- enum pInfo
- {
- pPass,
- pCash,
- pAdmin,
- pKills,
- pDeaths,
- Score,
- Job
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- new GodMode[MAX_PLAYERS];
- new ScoreFunc[MAX_PLAYERS];
- new RestartFunc[MAX_PLAYERS];
- new RMessages[][] =
- {
- "[SERVER] Check the server rules! (/rules)", //this is the text of your first message
- "[SERVER] Be sure you check the forum, at www.link.com", //this is the text of your second message
- "[SERVER] etc..." //this is the text of your third message
- };
- 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]);
- INI_Int("Score",PlayerInfo[playerid][Score]);
- INI_Int("Job",PlayerInfo[playerid][Job]);
- return 1;
- }
- // Forwards:
- forward LoadUser_data(playerid,name[],value[]);
- forward RandomMessages();
- /* The Car Spawner Sthings */
- #define TOTAL_ITEMS 207
- #define SELECTION_ITEMS 21
- #define ITEMS_PER_LINE 7
- #define HEADER_TEXT "Vehicles"
- #define NEXT_TEXT "Next"
- #define PREV_TEXT "Prev"
- #define DIALOG_BASE_X 75.0
- #define DIALOG_BASE_Y 130.0
- #define DIALOG_WIDTH 550.0
- #define DIALOG_HEIGHT 180.0
- #define SPRITE_DIM_X 60.0
- #define SPRITE_DIM_Y 70.0
- new gTotalItems = TOTAL_ITEMS;
- new PlayerText:gCurrentPageTextDrawId[MAX_PLAYERS];
- new PlayerText:gHeaderTextDrawId[MAX_PLAYERS];
- new PlayerText:gBackgroundTextDrawId[MAX_PLAYERS];
- new PlayerText:gNextButtonTextDrawId[MAX_PLAYERS];
- new PlayerText:gPrevButtonTextDrawId[MAX_PLAYERS];
- new PlayerText:gSelectionItems[MAX_PLAYERS][SELECTION_ITEMS];
- new gSelectionItemsTag[MAX_PLAYERS][SELECTION_ITEMS];
- new gItemList[TOTAL_ITEMS] = {
- 400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,
- 431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,450,451,452,453,454,455,456,457,458,459,460,461,
- 462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,
- 493,494,495,496,497,498,499,500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,
- 524,525,526,527,528,529,530,531,532,533,534,535,536,539,540,541,542,543,544,545,546,547,548,549,550,551,552,553,554,
- 555,556,557,558,559,560,561,562,563,564,565,566,567,568,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,
- 586,587,588,589,590,591,592,593,594,595,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,611
- };
- /* The Car Spawner Ends */
- main()
- {
- print("\nMy First Gamemode");
- print(" By finelaq");
- print("\nLoaded...!");
- }
- public OnGameModeInit()
- {
- SetGameModeText("finelaq gamemode");
- ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);
- ShowNameTags(1);
- SetNameTagDrawDistance(40.0);
- EnableStuntBonusForAll(0);
- DisableInteriorEnterExits();
- // The Timer
- SetTimer("RandomMessages", 300000, true);
- // Skins:
- AddPlayerClass(281,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(282,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(283,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(284,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(285,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(286,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(287,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(288,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(289,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(265,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(266,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(267,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(268,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(269,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(270,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(1,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(2,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(3,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(4,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(5,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(6,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(8,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(42,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(65,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(74,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(86,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(119,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(149,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(208,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(273,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(289,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(47,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(48,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(49,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(50,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(51,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(52,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(53,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(54,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(55,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(56,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(57,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(58,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(68,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(69,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(70,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(71,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(72,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(73,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(75,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(76,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(78,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(79,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(80,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(81,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(82,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(83,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(84,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(85,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(87,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(88,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(89,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(91,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(92,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(93,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(95,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(96,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(97,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(98,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- AddPlayerClass(99,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
- return 1;
- }
- public RandomMessages()
- {
- new rMsg = random(sizeof(RMessages));
- SendClientMessageToAll(COLOR_YELLOW, RMessages[rMsg]);
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerInterior(playerid,11);
- SetPlayerPos(playerid,508.7362,-87.4335,998.9609);
- SetPlayerFacingAngle(playerid,0.0);
- SetPlayerCameraPos(playerid,508.7362,-83.4335,998.9609);
- SetPlayerCameraLookAt(playerid,508.7362,-87.4335,998.9609);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new string[64], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
- format(string,sizeof string,"%s has connected server!",pName);
- SendClientMessageToAll(0xFFFFFFAA,string);
- if(fexist(UserPath(playerid)))
- {
- INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"SERVER NAME",""COL_WHITE"Welcome back!,\n\nPlease type your account password:","Log-In","Quit");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"SERVER NAME",""COL_WHITE"Welcome!,\n\nPlease type your account password, to register:","Register","Quit");
- }
- // Timer
- ScoreFunc[playerid] = SetTimer("ScoreTimer", 60000, 1);
- // Map Icons
- SetPlayerMapIcon(playerid,49,822.6,-1590.3,13.5,7,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,50,-2570.1,245.4,10.3,7,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,51,2726.6,-2026.4,17.5,7,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,52,2080.3,2119.0,10.8,7,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,53,675.7,-496.6,16.8,7,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,54,-1805.7,943.2,24.8,29,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,55,2750.9,2470.9,11.0,29,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,56,2351.8,2529.0,10.8,29,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,57,2635.5,1847.4,11.0,29,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,58,2083.4,2221.0,11.0,29,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,59,-1719.1,1359.4,8.6,29,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,60,2330.2,75.2,31.0,29,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,61,203.2,-200.4,6.5,29,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,62,812.9,-1616.1,13.6,10,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,63,1199.1,-924.0,43.3,10,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,64,2362.2,2069.9,10.8,10,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,65,2469.5,2033.8,10.8,10,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,66,2172.9,2795.7,10.8,10,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,67,1875.3,2072.0,10.8,10,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,68,1161.5,2072.0,10.8,10,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,69,-2356.0,1009.0,49.0,10,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,70,-1913.3,826.2,36.9,10,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,71,-2335.6,-165.6,39.5,10,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,72,2397.8,-1895.6,13.7,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,73,2421.6,-1509.6,24.1,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,74,-2671.6,257.4,4.6,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,75,2392.4,2046.5,10.8,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,76,2844.5,2401.1,11.0,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,77,2635.5,1674.3,11.0,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,78,2105.7,2228.7,11.0,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,79,-2154.0,-2461.2,30.8,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,80,-1816.2,620.8,37.5,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,81,-1216.0,1831.4,45.3,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,82,172.73,1176.76,13.7,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,83,932.0,-1353.0,14.0,14,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,84,1971.7,-2036.6,13.5,39,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,85,2071.6,-1779.9,13.5,39,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,86,2094.6,2119.0,10.8,39,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,87,-2490.5,-40.1,39.3,39,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,88,1372.9,-1278.8,12.5,6,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,89,2400.5,-1978.4,13.5,6,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,90,-2626.6,209.4,4.9,6,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,91,2535.9,2083.5,10.8,6,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,92,2156.5,943.2,10.8,6,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,93,779.7,1874.3,4.9,6,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,94,-2092.7,-2463.8,30.6,6,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,95,240.0,-178.2,2.0,6,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,96,-1509.4,2611.8,58.5,6,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,97,-315.67,829.87,13.43,6,0,MAPICON_LOCAL);
- SetPlayerMapIcon(playerid,98,2332.9,63.6,31.0,6,0,MAPICON_LOCAL);
- return 1;
- }
- forward ScoreTimer(playerid);
- public ScoreTimer(playerid)
- {
- SetPlayerScore(playerid, GetPlayerScore(playerid) +1);
- KillTimer(ScoreFunc[playerid]);
- ScoreFunc[playerid] = SetTimer("ScoreTimer", 60000, 1);
- PlayerInfo[playerid][Score] ++;
- }
- forward RestartTimer(playerid);
- public RestartTimer(playerid)
- {
- SendClientMessageToAll(COLOR_GREY,"Server restart has been started now!");
- SendRconCommand("gmx");
- }
- 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,"Score",GetPlayerScore(playerid));
- INI_WriteInt(File,"Job",PlayerInfo[playerid][Job]);
- INI_Close(File);
- new szString[64],name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, name, MAX_PLAYER_NAME);
- switch(reason)
- {
- case 0: format(szString, sizeof szString, "%s has left the server. (Crashed)", name);
- case 1: format(szString, sizeof szString, "%s has left the server. (Left)", name);
- case 2: format(szString, sizeof szString, "%s has left the server. (Kicked)", name);
- }
- SendClientMessageToAll(0xC4C4C4FF, szString);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- new RndmSpwn = 0;
- RndmSpwn = random(sizeof(gRandomSpawns_LosSantos));
- SetPlayerPos(playerid,
- gRandomSpawns_LosSantos[RndmSpwn][0],
- gRandomSpawns_LosSantos[RndmSpwn][1],
- gRandomSpawns_LosSantos[RndmSpwn][2]);
- SetPlayerFacingAngle(playerid,gRandomSpawns_LosSantos[RndmSpwn][3]);
- SetPlayerInterior(playerid,0);
- TogglePlayerClock(playerid,0);
- ResetPlayerMoney(playerid);
- GivePlayerMoney(playerid, 30000);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new cash;
- if(killerid == INVALID_PLAYER_ID) {
- ResetPlayerMoney(playerid);
- } else {
- cash = GetPlayerMoney(playerid);
- if(cash > 0) {
- GivePlayerMoney(killerid, cash);
- ResetPlayerMoney(playerid);
- }
- }
- PlayerInfo[playerid][pDeaths]++;
- PlayerInfo[killerid][pKills]++;
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- return 1;
- }
- return 0;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- // Interior no weapons
- if(GetPlayerInterior(playerid) != 0 && GetPlayerWeapon(playerid) != 0) {
- SetPlayerArmedWeapon(playerid,0); // First
- return 0;
- }
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_GUNSHOP)
- {
- if(response)
- {
- if(listitem == 0)
- {
- if(GetPlayerMoney(playerid) <25000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
- GivePlayerWeapon(playerid, 31, 5000);
- SendClientMessage(playerid,COLOR_GREEN,"Thank you buying M4!");
- GivePlayerMoney(playerid, -25000);
- }
- if(listitem == 1)
- {
- if(GetPlayerMoney(playerid) <35000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
- GivePlayerWeapon(playerid, 30, 5000);
- SendClientMessage(playerid,COLOR_GREEN,"Thank you buying AK-47!");
- GivePlayerMoney(playerid, -35000);
- }
- if(listitem == 2)
- {
- if(GetPlayerMoney(playerid) <70000000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
- GivePlayerWeapon(playerid, 38, 999999999);
- SendClientMessage(playerid,COLOR_GREEN,"Thank you buying MiniGun!");
- GivePlayerMoney(playerid, -70000000);
- }
- if(listitem == 3)
- {
- if(GetPlayerMoney(playerid) <500) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
- GivePlayerWeapon(playerid, 4, 1);
- SendClientMessage(playerid,COLOR_GREEN,"Thank you buying Knife!");
- GivePlayerMoney(playerid, -500);
- }
- if(listitem == 4)
- {
- if(GetPlayerMoney(playerid) <55000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
- GivePlayerWeapon(playerid, 24, 5000);
- SendClientMessage(playerid,COLOR_GREEN,"Thank you buying Deagle!");
- GivePlayerMoney(playerid, -55000);
- }
- if(listitem == 5)
- {
- if(GetPlayerMoney(playerid) <20000) return SendClientMessage(playerid,COLOR_RED, "You don't have the money!");
- GivePlayerWeapon(playerid, 29, 5000);
- SendClientMessage(playerid,COLOR_GREEN,"Thank you buying MP5!");
- GivePlayerMoney(playerid, -20000);
- }
- }
- }
- 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"SERVER NAME",""COL_RED"Heres no password!\n"COL_WHITE"Try aigan! Type password to register 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_WriteInt(File,"Score",0);
- INI_WriteInt(File,"Job",0);
- INI_Close(File);
- SendClientMessage(playerid,COLOR_GREEN,"You are succesuly registred!");
- }
- }
- 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]);
- SetPlayerScore(playerid, PlayerInfo[playerid][Score]);
- SendClientMessage(playerid,COLOR_GREEN,"You are succesuly logged in!");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"SERVER NAME",""COL_RED"This is incorrect password.\n"COL_WHITE"Try aigan! Type your password:","log-In","Quit");
- }
- return 1;
- }
- }
- }
- return 1;
- }
- public OnPlayerClickTextDraw(playerid, Text:clickedid)
- {
- if(GetPVarInt(playerid, "vspawner_active") == 0) return 0;
- // Handle: They cancelled (with ESC)
- if(clickedid == Text:INVALID_TEXT_DRAW) {
- DestroySelectionMenu(playerid);
- SetPVarInt(playerid, "vspawner_active", 0);
- PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
- return 1;
- }
- return 0;
- }
- //------------------------------------------------
- public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
- {
- if(GetPVarInt(playerid, "vspawner_active") == 0) return 0;
- new curpage = GetPVarInt(playerid, "vspawner_page");
- // Handle: next button
- if(playertextid == gNextButtonTextDrawId[playerid]) {
- if(curpage < (GetNumberOfPages() - 1)) {
- SetPVarInt(playerid, "vspawner_page", curpage + 1);
- ShowPlayerModelPreviews(playerid);
- UpdatePageTextDraw(playerid);
- PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
- } else {
- PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
- }
- return 1;
- }
- // Handle: previous button
- if(playertextid == gPrevButtonTextDrawId[playerid]) {
- if(curpage > 0) {
- SetPVarInt(playerid, "vspawner_page", curpage - 1);
- ShowPlayerModelPreviews(playerid);
- UpdatePageTextDraw(playerid);
- PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0);
- } else {
- PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
- }
- return 1;
- }
- // Search in the array of textdraws used for the items
- new x=0;
- while(x != SELECTION_ITEMS) {
- if(playertextid == gSelectionItems[playerid][x]) {
- HandlePlayerItemSelection(playerid, x);
- PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
- DestroySelectionMenu(playerid);
- CancelSelectTextDraw(playerid);
- SetPVarInt(playerid, "vspawner_active", 0);
- return 1;
- }
- x++;
- }
- return 0;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- CMD:kick(playerid, params[])
- {
- new id, reason[128];
- if(PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
- else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_GREY, "USE: /kick [Player ID] [Reason]");
- else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_GREY,"You can't kick bots!");
- else {
- new Name[MAX_PLAYER_NAME], KickMessage[128];
- new Name2[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof(Name));
- GetPlayerName(id, Name2, sizeof(Name2));
- format(KickMessage, sizeof(KickMessage), "AdmCmd: Admin %s(%d) has kicked %s(%d) out of the server. Reason: %s", Name, playerid, Name2, id);
- SendClientMessageToAll(COLOR_RED, KickMessage);
- Kick(id);
- }
- return 1;
- }
- CMD:ban(playerid, params[])
- {
- new id, reason[128];
- if(PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
- else if(sscanf(params, "us", id, reason))SendClientMessage(playerid, COLOR_GREY, "USE: /ban [Player ID] [Reason]");
- else if (id==INVALID_PLAYER_ID)SendClientMessage(playerid,COLOR_GREY,"You can't ban bots");
- else {
- new Name[MAX_PLAYER_NAME], KickMessage[128];
- new Name2[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof(Name));
- GetPlayerName(id, Name2, sizeof(Name2));
- format(KickMessage, sizeof(KickMessage), "AdmCmd: Admin %s(%d) blocked the %s(%d) account. Reason: %s", Name, playerid, Name2, id);
- SendClientMessageToAll(COLOR_RED, KickMessage);
- Ban(id);
- }
- return 1;
- }
- CMD:veh(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
- DestroySelectionMenu(playerid);
- SetPVarInt(playerid, "vspawner_active", 1);
- CreateSelectionMenu(playerid);
- SelectTextDraw(playerid, 0xACCBF1FF);
- return 1;
- }
- COMMAND:aguns(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] <= 2) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
- GivePlayerWeapon(playerid, 4, 2);
- GivePlayerWeapon(playerid, 24, 50000);
- GivePlayerWeapon(playerid, 26, 50000);
- GivePlayerWeapon(playerid, 29, 50000);
- GivePlayerWeapon(playerid, 31, 50000);
- GivePlayerWeapon(playerid, 36, 50000);
- return 1;
- }
- COMMAND:health(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] <= 2) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
- SetPlayerHealth(playerid,100);
- return 1;
- }
- COMMAND:restart(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] <= 5) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
- RestartFunc[playerid] = SetTimer("RestartTimer", 5000, 1);
- SendClientMessage(playerid,COLOR_YELLOW,"You has starded the server restart!");
- SendClientMessageToAll(COLOR_YELLOW,"Server restart has been started in 5 seconds!");
- return 1;
- }
- COMMAND:kill(playerid, params[])
- {
- SetPlayerHealth(playerid,-9999);
- return 1;
- }
- COMMAND:help(playerid, params[])
- {
- ShowPlayerDialog(playerid,DIALOG_HELP,DIALOG_STYLE_MSGBOX,"HELP","{F7EA31}Commands: /help /kill /gunshop /pay","Ok","");
- return 1;
- }
- COMMAND:ahelp(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] <= 1) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
- ShowPlayerDialog(playerid,DIALOG_AHELP,DIALOG_STYLE_MSGBOX,"ADMIN HELP","{F7EA31}Commands: /aguns /kick /ban /god /veh /givecash","Ok","");
- return 1;
- }
- COMMAND:pay(playerid, params[])
- {
- new player, amount,name1[24], name2[24], string[128];
- if(!sscanf(params, "ui",player,amount))
- {
- if(playerid != player)
- {
- if(GetPlayerMoney(playerid) >= amount)
- {
- GetPlayerName(playerid, name1, 24);
- GetPlayerName(player, name2, 24);
- format(string, sizeof(string), "You gaved $%d to %s.",amount,name2);
- SendClientMessage(playerid, 0xFFFF00FF, string);
- format(string, sizeof(string), "%s gave you $%d!", name1, amount);
- SendClientMessage(player, 0xFFFF00FF, string);
- GivePlayerMoney(playerid, -amount);
- GivePlayerMoney(player, amount);
- }
- else return SendClientMessage(playerid, 0xFF0000FF,"You don't have that much.");
- }
- else return SendClientMessage(playerid, 0xFF0000FF,"You can't pay to yourself.");
- }
- else return SendClientMessage(playerid, 0xFFFFFFFF,"Usage: /pay [Player ID][Amount]");
- return 1;
- }
- COMMAND:givecash(playerid, params[])
- {
- new player, amount,name1[24], name2[24], string[128];
- if(!sscanf(params, "ui",player,amount))
- {
- GetPlayerName(playerid, name1, 24);
- GetPlayerName(player, name2, 24);
- format(string, sizeof(string), "You gaved $%d to %s.",amount,name2);
- SendClientMessage(playerid, 0xFFFF00FF, string);
- format(string, sizeof(string), "Admin %s gave you $%d!", name1, amount);
- SendClientMessage(player, 0xFFFF00FF, string);
- GivePlayerMoney(player, amount);
- }
- else return SendClientMessage(playerid, 0xFFFFFFFF,"Usage: /givecash [Player ID][Amount]");
- return 1;
- }
- COMMAND:armour(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] <= 2) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
- SetPlayerArmour(playerid,100);
- return 1;
- }
- COMMAND:gunshop(playerid, params[])
- {
- ShowPlayerDialog(playerid, DIALOG_GUNSHOP, DIALOG_STYLE_LIST,"GUNSHOP:","M4 25,000€\nAK-47 35,000€\nMiniGun 7,000,000,000,0€\nKnife 500€\nDeagle 55,000€\nMP5 20,000€","Buy","Quit");
- return 1;
- }
- COMMAND:god(playerid, params[])
- {
- if(PlayerInfo[playerid][pAdmin] <= 2) return SendClientMessage(playerid, COLOR_GREY, "You don't have the rights!");
- if(GodMode[playerid] == 0)
- {
- GodMode[playerid] = 1;
- SetPlayerHealth(playerid,999999);
- SendClientMessage(playerid,COLOR_GREEN,"GodMode ON!");
- }
- else
- {
- GodMode[playerid] = 0;
- SetPlayerHealth(playerid,100);
- SendClientMessage(playerid,COLOR_RED,"GodMode OFF!");
- }
- return 1;
- }
- // Car Spawner Things
- GetNumberOfPages()
- {
- if((gTotalItems >= SELECTION_ITEMS) && (gTotalItems % SELECTION_ITEMS) == 0)
- {
- return (gTotalItems / SELECTION_ITEMS);
- }
- else return (gTotalItems / SELECTION_ITEMS) + 1;
- }
- //------------------------------------------------
- PlayerText:CreateCurrentPageTextDraw(playerid, Float:Xpos, Float:Ypos)
- {
- new PlayerText:txtInit;
- txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, "0/0");
- PlayerTextDrawUseBox(playerid, txtInit, 0);
- PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1);
- PlayerTextDrawFont(playerid, txtInit, 1);
- PlayerTextDrawSetShadow(playerid, txtInit, 0);
- PlayerTextDrawSetOutline(playerid, txtInit, 1);
- PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF);
- PlayerTextDrawShow(playerid, txtInit);
- return txtInit;
- }
- //------------------------------------------------
- // Creates a button textdraw and returns the textdraw ID.
- PlayerText:CreatePlayerDialogButton(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, button_text[])
- {
- new PlayerText:txtInit;
- txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, button_text);
- PlayerTextDrawUseBox(playerid, txtInit, 1);
- PlayerTextDrawBoxColor(playerid, txtInit, 0x000000FF);
- PlayerTextDrawBackgroundColor(playerid, txtInit, 0x000000FF);
- PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1);
- PlayerTextDrawFont(playerid, txtInit, 1);
- PlayerTextDrawSetShadow(playerid, txtInit, 0); // no shadow
- PlayerTextDrawSetOutline(playerid, txtInit, 0);
- PlayerTextDrawColor(playerid, txtInit, 0x4A5A6BFF);
- PlayerTextDrawSetSelectable(playerid, txtInit, 1);
- PlayerTextDrawAlignment(playerid, txtInit, 2);
- PlayerTextDrawTextSize(playerid, txtInit, Height, Width); // The width and height are reversed for centering.. something the game does <g>
- PlayerTextDrawShow(playerid, txtInit);
- return txtInit;
- }
- //------------------------------------------------
- PlayerText:CreatePlayerHeaderTextDraw(playerid, Float:Xpos, Float:Ypos, header_text[])
- {
- new PlayerText:txtInit;
- txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, header_text);
- PlayerTextDrawUseBox(playerid, txtInit, 0);
- PlayerTextDrawLetterSize(playerid, txtInit, 1.25, 3.0);
- PlayerTextDrawFont(playerid, txtInit, 0);
- PlayerTextDrawSetShadow(playerid, txtInit, 0);
- PlayerTextDrawSetOutline(playerid, txtInit, 1);
- PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF);
- PlayerTextDrawShow(playerid, txtInit);
- return txtInit;
- }
- //------------------------------------------------
- PlayerText:CreatePlayerBackgroundTextDraw(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height)
- {
- new PlayerText:txtBackground = CreatePlayerTextDraw(playerid, Xpos, Ypos,
- " ~n~"); // enough space for everyone
- PlayerTextDrawUseBox(playerid, txtBackground, 1);
- PlayerTextDrawBoxColor(playerid, txtBackground, 0x00000099);
- PlayerTextDrawLetterSize(playerid, txtBackground, 5.0, 5.0);
- PlayerTextDrawFont(playerid, txtBackground, 0);
- PlayerTextDrawSetShadow(playerid, txtBackground, 0);
- PlayerTextDrawSetOutline(playerid, txtBackground, 0);
- PlayerTextDrawColor(playerid, txtBackground,0x000000FF);
- PlayerTextDrawTextSize(playerid, txtBackground, Width, Height);
- PlayerTextDrawBackgroundColor(playerid, txtBackground, 0x00000099);
- PlayerTextDrawShow(playerid, txtBackground);
- return txtBackground;
- }
- //------------------------------------------------
- // Creates a model preview sprite
- PlayerText:CreateModelPreviewTextDraw(playerid, modelindex, Float:Xpos, Float:Ypos, Float:width, Float:height)
- {
- new PlayerText:txtPlayerSprite = CreatePlayerTextDraw(playerid, Xpos, Ypos, ""); // it has to be set with SetText later
- PlayerTextDrawFont(playerid, txtPlayerSprite, TEXT_DRAW_FONT_MODEL_PREVIEW);
- PlayerTextDrawColor(playerid, txtPlayerSprite, 0xFFFFFFFF);
- PlayerTextDrawBackgroundColor(playerid, txtPlayerSprite, 0x000000EE);
- PlayerTextDrawTextSize(playerid, txtPlayerSprite, width, height); // Text size is the Width:Height
- PlayerTextDrawSetPreviewModel(playerid, txtPlayerSprite, modelindex);
- PlayerTextDrawSetPreviewRot(playerid,txtPlayerSprite, -16.0, 0.0, -55.0);
- PlayerTextDrawSetSelectable(playerid, txtPlayerSprite, 1);
- PlayerTextDrawShow(playerid,txtPlayerSprite);
- return txtPlayerSprite;
- }
- //------------------------------------------------
- DestroyPlayerModelPreviews(playerid)
- {
- new x=0;
- while(x != SELECTION_ITEMS) {
- if(gSelectionItems[playerid][x] != PlayerText:INVALID_TEXT_DRAW) {
- PlayerTextDrawDestroy(playerid, gSelectionItems[playerid][x]);
- gSelectionItems[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
- }
- x++;
- }
- }
- //------------------------------------------------
- ShowPlayerModelPreviews(playerid)
- {
- new x=0;
- new Float:BaseX = DIALOG_BASE_X;
- new Float:BaseY = DIALOG_BASE_Y - (SPRITE_DIM_Y * 0.33); // down a bit
- new linetracker = 0;
- new itemat = GetPVarInt(playerid, "vspawner_page") * SELECTION_ITEMS;
- // Destroy any previous ones created
- DestroyPlayerModelPreviews(playerid);
- while(x != SELECTION_ITEMS && itemat < gTotalItems) {
- if(linetracker == 0) {
- BaseX = DIALOG_BASE_X + 25.0; // in a bit from the box
- BaseY += SPRITE_DIM_Y + 1.0; // move on the Y for the next line
- }
- gSelectionItems[playerid][x] = CreateModelPreviewTextDraw(playerid, gItemList[itemat], BaseX, BaseY, SPRITE_DIM_X, SPRITE_DIM_Y);
- gSelectionItemsTag[playerid][x] = gItemList[itemat];
- BaseX += SPRITE_DIM_X + 1.0; // move on the X for the next sprite
- linetracker++;
- if(linetracker == ITEMS_PER_LINE) linetracker = 0;
- itemat++;
- x++;
- }
- }
- //------------------------------------------------
- UpdatePageTextDraw(playerid)
- {
- new PageText[64+1];
- format(PageText, 64, "%d/%d", GetPVarInt(playerid,"vspawner_page") + 1, GetNumberOfPages());
- PlayerTextDrawSetString(playerid, gCurrentPageTextDrawId[playerid], PageText);
- }
- //------------------------------------------------
- CreateSelectionMenu(playerid)
- {
- gBackgroundTextDrawId[playerid] = CreatePlayerBackgroundTextDraw(playerid, DIALOG_BASE_X, DIALOG_BASE_Y + 20.0, DIALOG_WIDTH, DIALOG_HEIGHT);
- gHeaderTextDrawId[playerid] = CreatePlayerHeaderTextDraw(playerid, DIALOG_BASE_X, DIALOG_BASE_Y, HEADER_TEXT);
- gCurrentPageTextDrawId[playerid] = CreateCurrentPageTextDraw(playerid, DIALOG_WIDTH - 30.0, DIALOG_BASE_Y + 15.0);
- gNextButtonTextDrawId[playerid] = CreatePlayerDialogButton(playerid, DIALOG_WIDTH - 30.0, DIALOG_BASE_Y+DIALOG_HEIGHT+100.0, 50.0, 16.0, NEXT_TEXT);
- gPrevButtonTextDrawId[playerid] = CreatePlayerDialogButton(playerid, DIALOG_WIDTH - 90.0, DIALOG_BASE_Y+DIALOG_HEIGHT+100.0, 50.0, 16.0, PREV_TEXT);
- ShowPlayerModelPreviews(playerid);
- UpdatePageTextDraw(playerid);
- }
- //------------------------------------------------
- DestroySelectionMenu(playerid)
- {
- DestroyPlayerModelPreviews(playerid);
- PlayerTextDrawDestroy(playerid, gHeaderTextDrawId[playerid]);
- PlayerTextDrawDestroy(playerid, gBackgroundTextDrawId[playerid]);
- PlayerTextDrawDestroy(playerid, gCurrentPageTextDrawId[playerid]);
- PlayerTextDrawDestroy(playerid, gNextButtonTextDrawId[playerid]);
- PlayerTextDrawDestroy(playerid, gPrevButtonTextDrawId[playerid]);
- gHeaderTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
- gBackgroundTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
- gCurrentPageTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
- gNextButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
- gPrevButtonTextDrawId[playerid] = PlayerText:INVALID_TEXT_DRAW;
- }
- //------------------------------------------------
- SpawnVehicle_InfrontOfPlayer(playerid, vehiclemodel, color1, color2)
- {
- new Float:x,Float:y,Float:z;
- new Float:facing;
- new Float:distance;
- GetPlayerPos(playerid, x, y, z);
- GetPlayerFacingAngle(playerid, facing);
- new Float:size_x,Float:size_y,Float:size_z;
- GetVehicleModelInfo(vehiclemodel, VEHICLE_MODEL_INFO_SIZE, size_x, size_y, size_z);
- distance = size_x + 0.5;
- x += (distance * floatsin(-facing, degrees));
- y += (distance * floatcos(-facing, degrees));
- facing += 90.0;
- if(facing > 360.0) facing -= 360.0;
- return CreateVehicle(vehiclemodel, x, y, z + (size_z * 0.25), facing, color1, color2, -1);
- }
- //------------------------------------------------
- HandlePlayerItemSelection(playerid, selecteditem)
- {
- // In this case we're spawning a vehicle for them
- SpawnVehicle_InfrontOfPlayer(playerid, gSelectionItemsTag[playerid][selecteditem], -1, -1);
- }
- //------------------------------------------------
- /* Car Spawner Things Ends */
- // Stocks:
- stock UserPath(playerid)
- {
- new string[128],playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),FOLDER,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;
- }
Advertisement
Add Comment
Please, Sign In to add comment