Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- //
- #define FILTERSCRIPT
- #include <a_samp>
- #include <sscanf2>
- #include <streamer>
- #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
- forward OnPlayerLeaveDynamicCP(playerid, checkpointid);
- forward OnPlayerEnterDynamicCP(playerid, checkpointid);
- forward Timer();
- forward StartBase(playerid, baseid);
- forward SetPlayerTeamFromClass(playerid, classid);
- forward SetPlayerToTeamColor(playerid);
- new gTeam[MAX_PLAYERS];
- new Text:gMyText;
- new Text:gMyText1;
- //new Menu:MENUID;
- new baseid;
- new Checkpoint[MAX_PLAYERS];
- #define theirteam
- #define TEAM_GANG 0
- #define TEAM_LSPD 1
- #define COLOR_GREEN 0x008000FF
- #define COLOR_BLUE 0x0000FFFF
- #define COLOR_RED 0xAA3333AA
- #define COLOR_BLACK 0x00000000
- #define DIALOGID 3300
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Blank Filterscript by your name here");
- 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
- SetGameModeText("A/D");
- SetTeamCount(2);
- UsePlayerPedAnims();
- gMyText = TextDrawCreate(320, 280, "Welcome");
- TextDrawColor(gMyText, COLOR_RED);
- TextDrawFont(gMyText, 1);
- TextDrawSetOutline(gMyText,1);
- TextDrawSetShadow(gMyText, 0);
- TextDrawLetterSize(gMyText, 1.0, 2.8);
- TextDrawUseBox(gMyText, 1);
- TextDrawBoxColor(gMyText, COLOR_BLACK);
- TextDrawSetOutline(gMyText, 1);
- TextDrawAlignment(gMyText, 2);
- AddPlayerClass(45,-183.5194,1090.8673,19.7422,52.6484,0,0,0,0,0,0);
- AddPlayerClass(150,1607.0870,1815.6981,10.8203,193.8336,0,0,0,0,0,0);
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerTeamFromClass(playerid, classid);
- SetPlayerPos(playerid, -193.1467,1093.5514,19.5961);
- SetPlayerFacingAngle(playerid, 359.1723);
- SetPlayerCameraPos(playerid, -192.9023,1101.4889,19.5938);
- SetPlayerCameraLookAt(playerid, -193.1467,1093.5514,19.5961);
- return 1;
- }
- SetPlayerTeamFromClass(playerid, classid)
- {
- if(classid == 0)
- {
- gTeam[playerid] = TEAM_GANG;
- return 1;
- }
- else if(classid == 1)
- {
- gTeam[playerid] = TEAM_LSPD;
- return 1;
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new string[256];
- new name[MAX_PLAYER_NAME];
- new plrIP[16];
- TextDrawShowForAll(gMyText);
- GetPlayerName(playerid, name, sizeof(name));
- GetPlayerIp(playerid, plrIP, sizeof(plrIP));
- format(string, sizeof(string), "%s has joined the server. (IP: %s)", name, plrIP);
- SendClientMessageToAll(0xC4C4C4FF, string);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new
- string[64],
- name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,MAX_PLAYER_NAME);
- switch(reason)
- {
- case 0: format(string,sizeof string,"%s left the server. (Timed out)",name);
- case 1: format(string,sizeof string,"%s left the server. (Leaving)",name);
- case 2: format(string,sizeof string,"%s left the server. (Kicked/Banned)",name);
- }
- SendClientMessageToAll(0xFFFFFFAA,string);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- GivePlayerWeapon(playerid, 24, 9999);
- SetPlayerArmour(playerid, 100.0);
- TextDrawDestroy(gMyText);
- SetPlayerToTeamColor(playerid);
- new
- string[120],
- pName[MAX_PLAYER_NAME];
- if(gTeam[playerid] == TEAM_GANG)
- {
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, -183.5194,1090.8673,19.7422);
- GetPlayerName(playerid, pName, sizeof(pName));
- format(string, sizeof string,"%s Has spawned as Gang.", pName);
- SendClientMessageToAll(COLOR_GREEN, string);
- return 1;
- }
- else if(gTeam[playerid] == TEAM_LSPD)
- {
- SetPlayerInterior(playerid, 0);
- SetPlayerPos(playerid, -183.5194,1090.8673,19.7422);
- GetPlayerName(playerid, pName, sizeof(pName));
- format(string, sizeof string,"%s Has spawned as LSPD.", pName);
- SendClientMessageToAll(COLOR_BLUE, string);
- return 1;
- }
- return 1;
- }
- SetPlayerToTeamColor(playerid)
- {
- if (gTeam[playerid] == TEAM_GANG)
- {
- SetPlayerColor(playerid, COLOR_GREEN);
- }
- else if(gTeam[playerid] == TEAM_LSPD)
- {
- SetPlayerColor(playerid, COLOR_BLUE);
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- SendDeathMessage(killerid, playerid, reason);
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(givecash, 8, cmdtext);
- dcmd(kill, 4, cmdtext);
- dcmd(switchteam, 10, cmdtext);
- dcmd(heal, 4, cmdtext);
- dcmd(lobby, 5, cmdtext);
- dcmd(dmexit, 6, cmdtext);
- dcmd(deagle, 6, cmdtext);
- dcmd(setteam, 7, cmdtext);
- dcmd(gunmenu, 7, cmdtext);
- dcmd(startbase, 9, cmdtext);
- dcmd(end, 3, cmdtext);
- return 0;
- }
- dcmd_givecash(playerid, params[])
- {
- new
- string[120],
- giveplayerid,
- amount,
- pName[MAX_PLAYER_NAME],
- playername[MAX_PLAYER_NAME];
- if (sscanf(params, "id", giveplayerid, amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /givecash [playerid/partname] [amount]");
- else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
- else
- {
- GivePlayerMoney(giveplayerid, amount);
- GetPlayerName(playerid, pName, sizeof(pName));
- GetPlayerName(giveplayerid, playername, sizeof(playername));
- format(string, sizeof(string), "%s has sent %s $%d ", pName, playername, amount);
- SendClientMessageToAll(0x00FF00AA, string);
- SendClientMessage(giveplayerid, 0x00FF00AA, "Money received");
- }
- return 1;
- }
- dcmd_switchteam(playerid, params[])
- {
- #pragma unused params
- ShowPlayerDialog(playerid, DIALOGID+1, DIALOG_STYLE_LIST, "Switch Menu", "{05F715}GANG\n{2908FF}LSPD", "Select", "Cancel");
- return 1;
- }
- dcmd_startbase(playerid, params[])
- {
- new baseid;
- if (sscanf(params, "i", baseid)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /startbase [Base ID]");
- SetTimer("StartBase", 1, false);
- Checkpoint[1] = CreateDynamicCP(-2412.6428,-584.3829,132.6484, 2, 1, -1, -1, 100);
- return 1;
- }
- dcmd_end(playerid, params[])
- {
- #pragma unused params
- for(new i = 0; i < MAX_PLAYERS; i++){
- SetPlayerPos(playerid, -183.5194,1090.8673,19.7422);
- SetPlayerInterior(playerid, 0);
- ResetPlayerWeapons(playerid);
- }
- return 1;
- }
- dcmd_kill(playerid, params[])
- {
- new
- id,
- reason[64], string[120];
- if (sscanf(params, "iz", id, reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /kill [playerid/partname] [reason]");
- else if (!IsPlayerConnected(id)) SendClientMessage(playerid, 0xFF0000AA, "Invalid id");
- else
- {
- SetPlayerHealth(id, 0);
- format(string, sizeof(string), "You have been killed (Reason: %s)", reason);
- SendClientMessage(id, 0xFF0000AA, string);
- SendClientMessage(playerid, 0xFF0000AA, "Player has been killed");
- }
- return 1;
- }
- dcmd_setteam(playerid, params[])
- {
- new id, teamid, string[120];
- if (sscanf(params, "ui", id, teamid)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /setteam [playerid] [teamid(0/gang)(1/LSPD)]");
- // else if (!IsPlayerConnected(id)) SendClientMessage(playerid, 0xFF0000AA, "Invalid id");
- // if you use the u param in sscanf it checks if their connected
- else
- {
- new team = GetPlayerTeam(id);
- if(teamid == 0) {
- if(team == TEAM_LSPD) {
- SetPlayerTeam(id, TEAM_GANG);
- SetPlayerSkin(id, 45);
- }
- else if(GetPlayerTeam(id) == TEAM_GANG) SendClientMessage(playerid, COLOR_RED, "Player is already in that team!");
- }
- else if (teamid == 1) {
- if(team == TEAM_GANG) {
- SetPlayerTeam(id, TEAM_LSPD);
- SetPlayerSkin(id, 150);
- }
- else if(team == TEAM_LSPD) SendClientMessage(playerid, COLOR_RED, "Player is already in that team!");
- }
- else SendClientMessage(playerid, COLOR_RED, "Invalid ID! ID must be 0 or 1");
- gTeam[id] = teamid;
- format(string, sizeof(string), "You have been switched to team %i", gTeam[playerid]);
- SendClientMessage(id, 0xFF0000AA, string);
- SendClientMessage(playerid, 0xFF0000AA, "Player has been switched");
- }
- return 1;
- }
- dcmd_gunmenu(playerid, params[])
- {
- new id;
- if (sscanf(params, "i", id)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /gunmenu [playerid]");
- else if (!IsPlayerConnected(id)) SendClientMessage(playerid, 0xFF0000AA, "Invalid id");
- else
- {
- ShowPlayerDialog(id, DIALOGID, DIALOG_STYLE_LIST, "Gunmenu", "{39D600}Deagle & {001DD6}Shotgun\n{39D600}Deagle & {001DD6}Ak47\n{39D600}Deagle & {001DD6}Rifle\n{39D600}Spaz & {001DD6}Silencer\n{39D600}M4 & {001DD6}Shotgun\n{39D600}M4 & {001DD6}MP5\n{39D600}Sniper & {001DD6}Shotgun\n{39D600}Sniper & {001DD6}MP5\n{39D600}Minigun & {001DD6}Shotgun", "Select", "Cancel");
- return 1;
- }
- return 1;
- }
- dcmd_heal(playerid, params[])
- {
- #pragma unused params
- SetPlayerHealth(playerid, 100);
- SetPlayerArmour(playerid, 100.0);
- SendClientMessage(playerid, COLOR_RED, "You have healed yourself!");
- return 1;
- }
- dcmd_lobby(playerid, params[])
- {
- #pragma unused params
- SetPlayerPos(playerid, -183.5194,1090.8673,19.7422);
- SendClientMessage(playerid, COLOR_RED, "You have teleported back to Lobby!");
- return 1;
- }
- dcmd_dmexit(playerid, params[])
- {
- #pragma unused params
- SetPlayerPos(playerid, -183.5194,1090.8673,19.7422);
- SendClientMessage(playerid, COLOR_RED, "You have exited the DM.");
- return 1;
- }
- dcmd_deagle(playerid, params[])
- {
- #pragma unused params
- new string[70], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid, pName, sizeof(pName));
- SetPlayerPos(playerid, 109.8002,1036.5322,13.6094);
- SetPlayerArmour(playerid, 100.0);
- SetPlayerHealth(playerid, 100);
- GivePlayerWeapon(playerid, 24, 9999);
- format(string, sizeof(string), "%s has entered the Deagle Zone, type /deagle to enter!", pName);
- SendClientMessageToAll(COLOR_RED, string);
- SendClientMessage(playerid, COLOR_RED, "You have entered the Deagle zone.");
- return 1;
- }
- 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 OnPlayerEnterDynamicCP(playerid, checkpointid)
- {
- if(checkpointid == Checkpoint[1]){
- if(gTeam[playerid] == TEAM_GANG){
- SetTimer("Timer", 1, false);
- }
- }
- return 1;
- }
- public Timer()
- {
- new string[50];
- for(new i = 30; i >= 0; i--){
- format(string, sizeof(string), "CP countdown: %i", i);
- gMyText1 = TextDrawCreate(250,420,string);
- TextDrawSetShadow(gMyText1, 0);
- TextDrawFont(gMyText1, 1);
- TextDrawSetString(gMyText1, string);
- TextDrawShowForAll(gMyText1);
- }
- return 1;
- }
- public OnPlayerLeaveDynamicCP(playerid, checkpointid)
- {
- if(checkpointid == Checkpoint[1]){
- TextDrawDestroy(gMyText1);
- }
- }
- public StartBase(playerid, baseid)
- {
- new baseid;
- new bvariable, string[50];
- baseid = bvariable;
- format(string, sizeof(string), "Base '%i' has been started.", bvariable);
- SendClientMessageToAll(COLOR_RED, string);
- ResetPlayerWeapons(playerid);
- switch(baseid) {
- case 0:
- {
- if(gTeam[playerid] == TEAM_GANG)
- {
- SetPlayerVirtualWorld(playerid, 1);
- SetPlayerPos(playerid, -2393.7087,-610.6938,132.6484);
- ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Gunmenu", "{39D600}Deagle & {001DD6}Shotgun\n{39D600}Deagle & {001DD6}Ak47\n{39D600}Deagle & {001DD6}Rifle\n{39D600}Spaz & {001DD6}Silencer\n{39D600}M4 & {001DD6}Shotgun\n{39D600}M4 & {001DD6}MP5\n{39D600}Sniper & {001DD6}Shotgun\n{39D600}Sniper & {001DD6}MP5\n{39D600}Minigun & {001DD6}Shotgun", "Select", "Cancel");
- }
- else if (gTeam[playerid] == TEAM_LSPD)
- {
- SetPlayerVirtualWorld(playerid, 1);
- SetPlayerPos(playerid, -2518.9707,-615.4091,132.5625);
- ShowPlayerDialog(playerid, DIALOGID, DIALOG_STYLE_LIST, "Gunmenu", "{39D600}Deagle & {001DD6}Shotgun\n{39D600}Deagle & {001DD6}Ak47\n{39D600}Deagle & {001DD6}Rifle\n{39D600}Spaz & {001DD6}Silencer\n{39D600}M4 & {001DD6}Shotgun\n{39D600}M4 & {001DD6}MP5\n{39D600}Sniper & {001DD6}Shotgun\n{39D600}Sniper & {001DD6}MP5\n{39D600}Minigun & {001DD6}Shotgun", "Select", "Cancel");
- }
- }
- }
- 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[])
- {
- if(dialogid == DIALOGID)
- {
- if(response)
- {
- if(listitem == 0)
- {
- GivePlayerWeapon(playerid, 24, 9999);
- GivePlayerWeapon(playerid, 25, 9999);
- SendClientMessage(playerid, COLOR_RED, "You choose Deagle & Shotgun.");
- }
- else if(listitem == 1)
- {
- GivePlayerWeapon(playerid, 24, 9999);
- GivePlayerWeapon(playerid, 30, 9999);
- SendClientMessage(playerid, COLOR_RED, "You choose Deagle & Ak47.");
- }
- else if(listitem == 2)
- {
- GivePlayerWeapon(playerid, 24, 9999);
- GivePlayerWeapon(playerid, 33, 9999);
- SendClientMessage(playerid, COLOR_RED, "You choose Deagle & Rifle.");
- }
- else if(listitem == 3)
- {
- GivePlayerWeapon(playerid, 27, 9999);
- GivePlayerWeapon(playerid, 23, 9999);
- SendClientMessage(playerid, COLOR_RED, "You choose Spaz-12 & Silencer.");
- }
- else if(listitem == 4)
- {
- GivePlayerWeapon(playerid, 31, 9999);
- GivePlayerWeapon(playerid, 25, 9999);
- SendClientMessage(playerid, COLOR_RED, "You choose M4 & Shotgun.");
- }
- else if(listitem == 5)
- {
- GivePlayerWeapon(playerid, 31, 9999);
- GivePlayerWeapon(playerid, 29, 9999);
- SendClientMessage(playerid, COLOR_RED, "You choose M4 & MP5.");
- }
- else if(listitem == 6)
- {
- GivePlayerWeapon(playerid, 34, 9999);
- GivePlayerWeapon(playerid, 25, 9999);
- SendClientMessage(playerid, COLOR_RED, "You choose Sniper & Shotgun.");
- }
- else if(listitem == 7)
- {
- GivePlayerWeapon(playerid, 34, 9999);
- GivePlayerWeapon(playerid, 29, 9999);
- SendClientMessage(playerid, COLOR_RED, "You choose Sniper & MP5.");
- }
- else if(listitem == 8)
- {
- GivePlayerWeapon(playerid, 38, 9999);
- GivePlayerWeapon(playerid, 25, 9999);
- SendClientMessage(playerid, COLOR_RED, "You choose Minigun & Shotgun.");
- }
- }
- return 1;
- }
- if(dialogid == DIALOGID+1)
- {
- if(response)
- {
- if(listitem == 0)
- {
- SetPlayerTeam(playerid, 0);
- SetPlayerSkin(playerid, 45);
- SendClientMessage(playerid, COLOR_GREEN, "You have spawned as Gang");
- }
- if(listitem == 1)
- {
- SetPlayerTeam(playerid, 1);
- SetPlayerSkin(playerid, 150);
- SendClientMessage(playerid, COLOR_BLUE, "You have spawned as LSPD");
- }
- return 1;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement