Author Topic: Gun game system  (Read 3250 times)

0 Members and 1 Guest are viewing this topic.

Offline Willian_Luigi

  • Street Thug
  • *
  • Posts: 2
    • View Profile
Gun game system
« 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]
« Last Edit: October 06, 2013, 07:22:52 pm by Willian_Luigi »

Offline MatheuS

  • Made Man
  • ***
  • Posts: 207
  • Pawn And Squirrel Scripter
    • View Profile
    • Brazillian Community
Re: Gun game system
« Reply #1 on: October 06, 2013, 07:32:13 pm »
Now yes this best  ;)