Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*========================================
- Event Filterscript
- By AldoT
- ==========================================*/
- //=== Includes ===
- #include <a_samp>
- #include <zcmd>
- //=== Defines ===
- #define COLOR_RED 0xFF0000AA
- #define COLOR_YELLOW 0xFFFF00AA
- //=== Locations ===
- new CageFight, CageFightOn;
- new CurrentPos, CurrentPosOn;
- new EventGoingOn;
- //=== Counters ===
- new NumCageFighters;
- new NumCurrentFighters;
- //=== Other ===
- new string[128];
- new Float:EventLocation[3];
- new PlayerAtEvent[MAX_PLAYERS];
- new EventInterior;
- //=== Forwards ===
- forward StartEvent();
- forward PrepareEvent();
- forward EndEventCheck();
- forward SendEventMessage(color, Zstring[]);
- forward ResetEventSelectedWeps();
- forward EndCuf(playerid);
- forward ExitERNING(playerid);
- forward EndGet(playerid);
- ////////////////
- new Text:ERNING;
- new Text:weapon;
- ////////////////
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Last Man Standing was Create by AldoT ");
- print("--------------------------------------\n");
- NumCageFighters = 0;
- NumCurrentFighters = 0;
- CageFight = 0;
- CurrentPos = 0;
- CageFightOn = 0;
- CurrentPosOn = 0;
- EventGoingOn = 0;
- ResetEventSelectedWeps();
- for(new i = 0; i < GetMaxPlayers(); i++) PlayerAtEvent[i] = 0;
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- PlayerAtEvent[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(PlayerAtEvent[playerid] != 0)
- {
- SetTimer("EndEventCheck", 3000, 0);
- if(CageFightOn == 1) NumCageFighters--;
- else if (CurrentPosOn == 1) NumCurrentFighters--;
- new kick[64], Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
- format(kick,sizeof kick,"» Last Man Standing ~ Kick: %s",Name);
- SendClientMessageToAll(0xFF7800FF,kick);
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(PlayerAtEvent[playerid] != 0)
- {
- SetTimer("EndEventCheck", 3000, 0);
- if(CageFightOn == 1) NumCageFighters--;
- else if (CurrentPosOn == 1) NumCurrentFighters--;
- PlayerAtEvent[playerid] = 0;
- new Death[64], Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
- format(Death,sizeof Death,"» Last Man Standing ~ Death: %s",Name);
- SendClientMessageToAll(0xFF7800FF,Death);
- new Float:killerHP;
- GetPlayerHealth(killerid, killerHP);
- SetPlayerHealth(killerid, killerHP+24);
- EventGoingOn = 1;
- }
- return 1;
- }
- public SendEventMessage(color, Zstring[])
- {
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(IsPlayerConnected(i))
- {
- if(PlayerAtEvent[i] != 0)
- {
- SendClientMessage(i, color, string);
- }
- }
- }
- }
- public PrepareEvent()
- {
- SetTimer("StartEvent", 30000, 0);
- return 1;
- }
- public StartEvent()
- {
- if(NumCageFighters > 1 || NumCurrentFighters > 1)
- {
- if(CageFight == 1) CageFightOn = 1; // To let the server know which event a player is eliminated from
- if(CurrentPos == 1) CurrentPosOn = 1;
- CageFight = 0; // TO avoid signups after event is started
- CurrentPos = 0;
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(PlayerAtEvent[i] == 1)
- {
- SetTimerEx("EndGet",9000,0,"i",i);
- TextDrawShowForPlayer(i,weapon);
- SetTimerEx("EndCuf",9000,0,"i",i);
- TogglePlayerControllable(i,true);
- PlayerPlaySound(i, 3200, 0, 0, 0);
- }
- }
- }
- else
- {
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(PlayerAtEvent[i] != 0)
- {
- ResetPlayerWeapons(i);
- SendClientMessage(i,COLOR_RED,"{E8D04C}[EVENT]{FFFFFF} Last Man Standing ended due to lack of contenders.");
- SpawnPlayer(i);
- PlayerAtEvent[i] = 0;
- EventGoingOn = 0;
- CageFight = 0;
- CurrentPos = 0;
- }
- }
- }
- return 1;
- }
- public EndEventCheck()
- {
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- if(PlayerAtEvent[i] == 1)
- {
- if(NumCageFighters == 1)
- {
- TextDrawShowForPlayer(i,ERNING);
- new prize[64], Name[MAX_PLAYER_NAME];
- GetPlayerName(i,Name,MAX_PLAYER_NAME);
- SetTimerEx("ExitERNING",3000,0,"i",i);
- format(prize,sizeof prize,"* %s survived the Last Man Standing. Prize: $2000.",Name);
- SendClientMessageToAll(0xFF7800FF,prize);
- GivePlayerMoney(i, 2000);
- SpawnPlayer(i);
- PlayerAtEvent[i] = 0;
- NumCageFighters = 0;
- ResetEventSelectedWeps();
- return 1;
- }
- else if(NumCurrentFighters == 1)
- {
- new prize[64], Name[MAX_PLAYER_NAME];
- GetPlayerName(i,Name,MAX_PLAYER_NAME);
- SetTimerEx("ExitERNING",3000,0,"i",i);
- TextDrawShowForPlayer(i,ERNING);
- format(prize,sizeof prize,"* %s survived the Last Man Standing. Prize: $2000.",Name);
- SendClientMessageToAll(0xFF7800FF,prize);
- GivePlayerMoney(i, 2000);
- SpawnPlayer(i);
- PlayerAtEvent[i] = 0;
- NumCurrentFighters = 0;
- ResetEventSelectedWeps();
- return 1;
- }
- }
- }
- return 1;
- }
- public ResetEventSelectedWeps()
- {
- CageFight = 0;
- CurrentPos = 0;
- CurrentPosOn = 0;
- CageFightOn = 0;
- EventGoingOn = 0;
- for(new i = 0; i < GetMaxPlayers(); i++) PlayerAtEvent[i] = 0;
- }
- //============================ Commands ========================================
- CMD:event(playerid, params[])
- {
- if(EventGoingOn == 1) return SendClientMessage(playerid, COLOR_RED, "Last Man Standing is alreay started, too late to join. ");
- EventGoingOn = 1;
- CageFight = 1;
- CurrentPos = 1;
- SetTimer("PrepareEvent", 1000, 0);
- new start[200], Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
- format(start,sizeof start,"* %s is Standing a Last Man Standing, Localition: Jefferson Motel.", Name);
- SendClientMessageToAll(0xFF7800FF,start);
- SendClientMessageToAll(0xFF7800FF ,"* Type ' /lmsjoin ' to participate.");
- return 1;
- }
- CMD:lmsjoin(playerid, params[])
- {
- if(PlayerAtEvent[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You are at an Last Man Standing now.");
- {
- //------------------------- Cage Fight----------------------------------
- if(CageFight == 1)
- {
- TextDrawShowForPlayer(playerid, weapon);
- new join[64], Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
- format(join,sizeof join,"» Last Man Standing ~ Join: %s",Name);
- SendClientMessageToAll(0xFF7800FF,join);
- TogglePlayerControllable(playerid,false);// Freezing the player until Event start
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
- SetPlayerPos(playerid, 2193.3101,-1141.7870,1029.7969);
- SetPlayerInterior(playerid, 15);
- ResetPlayerWeapons(playerid);
- GivePlayerWeapon(playerid,24,44);
- GivePlayerWeapon(playerid,27,44);
- GivePlayerWeapon(playerid,31,200);
- GivePlayerWeapon(playerid,29,150);
- SetPlayerHealth(playerid, 100);
- SetPlayerTeam(playerid, NO_TEAM);
- SetPlayerColor(playerid,0xFF6600FF);
- new skinsLastManStading[3] ={
- 84,
- 83,
- 82,
- };
- SetPlayerSkin(playerid, skinsLastManStading[random(3)]);
- NumCageFighters++;//counter
- PlayerAtEvent[playerid] = 1;
- return 1;
- }
- //------------------------- Current Pos --------------------------------
- if(CurrentPos == 1)
- {
- SetPlayerPos(playerid, EventLocation[0] + (random(3) - random(3)),EventLocation[1] + (random(3) - random(3)),EventLocation[2]);
- SetPlayerInterior(playerid, EventInterior);
- NumCurrentFighters++;
- PlayerAtEvent[playerid] = 1;
- new join[64], Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
- format(join,sizeof join,"» Last Man Standing ~ Join: %s",Name);
- SendClientMessageToAll(0xFF7800FF,join);
- TogglePlayerControllable(playerid,false);// Freezing the player until Event start
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
- SetPlayerPos(playerid, 2193.3101,-1141.7870,1029.7969);
- SetPlayerInterior(playerid, 5);
- ResetPlayerWeapons(playerid);
- SetPlayerTeam(playerid, NO_TEAM);
- GivePlayerWeapon(playerid,24,44);
- GivePlayerWeapon(playerid,27,44);
- GivePlayerWeapon(playerid,31,200);
- GivePlayerWeapon(playerid,29,150);
- SetPlayerHealth(playerid, 100);
- SetPlayerColor(playerid,0xFF6600FF);
- new skinsLastManStading[3] ={
- 84,
- 83,
- 82,
- };
- SetPlayerSkin(playerid, skinsLastManStading[random(3)]);
- return 1;
- }
- //----------------------------------------------------------------------
- else
- {
- SendClientMessage(playerid, COLOR_RED, "There's no Last Man Standing taking place right now.");
- return 1;
- }
- }
- }
- public EndCuf(playerid)
- {
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
- return 1;
- }
- CMD:endevent(playerid, params[])
- {
- CageFight = 0;
- CurrentPos = 0;
- CurrentPosOn = 0;
- CageFightOn = 0;
- NumCageFighters = 0;
- NumCurrentFighters = 0;
- ResetEventSelectedWeps();
- for(new i = 0; i < GetMaxPlayers(); i++)
- {
- PlayerAtEvent[i] = 0;
- }
- return 1;
- }
- stock pName(playerid)
- {
- new Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof(Name));
- return Name;
- }
- public OnGameModeInit()
- {
- ERNING = TextDrawCreate(250, 171, "EARNINGS ~w~$2000");
- TextDrawFont(ERNING , 2);
- TextDrawLetterSize(ERNING , 0.4, 2.8);
- TextDrawColor(ERNING , 0xA66A00FF);
- TextDrawSetOutline(ERNING , 1);
- TextDrawSetProportional(ERNING , 1);
- TextDrawSetShadow(ERNING , 1);
- //////////////////////////////
- weapon = TextDrawCreate(4.000000,435.000000," GETTING WEAPONS...");
- TextDrawFont(weapon,2);
- TextDrawColor(weapon,0xA66A00FF);
- TextDrawLetterSize(weapon , 0.5, 1.4);
- TextDrawSetOutline(weapon,1);
- TextDrawSetShadow(weapon,1);
- TextDrawSetProportional(weapon,1);
- TextDrawBackgroundColor(weapon,0x000000ff);
- return 1;
- }
- public ExitERNING(playerid)
- {
- TextDrawHideForPlayer(playerid,ERNING);
- return 1;
- }
- public EndGet(playerid)
- {
- TextDrawHideForPlayer(playerid,weapon);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement