Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new Float:RandomLMSSpawns[][] =
- {
- {-2433.3643,1529.3511,31.8594,308.0968},
- {-2393.2271,1538.8435,31.8594,113.8518},
- {-2372.3481,1560.5588,31.8594,126.6751},
- {-2372.1155,1530.4330,31.8594,85.0248},
- {-2408.5549,1544.2440,31.8594,288.3565},
- {-2425.8440,1560.9408,31.8594,254.8529}
- };
- new CountLMSPlayers;
- new inLMS[MAX_PLAYERS];
- new LMSinProgress;
- forward StartLast();
- public OnPlayerConnect(playerid)
- {
- inLMS[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(inLMS[playerid] == 1)
- {
- inLMS[playerid] = 0;
- isInDM[playerid] = 0;
- CountLMSPlayers--;
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid,pname,sizeof(pname));
- new string[256];
- format(string,sizeof(string),"{03F2FF}[LMS]: {FFFFFF}%s has left the Last Man Standing! {FF0000}(Disconnected)",pname);
- SendClientMessageToAll(-1,string);
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(LMSinProgress == 1)
- {
- if(CountLMSPlayers > 0)
- {
- if(inLMS[playerid] == 1)
- {
- CountLMSPlayers--;
- new name[MAX_PLAYER_NAME];
- new string[256];
- GetPlayerName(playerid,name,sizeof(name));
- format(string,sizeof(string),"{03F2FF}[LMS]: {FFFFFF}%s has died!",name);
- SendClientMessageToAll(-1,string);
- inLMS[playerid] = 0;
- return 1;
- }
- return 1;
- }
- return 1;
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/resetevent", cmdtext, true, 10) == 0)
- {
- if(IsPlayerAdmin(playerid))
- {
- LMSinProgress = 0;
- GameTextForAll("~r~EVENTS ARE RESET!", 5000, 3);
- }
- return 1;
- }
- if (strcmp("/lms", cmdtext, true, 10) == 0)
- {
- if(inLMS[playerid] == 1)
- {
- GameTextForPlayer(playerid,"~r~YOU ARE IN ~n~LAST MAN STANDING!",3000,3);
- return 1;
- }
- if(LMSinProgress == 1)
- {
- GameTextForPlayer(playerid,"~r~LAST MAN STANDING ~n~ALREADY STARTED!",3000,3);
- return 1;
- }
- if(CountLMSPlayers == 6)
- {
- GameTextForPlayer(playerid,"~r~LAST MAN STANDING ~n~FULL!",3000,3);
- return 1;
- }
- inLMS[playerid] = 1;
- isInDM[playerid] = 1;
- SetPlayerVirtualWorld(playerid,10);
- ResetPlayerWeapons(playerid);
- SetPlayerHealth(playerid,100);
- GivePlayerWeapon(playerid,24,1000000);
- GivePlayerWeapon(playerid,27,1000000);
- new rand = random(sizeof(RandomLMSSpawns));
- SetPlayerPos(playerid,RandomLMSSpawns[rand][0],RandomLMSSpawns[rand][1],RandomLMSSpawns[rand][2]);
- SetPlayerFacingAngle(playerid,RandomLMSSpawns[rand][3]);
- TogglePlayerControllable(playerid,0);
- GameTextForPlayer(playerid,"~g~LAST MAN STANDING ~n~STARTING SOON!",3000,3);
- CountLMSPlayers++;
- new pname[MAX_PLAYER_NAME];
- GetPlayerName(playerid,pname,sizeof(pname));
- new string[256];
- format(string,sizeof(string),"{03F2FF}[LMS]: {FFFFFF}%s has joined the Last Man Standing!",pname);
- SendClientMessageToAll(-1,string);
- if(CountLMSPlayers == 1)
- {
- SetTimer("StartLast",15000,false);
- for(new i=0; i < MAX_PLAYERS; i++) return PlayerPlaySound(i, 1056, 0.0, 0.0, 10.0);
- return 1;
- }
- return 1;
- }
- return 1;
- }
- public StartLast()
- {
- for(new i=0; i < MAX_PLAYERS; i++)
- {
- if(inLMS[i] == 1)
- {
- if(CountLMSPlayers >= 2)
- {
- TogglePlayerControllable(i,1);
- GameTextForPlayer(i,"~g~GO GO GO !!!",3000,3);
- LMSinProgress = 1;
- }
- else if(CountLMSPlayers < 2)
- {
- inLMS[i] = 0;
- CountLMSPlayers = 0;
- LMSinProgress = 0;
- SetPlayerVirtualWorld(i,0);
- TogglePlayerControllable(i,1);
- SendClientMessageToAll(-1,"{03F2FF}[LMS]: {FFFFFF}No one joined Last Man Standing, so its canceled!");
- }
- }
- }
- }
- public OnPlayerUpdate(playerid)
- {
- for(new i=0; i < MAX_PLAYERS; i++)
- {
- if(inLMS[i] == 1)
- {
- if(LMSinProgress == 1)
- {
- if(CountLMSPlayers == 1)
- {
- inLMS[i] = 0;
- CountLMSPlayers = 0;
- LMSinProgress = 0;
- new name[MAX_PLAYER_NAME];
- GetPlayerName(i,name,sizeof(name));
- new string[256];
- format(string,sizeof(string),"{03F2FF}[LMS]: {FFFFFF}Last Man Standing finished! Winner is {FF0000}%s! {FFFFFF}He won 30 000$ and 20 Score!",name);
- SendClientMessageToAll(-1,string);
- GiveMoney(i,30000);
- SetPlayerScore(i,GetPlayerScore(i)+20);
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment