#include <a_samp> #define COLOR_YELLOW 0xFFFF00AA #define COLOR_WHITE 0xFFFFFFAA #define COLOR_RED 0xFF0000AA forward EndRound(playerid); // The end of the round. forward OneSecTimer(playerid); // Repeats functions every sec. forward MineTimer(playerid); // Creates a new mine every 20 seconds. forward LobbyTimer(playerid); // How long players wait until match starts. new CanPlayerSpawn[MAX_PLAYERS]; new bangers[20]; // Defines the bangers variable and how many of them. new playamount; // The amount of players in the game. new countdown = 0; new mine; main() { print("\n----------------------------------"); print(" Demolition Derby - Created by Deji."); // Shows up on msdos console. print("----------------------------------\n"); } public OnGameModeInit() // When the game mode is started. { new banger = 504; // Define the model. playamount = 0; ShowPlayerMarkers(0); ShowNameTags(1); SetGameModeText("DEMOLITION DERBY"); // Sets the text on the samp client under 'mode' // We only need one character, CJ. If you want more, add more. AddPlayerClass(0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); // Simply added/taken 4 to make cars go along a row. // The variable 'banger' refers to model 504 creating the bloodring banger. // Vehicles must be created with a handle for use. bangers[0] = AddStaticVehicle(banger,-1280.9,994.8,1037.0,90.0,-1,-1);//Up bangers[1] = AddStaticVehicle(banger,-1280.9,998.8,1037.0,90.0,-1,-1);//Up +4 bangers[2] = AddStaticVehicle(banger,-1280.9,990.8,1037.0,90.0,-1,-1);//Up -4 bangers[3] = AddStaticVehicle(banger,-1280.9,986.8,1037.0,90.0,-1,-1);//Up -8 bangers[4] = AddStaticVehicle(banger,-1280.9,1002.8,1037.0,90.0,-1,-1);//Up +8 bangers[5] = AddStaticVehicle(banger,-1519.4,994.8,1037.0,270.0,-1,-1);//Down bangers[6] = AddStaticVehicle(banger,-1519.4,998.8,1037.0,270.0,-1,-1);//Down +4 bangers[7] = AddStaticVehicle(banger,-1519.4,990.8,1037.0,270.0,-1,-1);//Down -4 bangers[8] = AddStaticVehicle(banger,-1519.4,986.8,1037.0,270.0,-1,-1);//Down -8 bangers[9] = AddStaticVehicle(banger,-1519.4,1002.8,1037.0,270.0,-1,-1);//Down +8 /*// Code won't work well! The cars spawn in the wall so I spawned 10 cars on right side. bangers[10] = AddStaticVehicle(banger,-1419.58,932.52,1037.0,360.0,-1,-1);//Left bangers[11] = AddStaticVehicle(banger,-1423.58,932.52,1037.0,360.0,-1,-1);//Left +4 bangers[12] = AddStaticVehicle(banger,-1415.58,932.52,1037.0,360.0,-1,-1);//Left -4 bangers[13] = AddStaticVehicle(banger,-1411.58,932.52,1037.0,360.0,-1,-1);//Left -8 bangers[14] = AddStaticVehicle(banger,-1427.58,932.52,1037.0,360.0,-1,-1);//Left +8*/ bangers[10] = AddStaticVehicle(banger,-1420.58,1057.6,1037.0,180.0,-1,-1);//Right bangers[11] = AddStaticVehicle(banger,-1424.58,1057.6,1037.0,180.0,-1,-1);//Right +4 bangers[12] = AddStaticVehicle(banger,-1416.58,1057.6,1037.0,180.0,-1,-1);//Right -4 bangers[13] = AddStaticVehicle(banger,-1412.58,1057.6,1037.0,180.0,-1,-1);//Right -8 bangers[14] = AddStaticVehicle(banger,-1428.58,1057.6,1037.0,180.0,-1,-1);//Right +8 bangers[15] = AddStaticVehicle(banger,-1432.58,1057.6,1037.0,180.0,-1,-1);//Right +12 bangers[16] = AddStaticVehicle(banger,-1408.58,1057.6,1037.0,180.0,-1,-1);//Right -12 bangers[17] = AddStaticVehicle(banger,-1436.58,1057.6,1037.0,180.0,-1,-1);//Right +16 bangers[18] = AddStaticVehicle(banger,-1404.58,1057.6,1037.0,180.0,-1,-1);//Right -16 bangers[19] = AddStaticVehicle(banger,-1400.58,1057.6,1037.0,180.0,-1,-1);//Right -18 // Link each vehicle to the interior of the bloodring bowl. LinkVehicleToInterior(bangers[0],15); LinkVehicleToInterior(bangers[1],15); LinkVehicleToInterior(bangers[2],15); LinkVehicleToInterior(bangers[3],15); LinkVehicleToInterior(bangers[4],15); LinkVehicleToInterior(bangers[5],15); LinkVehicleToInterior(bangers[6],15); LinkVehicleToInterior(bangers[7],15); LinkVehicleToInterior(bangers[8],15); LinkVehicleToInterior(bangers[9],15); LinkVehicleToInterior(bangers[10],15); LinkVehicleToInterior(bangers[11],15); LinkVehicleToInterior(bangers[12],15); LinkVehicleToInterior(bangers[13],15); LinkVehicleToInterior(bangers[14],15); LinkVehicleToInterior(bangers[15],15); LinkVehicleToInterior(bangers[16],15); LinkVehicleToInterior(bangers[17],15); LinkVehicleToInterior(bangers[18],15); LinkVehicleToInterior(bangers[19],15); mine=AddStaticPickup(2918,10,-1399.2914,998.7208,1023.9478); return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerInterior(playerid, 15); // Makes the player be in the right interior SetPlayerCameraPos(playerid, -1400.0, 1000.0, 1130.0); SetPlayerCameraLookAt(playerid, -1400.0, 1000.0, 1030.0); SetPlayerScore(playerid,0); return 1; } public OnPlayerRequestSpawn(playerid) { if (CanPlayerSpawn[playerid] == 1) { SendClientMessage(playerid,COLOR_WHITE,"Cannot join while round is in progress, please watch until it has finished!"); return 0; } return 1; } public OnPlayerConnect(playerid) { GameTextForPlayer(playerid, "~g~DEMOLITION ~y~DERBY ~r~DEATHMATCH", 5000, 4); SetPlayerInterior(playerid, 15); EnableTirePopping(0); EnableZoneNames(0); TogglePlayerClock(playerid,0); SetPlayerColor(playerid,COLOR_WHITE); return 1; } public OnPlayerDisconnect(playerid, reason) { SetVehicleHealth(bangers[playerid], 0.0); // Cause it to blow up for excitement! return 1; } public OnPlayerSpawn(playerid) { SetPlayerInterior(playerid, 15); // Makes the player be in the right interior /* // Neat lil code puts the player in a random car :D // it took me 5 mins to figure out for my first time!! new randcar[20][1] = { {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}, {11},{12},{13},{14},{15},{16},{17},{17},{19} }; new rand = random(sizeof(randcar)); */ // I ended up not needing the random code. It was easier to choose the cars via // the players id. So player 5 would be in car 5... // This also prevents any 2 users being in the same vehicle. PutPlayerInVehicle(playerid, bangers[playerid], 0); TogglePlayerControllable(playerid,0); ForceClassSelection(playerid); countdown=0; SetTimer("LobbyTimer", 27000, 0); playamount = GetMaxPlayers(); SetPlayerScore(playerid,0); return 1; } public OnPlayerDeath(playerid, killerid, reason) { new blewupname[256]; new str[256]; TogglePlayerControllable(playerid,0); // Stop player from respawning before finish. SetPlayerScore(playerid,0); if (PlayerToPoint(5.0,playerid,-1399.2914,998.7208,1023.9478)) { GetPlayerName(playerid,blewupname,sizeof(blewupname)); format(str, sizeof(str), "* %s got pwned by the Mine of Death!", blewupname); SendClientMessageToAll(COLOR_RED, str); } else if (reason == 255) { GetPlayerName(playerid,blewupname,sizeof(blewupname)); format(str, sizeof(str), "* %s is out of the match!", blewupname); SendClientMessageToAll(COLOR_RED, str); } return 1; } PlayerToPoint(Float:radius, playerid, Float:X, Float:Y, Float:Z) { new Float:oldpos[3], Float:temppos[3]; GetPlayerPos(playerid, oldpos[0], oldpos[1], oldpos[2]); temppos[0] = (oldpos[0] -X); temppos[1] = (oldpos[1] -Y); temppos[2] = (oldpos[2] -Z); if(((temppos[0] < radius) && (temppos[0] > -radius)) && ((temppos[1] < radius) && (temppos[1] > -radius)) && ((temppos[2] < radius) && (temppos[2] > -radius))) { return true; } return false; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { SetVehicleToRespawn(vehicleid); // Make vehicle respawn. return 1; } public OnPlayerText(playerid, text[]) { return 1; } public OnPlayerPrivmsg(playerid, recieverid, text[]) { return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp(cmdtext, "/me", true, 3)) // 3 is the length of /me { if(cmdtext[3] == 0) { SendClientMessage(playerid, 0xAA3333AA, "USAGE: /me [action]"); return 1; } new str[128]; GetPlayerName(playerid, str, sizeof(str)); format(str, sizeof(str), "* %s %s", str, cmdtext[4]); SendClientMessageToAll(COLOR_RED, str); return 1; } if(!strcmp(cmdtext, "/help", true, 5)) { SendClientMessage(playerid,0xAA3333AA,"The idea of the game is to eliminate the other players by destroying their cars!"); SendClientMessage(playerid,0xAA3333AA,"The winner is the last man driving! There is a mine in the middle that should"); SendClientMessage(playerid,0xAA3333AA,"help you destroy the other cars without getting destroyed yourself!"); SendClientMessage(playerid,0xAA3333AA,"Exiting your vehicle will result in disqualification. Weapons are not allowed!"); SendClientMessage(playerid,0xAA3333AA,"Enter /commands to see a list of commands."); return 1; } if(!strcmp(cmdtext, "/commands", true, 9)) { SendClientMessage(playerid,0xAA3333AA,"/help - Sends you a few messages to help you play this gamemode!"); SendClientMessage(playerid,0xAA3333AA,"/me - Let's you do 3rd person text. Example: /me is driving a car."); SendClientMessage(playerid,0xAA3333AA,"/q or /quit - Quit's and closes SAMP. Example: /me is driving a car."); SendClientMessage(playerid,0xAA3333AA,"/commands - Shows you this message displaying commands you can enter."); return 1; } if(!strcmp(cmdtext, "/acommand", true, 9)) if(IsPlayerAdmin(playerid)) { SendClientMessage(playerid,0xAA3333AA,"/kick [id] - Kick player out of the game. /ban [id] - Ban player from the server(*)"); SendClientMessage(playerid,0xAA3333AA,"/dc [id] - Destroy a car (*)."); return 1; } else { SendClientMessage(playerid,0xAA3333AA,"NONE OF YOUR BUSINESS!"); } if(!strcmp(cmdtext, "/kick", true, 5)) if(IsPlayerAdmin(playerid)) { if(cmdtext[3] == 0) { SendClientMessage(playerid, 0xAA3333AA, "USAGE: /kick [ID/NAME]"); return 1; } new yr,mnth,day,hr,minu,sec; new str[256],kcknm[256],fs[256]; new File:slg=fopen("server.log.txt",io_append); Kick(cmdtext[6]); GetPlayerName(playerid, str, sizeof(str)); GetPlayerName(cmdtext[6], kcknm, sizeof(str)); format(str, sizeof(str), "* %s kicked %s for", str, kcknm, cmdtext[8]); SendClientMessageToAll(0xAA3333AA, str); getdate(yr,mnth,day); gettime(hr,minu,sec); format(fs, 256, "%s was kicked by %s at %d:%d on the %d/%d for %s\n",kcknm,str,hr,minu,mnth,day,cmdtext[8]); fwrite(slg, fs); fclose(slg); return 1; } // Ban currently doesn't actually ban the player. It just seems to kick them. // Shouldn't be hard to fix though. Just a task of adding the banned names to an .ini. if(!strcmp(cmdtext, "/ban", true, 4)) if(IsPlayerAdmin(playerid)) { if(cmdtext[3] == 0) { SendClientMessage(playerid, 0xAA3333AA, "USAGE: /kick [ID/NAME] [REASON]"); return 1; } new yr,mnth,day,hr,minu,sec; new str[256],kcknm[256],fs[256]; new File:slg=fopen("server.log.txt",io_append); Kick(cmdtext[6]); GetPlayerName(playerid, str, sizeof(str)); GetPlayerName(cmdtext[6], kcknm, sizeof(str)); format(str, sizeof(str), "* %s banned %s for", str, kcknm, cmdtext[8]); SendClientMessageToAll(0xAA3333AA, str); getdate(yr,mnth,day); gettime(hr,minu,sec); format(fs, 256, "%s was banned by %s at %d:%d on the %d/%d for %s\n",kcknm,str,hr,minu,mnth,day,cmdtext[8]); fwrite(slg, fs); fclose(slg); return 1; } // Another bad command. This will crash the server upon use!! Do not uncomment unless // you know how to fix it. If you do fix it, tell me how you did! /* if(!strcmp(cmdtext, "/dc", true, 3)) if(IsPlayerAdmin(playerid)) { if(cmdtext[3] == 0) { SendClientMessage(playerid, 0xAA3333AA, "USAGE: /d(estroy)c(car) [CARID/PLAYERID]"); return 1; } new yr,mnth,day,hr,minu,sec; new str[256],fs[256]; new File:slg=fopen("server.log.txt",io_append); new Float:xx,Float:xy,Float:xz; GetPlayerName(playerid,str,256); GetVehiclePos(bangers[cmdtext[5]],xx,xy,xz); CreateExplosion(xx,xy,xz,15,4.0); getdate(yr,mnth,day); gettime(hr,minu,sec); format(fs, 256, "%s destroyed %s on %d/%d - %d:%d",str,cmdtext[5]); fwrite(slg, fs); fclose(slg); return 1; }*/ return 0; } public OnPlayerInfoChange(playerid) { return 1; } public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { SetPlayerHealth(playerid,0.0); SetVehicleToRespawn(vehicleid); GameTextForPlayer(playerid,"~r~You were disqualified for exiting your vehicle!",4000,5); 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 OnObjectMoved(objectid) { return 1; } public OnPlayerObjectMoved(playerid, objectid) { return 1; } public OnPlayerPickUpPickup(playerid, pickupid) { return 1; } public OnPlayerSelectedMenuRow(playerid, row) { return 1; } public OnPlayerExitedMenu(playerid) { return 1; } public OneSecTimer(playerid) { new hour; new mint; new sec; ResetPlayerWeapons(playerid); // Disables the abillity to hack weapons :D ResetPlayerMoney(playerid); gettime(hour,mint,sec); SetPlayerTime(playerid,hour,mint); new score = GetPlayerScore(playerid); SetPlayerScore(playerid,score+1); if(IsPlayerInAnyVehicle(playerid)) { } else { SetTimer("EndRound",2000,0); SetTimer("OneSecTimer",0,0); } for(new i = 0; i < MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { } else { SetVehicleToRespawn(bangers[i]); } } return 1; } public MineTimer(playerid) { mine=AddStaticPickup(2918,10,-1399.2914,998.7208,1023.9478); return 1; } public EndRound(playerid) { new winnername[MAX_PLAYER_NAME]; new wintext[256]; if (IsPlayerInAnyVehicle(playerid)) { } else { GameTextForAll("Round Finished!", 5000, 5); GetPlayerName(playerid,winnername,256); format(wintext,256,"%s has won the match!",winnername); SendClientMessageToAll(COLOR_YELLOW,wintext); TogglePlayerControllable(playerid,0); } return 1; } public LobbyTimer(playerid) { if(countdown == 0) { GameTextForAll("~y~3", 999, 5); countdown=1; SetTimer("LobbyTimer", 1000, 0); return 0; } else if(countdown == 1) { GameTextForAll("~y~2", 999, 5); countdown=2; SetTimer("LobbyTimer", 1000, 0); return 0; } else if(countdown == 2) { GameTextForAll("~y~1", 999, 5); countdown=3; SetTimer("LobbyTimer", 1000, 0); return 0; } else if(countdown == 3) { GameTextForAll("~g~GO!", 3000, 0); TogglePlayerControllable(playerid,1); // Re-enable player movement. SetTimer("OneSecTimer", 1000, 1); SetTimer("MineTimer", 10000, 1); countdown=0; CanPlayerSpawn[playerid] = false; return 0; } return 1; } //------------------------------------------------
Originally Posted by Luka[balkan-samp.com
]
Nice idea,but more for Mini Missions servers ho change gamemode every 10 minutes because this is not for 'static' gamemode,gamemode doesn`t have story... |
if(!strcmp(cmdtext, "/dc", true, 3)) if(IsPlayerAdmin(playerid)) { if(cmdtext[3] == 0) { SendClientMessage(playerid, 0xAA3333AA, "USAGE: /d(estroy)c(car) [CARID/PLAYERID]"); return 1; } new yr,mnth,day,hr,minu,sec; new str[256],fs[256]; new File:slg=fopen("server.log.txt",io_append); new Float:xx,Float:xy,Float:xz; GetPlayerName(playerid,str,256); GetVehiclePos(bangers[cmdtext[5]],xx,xy,xz); CreateExplosion(xx,xy,xz,15,4.0); getdate(yr,mnth,day); gettime(hr,minu,sec); format(fs, 256, "%s destroyed %s on %d/%d - %d:%d",str,cmdtext[5]); fwrite(slg, fs); fclose(slg); return 1; }