Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined KREDITAI
- GUN SHOP SYSTEM 1.0
- Created by Alexander 'SanCio' P.
- All right reserved (C) 2014
- #endif
- #include <a_samp>
- new
- gPickup,
- gExit,
- gBuy,
- selectedGun [ MAX_PLAYERS ] = 0,
- string [ 190 ]
- ;
- new guns [ ] [ ] = {
- /* weaponID , price , ammo , gunName */
- { 22 , 200 , 50 , "Colt 45"} ,
- { 23 , 300 , 50 , "Silenced Colt 45"} ,
- { 24 , 400 , 50 , "Desert Deagle" } ,
- { 25 , 500 , 100 , "Shotgun" }
- };
- public OnGameModeInit ( ) {
- DisableInteriorEnterExits ( ) ;
- printf ( "Gun shop system loaded.." ) ;
- gPickup = CreatePickup ( 1318 , 2 , 106.4843,-66.7309,1.5415 ) ;
- gExit = CreatePickup ( 1318 , 2 , 316.3683,-170.2960,999.5938 ) ;
- gBuy = CreatePickup ( 1274 , 2 , 311.9194,-166.1413,999.6010 ) ;
- Create3DTextLabel ( "{ffffff}Ginklų parduotuvė" , 0xFFFFFF , 106.4843,-66.7309,1.5415, 30 , 0 ) ;
- Create3DTextLabel ( "{ffffff}Ginklų pirkimas" , 0xFFFFFF , 311.9194,-166.1413,999.6010, 30 , 0 ) ;
- return 1;
- }
- public OnPlayerSpawn ( playerid ) {
- SetPlayerPos ( playerid , 101.7492,-72.6012,1.3600 ) ;
- GivePlayerMoney ( playerid , 10000 ) ;
- return 1;
- }
- public OnPlayerPickUpPickup ( playerid , pickupid ) {
- if ( pickupid == gPickup ) {
- SetPlayerPos ( playerid , 316.524993,-167.706985,999.593750 ) ;
- SetPlayerInterior ( playerid , 6 ) ;
- GameTextForPlayer ( playerid , "Ginklu parduotuve" , 3000 , 1 ) ;
- return 1;
- }
- if ( pickupid == gExit ) {
- SetPlayerPos ( playerid , 101.4843 , -66.7309 , 1.5415 ) ;
- SetPlayerInterior ( playerid , 0 ) ;
- return 1;
- }
- if ( pickupid == gBuy ) {
- format ( string , sizeof ( string ) ,
- "\
- \t{ffffff}Ginklas: {ff0000}%s\n\
- \t{ffffff}Ginklo kaina: {ff0000}%d$\n\
- \t{ffffff}Ginklo kulkų: {ff0000}%dvnt.\n\n\
- {ffffff}Pirkti ginklą\n\
- {ffffff}Kitas ginklas" ,
- guns [ selectedGun [ playerid ] ] [ 3 ] , guns [ selectedGun [ playerid ] ] [ 1 ] , guns [ selectedGun [ playerid ] ] [ 2 ]
- );
- ShowPlayerDialog ( playerid , 1 , DIALOG_STYLE_LIST , "{ffffff}Ginklo pirkimas" , string , "Rinktis" , "Išeiti" ) ;
- return 1;
- }
- return 1;
- }
- public OnDialogResponse ( playerid , dialogid , response , listitem , inputtext [ ] ) {
- switch ( dialogid ) {
- case 1: {
- if ( response ) {
- switch ( listitem ) {
- case 3: { // pirkimas
- if ( GetPlayerMoney ( playerid ) < guns [ selectedGun [ playerid ] ] [ 2 ] ) return SendClientMessage ( playerid , -1 , "Neturite pinigų" ) ;
- GivePlayerWeapon ( playerid , guns [ selectedGun [ playerid ] ] [ 0 ] , guns [ selectedGun [ playerid ] ] [ 2 ] );
- GivePlayerMoney ( playerid , -guns [ selectedGun [ playerid ] ] [ 1 ] ) ;
- format ( string , sizeof ( string ) ,
- "Įsigyjote ginklą {ff0000}%s {ffffff}už {ff0000}%dLT. {ffffff}Su {ff0000}%dvnt.{ffffff} kulkų." ,
- guns [ selectedGun [ playerid ] ] [ 3 ] , guns [ selectedGun [ playerid ] ] [ 1 ] , guns [ selectedGun [ playerid ] ] [ 2 ]
- );
- SendClientMessage ( playerid , -1 , string ) ;
- selectedGun [ playerid ] = 0;
- }
- case 4: {
- selectedGun [ playerid ] ++;
- format ( string , sizeof ( string ) ,
- "\
- \t{ffffff}Ginklas: {ff0000}%s\n\
- \t{ffffff}Ginklo kaina: {ff0000}%d$\n\
- \t{ffffff}Ginklo kulkų: {ff0000}%dvnt.\n\n\
- {ffffff}Pirkti ginklą\n\
- {ffffff}Kitas ginklas" ,
- guns [ selectedGun [ playerid ] ] [ 3 ] , guns [ selectedGun [ playerid ] ] [ 1 ] , guns [ selectedGun [ playerid ] ] [ 2 ]
- );
- ShowPlayerDialog ( playerid , 1 , DIALOG_STYLE_LIST , "{ffffff}Ginklo pirkimas" , string , "Rinktis" , "Išeiti" ) ;
- }
- }
- }
- else {
- SendClientMessage ( playerid , -1 , "Viso geriausio jums!" ) ;
- selectedGun [ playerid ] = 0;
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement