Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* DM arena System */
- // Credits: ---
- // PawnHunter - Creating this script.
- // Yashas - Awesome I-ZCMD include.
- // Emmet_ - For the mighty sscanf.
- // If you don't like the credits
- // you can remove it,
- // "I don't really care" ~Demi Lovato.
- // Notes: ---
- // 1. Redefine MAX_PLAYERS to your
- // server is max players to save
- // some memories. no need to use
- // 1000 cells while we just going
- // to use 20 - 100 cells.
- // 2. This is simple system
- // Contains 2 things.
- // WW Arena / RW Arena.
- // You can enter by following
- // Skull Icon in the mini-map.
- // 3. If you want to change
- // the place, make sure
- // to change it OnPlayerSpawn.
- // And change the random spawns.
- // 4. Players should be near DM Icon
- // to be able to use DM commands.
- // 5. Sorry for my bad English. x[
- /* */
- #define FILTERSCRIPT
- #include <a_samp>
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 40 // Change this define to your server's slots.
- #include <izcmd>
- #include <sscanf2>
- #define COLOR_RED 0xFF0000FF
- #define COLOR_ORANGE 0xEE9911FF
- #define COLOR_LIME 0x00FF00FF
- #define DM_WW_ARENA_VW 7500
- #define DM_RW_ARENA_VW 7501
- new
- Text3D:DMALabel,
- bool:InDM[MAX_PLAYERS],
- RWCount = 0,
- WWCount = 0,
- Float:RandomDMSpawn[][] =
- {
- {1746.588, -1743.243, 52.050},
- {1808.576, -1806.984, 52.050},
- {1747.467, -1806.729, 52.050},
- {1809.255, -1743.406, 52.050}
- };
- forward OnPlayerSpawnEx(playerid);
- stock Float:GetRandomArenaSpawn(&Float:x, &Float:y, &Float:z)
- {
- new Random = random(sizeof(RandomDMSpawn));
- x = RandomDMSpawn[Random][0];
- y = RandomDMSpawn[Random][1];
- z = RandomDMSpawn[Random][2];
- return 0.0;
- }
- stock SetPlayerRASpawn(playerid, virtualworld)
- {
- new Float:x, Float:y, Float:z;
- GetRandomArenaSpawn(x, y, z);
- SetPlayerVirtualWorld(playerid, virtualworld);
- SetPlayerPos(playerid, x, y, z);
- SetCameraBehindPlayer(playerid);
- SetPlayerHealth(playerid, 100.0);
- SetPlayerArmour(playerid, 100.0);
- switch(virtualworld)
- {
- case DM_WW_ARENA_VW:
- {
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid, WEAPON_SNIPER, cellmax);
- GivePlayerWeapon(playerid, WEAPON_SHOTGUN, cellmax);
- GivePlayerWeapon(playerid, WEAPON_DEAGLE, cellmax);
- }
- case DM_RW_ARENA_VW:
- {
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid, WEAPON_SAWEDOFF, cellmax);
- GivePlayerWeapon(playerid, WEAPON_UZI, cellmax);
- GivePlayerWeapon(playerid, WEAPON_DEAGLE, cellmax);
- }
- }
- return 1;
- }
- stock UpdateTextLabel()
- {
- new tmpstr[128];
- format(tmpstr, sizeof(tmpstr), "Deathmatch Arena Entrance\nUse /dma [WW - RW] to enter arena.\nWW Players Count: %i\nRW Players Count: %i", WWCount, RWCount);
- Update3DTextLabelText(DMALabel, COLOR_LIME, tmpstr);
- }
- stock SendDMJoinMessage(playerid, type)
- {
- new
- pName[MAX_PLAYER_NAME], tmpstr[128], pType[48], count;
- if(type == DM_RW_ARENA_VW) count = RWCount, format(pType, sizeof(pType), "Running Weapons");
- else if(type == DM_WW_ARENA_VW) count = WWCount, format(pType, sizeof(pType), "Walking Weapons");
- GetPlayerName(playerid, pName, sizeof(pName));
- format(tmpstr, sizeof(tmpstr), "(DM) %s(ID:%d) has joined DM arena, type: %s, count: %i", pName, playerid, pType, count);
- return SendClientMessageToAll(COLOR_ORANGE, tmpstr);
- }
- stock SendDMLeaveMessage(playerid, type)
- {
- new
- pName[MAX_PLAYER_NAME], tmpstr[128], pType[48], count;
- if(type == DM_RW_ARENA_VW) count = RWCount, format(pType, sizeof(pType), "Running Weapons");
- else if(type == DM_WW_ARENA_VW) count = WWCount, format(pType, sizeof(pType), "Walking Weapons");
- GetPlayerName(playerid, pName, sizeof(pName));
- format(tmpstr, sizeof(tmpstr), "(DM) %s(ID:%d) has left DM arena, type: %s, count: %i", pName, playerid, pType, count);
- return SendClientMessageToAll(COLOR_ORANGE, tmpstr);
- }
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------\n Basic deathmatch arena system\n Made by PawnHunter\n--------------------------------------");
- DMALabel = Create3DTextLabel("Deathmatch Arena Entrance\nUse /dma [WW - RW] to enter arena.\nWW Players Count: 0\nRW Players Count: 0",COLOR_LIME,2185, 1114, 14,40,0,0);
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- InDM[playerid] = false;
- SetPlayerMapIcon(playerid, 20, 2185, 1114, 12, 23, 0, MAPICON_GLOBAL);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(InDM[playerid])
- {
- switch(GetPVarInt(playerid, "dmVirtualWorld"))
- {
- case DM_RW_ARENA_VW: RWCount--, SendDMLeaveMessage(playerid, DM_RW_ARENA_VW);
- case DM_WW_ARENA_VW: WWCount--, SendDMLeaveMessage(playerid, DM_WW_ARENA_VW);
- }
- UpdateTextLabel();
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(InDM[playerid])
- {
- SetTimerEx("OnPlayerSpawnEx", 700, false, "i", playerid);
- }
- else if(GetPVarInt(playerid, "ExitingDMArena") == 1)
- {
- SetPlayerVirtualWorld(playerid, 0);
- DeletePVar(playerid, "ExitingDMArena");
- }
- return 1;
- }
- public OnPlayerSpawnEx(playerid)
- {
- if(IsPlayerConnected(playerid)) return SetPlayerRASpawn(playerid, GetPVarInt(playerid, "dmVirtualWorld"));
- return 0;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- CMD:dma(playerid, params[])
- {
- extract params -> new string:Usage[64]; else
- return SendClientMessage(playerid, COLOR_RED, "USAGE: dma <WW / RW / EXIT>");
- else if(IsPlayerInAnyVehicle(playerid))
- return SendClientMessage(playerid, COLOR_RED, "ERROR: Leave your vehicle before using this command.");
- else
- {
- if(!strcmp(Usage, "ww", true))
- {
- if (!IsPlayerInRangeOfPoint(playerid, 5.1, 2185.2, 1114.1, 12.3))
- return SendClientMessage(playerid, COLOR_RED, "ERROR: You can use this command while near deathmatch arena entrance (Skull icon).");
- InDM[playerid] = true;
- SetPlayerRASpawn(playerid, DM_WW_ARENA_VW);
- SetPVarInt(playerid, "dmVirtualWorld", DM_WW_ARENA_VW);
- WWCount++;
- UpdateTextLabel();
- SendDMJoinMessage(playerid, DM_WW_ARENA_VW);
- }
- else if(!strcmp(Usage, "rw", true))
- {
- if (!IsPlayerInRangeOfPoint(playerid, 5.1, 2185.2, 1114.1, 12.3))
- return SendClientMessage(playerid, COLOR_RED, "ERROR: You can use this command while near deathmatch arena entrance (Skull icon).");
- InDM[playerid] = true;
- SetPlayerRASpawn(playerid, DM_RW_ARENA_VW);
- SetPVarInt(playerid, "dmVirtualWorld", DM_RW_ARENA_VW);
- RWCount++;
- UpdateTextLabel();
- SendDMJoinMessage(playerid, DM_RW_ARENA_VW);
- }
- else if(!strcmp(Usage, "exit", true))
- {
- if(!InDM[playerid])
- return SendClientMessage(playerid, COLOR_RED, "ERROR: You cannot use this command while not inside one of deathmatch arena.");
- switch(GetPVarInt(playerid, "dmVirtualWorld"))
- {
- case DM_RW_ARENA_VW: RWCount--, SendDMLeaveMessage(playerid, DM_RW_ARENA_VW);
- case DM_WW_ARENA_VW: WWCount--, SendDMLeaveMessage(playerid, DM_WW_ARENA_VW);
- }
- UpdateTextLabel();
- InDM[playerid] = false;
- DeletePVar(playerid, "dmVirtualWorld");
- SpawnPlayer(playerid);
- SetPVarInt(playerid, "ExitingDMArena", 1);
- }
- }
- return CMD_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement