Advertisement
sancio

GSHOP SYSTEM 1.0

Jun 11th, 2014
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.75 KB | None | 0 0
  1. #if defined KREDITAI
  2.  
  3.  
  4.  
  5.                     GUN SHOP SYSTEM 1.0
  6.                     Created by Alexander 'SanCio' P.
  7.                     All right reserved (C) 2014
  8.  
  9.  
  10. #endif
  11. #include <a_samp>
  12. new
  13.     gPickup,
  14.     gExit,
  15.     gBuy,
  16.     selectedGun     [ MAX_PLAYERS ] = 0,
  17.     string          [ 190 ]
  18. ;
  19. new     guns    [  ] [  ] = {
  20. /*      weaponID  , price , ammo    , gunName   */
  21.     { 22 , 200 , 50 , "Colt 45"} ,
  22.     { 23 , 300 , 50 , "Silenced Colt 45"} ,
  23.     { 24 , 400 , 50 , "Desert Deagle" } ,
  24.     { 25 , 500 , 100 , "Shotgun" }
  25. };
  26. public OnGameModeInit ( ) {
  27.     DisableInteriorEnterExits ( ) ;
  28.     printf ( "Gun shop system loaded.." ) ;
  29.     gPickup     = CreatePickup ( 1318 , 2 , 106.4843,-66.7309,1.5415 ) ;
  30.     gExit       = CreatePickup ( 1318 , 2 , 316.3683,-170.2960,999.5938 ) ;
  31.     gBuy        = CreatePickup ( 1274 , 2 , 311.9194,-166.1413,999.6010 ) ;
  32.     Create3DTextLabel ( "{ffffff}Ginklų parduotuvė" , 0xFFFFFF , 106.4843,-66.7309,1.5415, 30 , 0  ) ;
  33.     Create3DTextLabel ( "{ffffff}Ginklų pirkimas" , 0xFFFFFF , 311.9194,-166.1413,999.6010, 30 , 0  ) ;
  34.     return 1;
  35. }
  36. public OnPlayerSpawn ( playerid ) {
  37.     SetPlayerPos ( playerid , 101.7492,-72.6012,1.3600 ) ;
  38.     GivePlayerMoney ( playerid , 10000 ) ;
  39.     return 1;
  40. }
  41. public OnPlayerPickUpPickup ( playerid , pickupid ) {
  42.     if ( pickupid == gPickup ) {
  43.         SetPlayerPos ( playerid , 316.524993,-167.706985,999.593750 ) ;
  44.         SetPlayerInterior ( playerid , 6 ) ;
  45.         GameTextForPlayer ( playerid , "Ginklu parduotuve" , 3000 , 1 ) ;
  46.         return 1;
  47.     }
  48.     if ( pickupid == gExit ) {
  49.         SetPlayerPos ( playerid , 101.4843 , -66.7309 , 1.5415 ) ;
  50.         SetPlayerInterior ( playerid , 0 ) ;
  51.         return 1;
  52.     }
  53.     if ( pickupid == gBuy ) {
  54.         format ( string , sizeof ( string ) ,
  55.             "\
  56.             \t{ffffff}Ginklas: {ff0000}%s\n\
  57.             \t{ffffff}Ginklo kaina: {ff0000}%d$\n\
  58.             \t{ffffff}Ginklo kulkų: {ff0000}%dvnt.\n\n\
  59.             {ffffff}Pirkti ginklą\n\
  60.             {ffffff}Kitas ginklas" ,
  61.             guns [ selectedGun [ playerid ] ] [ 3 ] , guns [ selectedGun [ playerid ] ] [ 1 ] ,  guns [ selectedGun [ playerid ] ] [ 2 ]
  62.         );
  63.         ShowPlayerDialog ( playerid , 1 , DIALOG_STYLE_LIST , "{ffffff}Ginklo pirkimas" , string , "Rinktis" , "Išeiti" ) ;
  64.         return 1;
  65.     }
  66.     return 1;
  67. }
  68. public OnDialogResponse ( playerid , dialogid , response , listitem , inputtext [ ] ) {
  69.     switch ( dialogid ) {
  70.         case 1: {
  71.             if ( response ) {
  72.                 switch ( listitem ) {
  73.                     case 3: { // pirkimas
  74.                         if ( GetPlayerMoney ( playerid ) < guns [ selectedGun [ playerid ] ] [ 2 ] ) return SendClientMessage ( playerid , -1 , "Neturite pinigų" ) ;
  75.                         GivePlayerWeapon ( playerid , guns [ selectedGun [ playerid ] ] [ 0 ] , guns [ selectedGun [ playerid ] ] [ 2 ] );
  76.                         GivePlayerMoney  ( playerid , -guns [ selectedGun [ playerid ] ] [ 1 ] ) ;
  77.                         format ( string , sizeof ( string ) ,
  78.                             "Įsigyjote ginklą {ff0000}%s {ffffff}už {ff0000}%dLT. {ffffff}Su {ff0000}%dvnt.{ffffff} kulkų." ,
  79.                             guns [ selectedGun [ playerid ] ] [ 3 ] , guns [ selectedGun [ playerid ] ] [ 1 ] , guns [ selectedGun [ playerid ] ] [ 2 ]
  80.                         );
  81.                         SendClientMessage ( playerid , -1 , string ) ;
  82.                         selectedGun [ playerid ] = 0;
  83.                     }
  84.                     case 4: {
  85.                         selectedGun [ playerid ] ++;
  86.                         format ( string , sizeof ( string ) ,
  87.                             "\
  88.                             \t{ffffff}Ginklas: {ff0000}%s\n\
  89.                             \t{ffffff}Ginklo kaina: {ff0000}%d$\n\
  90.                             \t{ffffff}Ginklo kulkų: {ff0000}%dvnt.\n\n\
  91.                             {ffffff}Pirkti ginklą\n\
  92.                             {ffffff}Kitas ginklas" ,
  93.                             guns [ selectedGun [ playerid ] ] [ 3 ] , guns [ selectedGun [ playerid ] ] [ 1 ] ,  guns [ selectedGun [ playerid ] ] [ 2 ]
  94.                         );
  95.                         ShowPlayerDialog ( playerid , 1 , DIALOG_STYLE_LIST , "{ffffff}Ginklo pirkimas" , string , "Rinktis" , "Išeiti" ) ;                       
  96.                     }
  97.                 }
  98.             }
  99.             else {
  100.                 SendClientMessage ( playerid , -1 , "Viso geriausio jums!" ) ;
  101.                 selectedGun [ playerid ] = 0;
  102.             }
  103.         }
  104.     }
  105.     return 1;
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement