Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started by: mrockxkingbutt on December 09, 2013, 12:05:17 pm

Title: Anti-Spawn Killing [ Full By me ] [ Tested ]
Post by: mrockxkingbutt on December 09, 2013, 12:05:17 pm
On The Top

Code: [Select]
new AntiSpawn[MAX_PLAYERS];
On The Spawn

Code: [Select]
AntiSpawn[playerid] = 1;
SetTimer("SpawnKilling", 5000, 0);
GameTextForPlayer(playerid," Spawn Protection ");

On OnPlayerDeath

Code: [Select]
if (AntiSpawn[playerid] == 1) {
SetPlayerHealth(killerid, 0);
SendClientMessage(killerid, COLOR_RED, " [Auto-Kill] Reason SpawnKilling ");
}

Now The Public

Code: [Select]
public SpawnKilling() {
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i)) {
       if(AntiSpawn[i] == 1) {
           SendClientMessage(i,COLOR_YELLOW,"Spawn Protection Offline!!");
AntiSpawn[i] = 0;
      }
  }
  }
return 1;
}

SaW A BuGG RePoRt It NoW

Credits All By Me

Please Rate It!
Out Of 10





Title: Re: Anti-Spawn Killing [ Full By me ] [ Tested ]
Post by: Doom on December 09, 2013, 02:28:08 pm
Still fail because if a player spawns he gets AntiSpawn = 1 and timer starts then after 2 secs another player spawns and gets AntiSpawn = 1 so after the Spawn Killing public runs it gets all the players with AntiSpawn == 1 and sets it to 0 which results the 2nd player get AntiSpawn-kill protection get turned off faster.
Title: Re: Anti-Spawn Killing [ Full By me ] [ Tested ]
Post by: NeskWriter on December 09, 2013, 08:02:49 pm
As a result, you're getting a code that doesnt work like it definitely should, increased use of CPU memory and laggs. But most of those who build their GUPS-based gamemodes using these codes don't get an average count of 3 - 5 players online. And yeah, don't write every word with a big letter, it aboves grammar and annoys, as I guess, many of users, including me, although my opinion isn't that important.