// This is a comment // uncomment the line below if you want to write a filterscript //#define FILTERSCRIPT #include <a_samp> #define Criminals 1 #define Cops 2 #define CriminalsColor 0xFF0000AA #define CopsColor 0x0015FFAA new Float:CopsRandomSpawns[3][3] = { {-2440.0681,1554.7762,2.1231}, {-2432.7119,1541.5345,2.1172}, {-2426.3713,1554.5654,5.0234} }; new Float:CriminalRandomSpawns[3][3] = { {-2367.1274,1553.5460,2.1172}, {-2371.1040,1544.6459,5.0234}, {-2369.3916,1541.5813,7.9219} }; forward SetPlayerRandomCopsSpawns(playerid); // Forwarding the function public SetPlayerRandomCopsSpawns(playerid) // Setting it up { new rand = random(sizeof(CopsRandomSpawns)); // Making it select random options instead of a definite one SetPlayerPos(playerid, CopsRandomSpawns[rand][0], CopsRandomSpawns[rand][1], CopsRandomSpawns[rand][2]); // [rand] tag means random, [0] = X, [1] = Y, [2] = Z return 1; } /// Rest is same as above, just Cops replaced Criminals forward SetPlayerRandomCriminalSpawns(playerid); public SetPlayerRandomCriminalSpawns(playerid) { new rand = random(sizeof(CriminalRandomSpawns)); SetPlayerPos(playerid, CriminalRandomSpawns[rand][0], CriminalRandomSpawns[rand][1], CriminalRandomSpawns[rand][2]); return 1; } #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Team DeathMatch Filterscript"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("\n----------------------------------"); print(" Blank Gamemode by your name here"); print("----------------------------------\n"); } #endif public OnGameModeInit() { // Don't use these lines if it's a filterscript AddPlayerClass(282, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); AddPlayerClass(117, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { switch(classid) // Switching between the classids { case 0/* The first classid is of the cops*/: { SetPlayerTeam(playerid, Cops); // Setting players team GameTextForPlayer(playerid, "~b~Cops", 1000, 3); // Screen msg for player to show what team } case 1/* The second classid is of the criminals*/: { SetPlayerTeam(playerid, Criminals); // Same as above GameTextForPlayer(playerid, "~r~Criminals", 1000, 3); // Same as above } } return 1; } public OnPlayerConnect(playerid) { return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } public OnPlayerSpawn(playerid) if(GetPlayerTeam(playerid) == Cops) { SetPlayerColor(playerid, CopsColor); // Set his color to CopsColor (BLUE) SetPlayerRandomCopsSpawns(playerid); /// NEW LINE! Enabling random spawns /* Any other bonus you want for Cops team! A special gun, skin, color, attachedobject, A random spawn! */ } else if(GetPlayerTeam(playerid) ==Criminals) { SetPlayerColor(playerid, CriminalsColor); // Same as above but in this case, CriminalsColor (RED) SetPlayerRandomCriminalSpawns(playerid);///// Same as above } public OnPlayerDeath(playerid, killerid, reason) { 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("/mydm", 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) { 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[]) { return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; }
i made this.
Код:
// This is a comment // uncomment the line below if you want to write a filterscript //#define FILTERSCRIPT #include <a_samp> #define Criminals 1 #define Cops 2 #define CriminalsColor 0xFF0000AA #define CopsColor 0x0015FFAA new Float:CopsRandomSpawns[3][3] = { {-2440.0681,1554.7762,2.1231}, {-2432.7119,1541.5345,2.1172}, {-2426.3713,1554.5654,5.0234} }; new Float:CriminalRandomSpawns[3][3] = { {-2367.1274,1553.5460,2.1172}, {-2371.1040,1544.6459,5.0234}, {-2369.3916,1541.5813,7.9219} }; forward SetPlayerRandomCopsSpawns(playerid); // Forwarding the function public SetPlayerRandomCopsSpawns(playerid) // Setting it up { new rand = random(sizeof(CopsRandomSpawns)); // Making it select random options instead of a definite one SetPlayerPos(playerid, CopsRandomSpawns[rand][0], CopsRandomSpawns[rand][1], CopsRandomSpawns[rand][2]); // [rand] tag means random, [0] = X, [1] = Y, [2] = Z return 1; } /// Rest is same as above, just Cops replaced Criminals forward SetPlayerRandomCriminalSpawns(playerid); public SetPlayerRandomCriminalSpawns(playerid) { new rand = random(sizeof(CriminalRandomSpawns)); SetPlayerPos(playerid, CriminalRandomSpawns[rand][0], CriminalRandomSpawns[rand][1], CriminalRandomSpawns[rand][2]); return 1; } #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Team DeathMatch Filterscript"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("\n----------------------------------"); print(" Blank Gamemode by your name here"); print("----------------------------------\n"); } #endif public OnGameModeInit() { // Don't use these lines if it's a filterscript AddPlayerClass(282, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); AddPlayerClass(117, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0); return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { switch(classid) // Switching between the classids { case 0/* The first classid is of the cops*/: { SetPlayerTeam(playerid, Cops); // Setting players team GameTextForPlayer(playerid, "~b~Cops", 1000, 3); // Screen msg for player to show what team } case 1/* The second classid is of the criminals*/: { SetPlayerTeam(playerid, Criminals); // Same as above GameTextForPlayer(playerid, "~r~Criminals", 1000, 3); // Same as above } } return 1; } public OnPlayerConnect(playerid) { return 1; } public OnPlayerDisconnect(playerid, reason) { return 1; } public OnPlayerSpawn(playerid) if(GetPlayerTeam(playerid) == Cops) { SetPlayerColor(playerid, CopsColor); // Set his color to CopsColor (BLUE) SetPlayerRandomCopsSpawns(playerid); /// NEW LINE! Enabling random spawns /* Any other bonus you want for Cops team! A special gun, skin, color, attachedobject, A random spawn! */ } else if(GetPlayerTeam(playerid) ==Criminals) { SetPlayerColor(playerid, CriminalsColor); // Same as above but in this case, CriminalsColor (RED) SetPlayerRandomCriminalSpawns(playerid);///// Same as above } public OnPlayerDeath(playerid, killerid, reason) { 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("/mydm", 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) { 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[]) { return 1; } public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; } |
COMMAND:battle(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 2) //change 2 to whatever admin level you want it to be. { for(new i = 0; i < MAX_PLAYERS; i++) if(GetPlayerTeam(i) == Cops) { SetPlayerPos(i, //pos for the COPS in the battle); GivePlayerWeapon(i, weaponid, 100); //search for GivePlayerWeapon on wiki, you'll get a list of guns //Here you can also give them other guns, just copy/paste the function above, and change the weaponid to whatever you want TogglePlayerControllable(i, 0); // freeze's them } else if(GetPlayerTeam(i) == Criminals) { SetPlayerPos(i, //pos for the CRIMINALS in the battle); GivePlayerWeapon(i, weaponid, 100); //search for GivePlayerWeapon on wiki, you'll get a list of guns //Here you can also give them other guns, just copy/paste the function above, and change the weaponid to whatever you want TogglePlayerControllable(i, 0); // freeze's them. } } return 1; }
COMMAND:startbattle(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 2) { for(new i = 0; i < MAX_PLAYERS; i++) TogglePlayerControllable(i, 1); if(GetPlayerTeam(i) == Cops) { SendClientMessage(i, COLOR_WHITE, "The battle has began! kill the criminals!"); } else if(GetPlayerTeam(i) == Criminals) { SendClientMessage(i, COLOR_WHITE, "The battle has began! kill the criminals!"); } } return 1; }