Vice City Multiplayer

VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started by: Willian_Luigi on October 06, 2013, 03:24:46 am

Title: Gun game system
Post by: Willian_Luigi on October 06, 2013, 03:24:46 am
[pawn]new gPlayerWeapon [ MAX_PLAYERS ] ,
   gPm [ MAX_PLAYERS ] ,
   gStartGame [ MAX_PLAYERS ] ;

public OnPlayerDeath(playerid, killerid, reason)
{
   if (killerid != INVALID_PLAYER_ID)
   {
      if (gPlayerWeapon [ killerid ] == 10) //Killer progress
      {
         setWinner(killerid);
         return 1;
      }
      gPlayerWeapon [ killerid ] ++ ;
      setWeaponUpgrade(killerid, gPlayerWeapon [ killerid ]);
   }
}

public OnPlayerDeath(playerid, killerid, reason)
{
   gPm [ playerid ] = 1;
}

public OnPlayerSpawn(playerid)
{
   if (gStartGame[playerid])
   {
      setInitDefault(playerid);
      gStartGame[playerid] = 0;
   }
   if (gPm [ playerid ])
   {
      SetPlayerPos(playerid, x, y, z); //x, y, z = hospital position
      gPm [ playerid ] = 0;
   }
}

public OnPlayerConnect(playerid)
{
    gStartGame[playerid] = 1;
}

stock setWinner(pl)
{
   //pl = player who has earned the event.
   //here you put your codes to give money, or greetings messages...
}

stock setInitDefault(pl)
{
   SetPlayerPos(pl, x, y, z); //start position
   setWeaponUpgrade(pl, 0); //call the function to upgrade the player lvl 0.
}

stock setWeaponUpgrade(pl, wp)
{
   switch(wp)
   {
      case 1: GivePlayerWeapon(pl, 22, 9999); // Change the weapons id
      case 2: GivePlayerWeapon(pl, 25, 9999);
      case 3: GivePlayerWeapon(pl, 28, 9999);
      case 4: GivePlayerWeapon(pl, 29, 9999);
      case 5: GivePlayerWeapon(pl, 32, 9999);
      case 6: GivePlayerWeapon(pl, 30, 9999);
      case 7: GivePlayerWeapon(pl, 31, 9999);
      case 8: GivePlayerWeapon(pl, 34, 9999);
      case 9: GivePlayerWeapon(pl, 35, 9999);
      default: GivePlayerWeapon(pl, 4, 1);
   }
}[/pawn]
Title: Re: Gun game system
Post by: MatheuS on October 06, 2013, 07:32:13 pm
Now yes this best  ;)