Jump to content

CobbTheWarriorsRPG

Members
  • Posts

    111
  • Joined

  • Last visited

Everything posted by CobbTheWarriorsRPG

  1. It give to me all the weapons no only 1,I want to the scriot guive me 1 random weapon! thanks for the help and how can i make it for give me random items? local ItemAzar = { "Pasta Can", "Beans Can", "Burger", "Pizza", "Soda Bottle", "Empty Water Bottle", "Empty Soda Cans", "Scruffy Burgers", "Milk", "Raw Meat", "Cooked Meat" } local M4Pickup = createPickup(-2812.4370,-849.909,23.22,2,31,300,0) function GiveDayZItem(player) setElementData(player,ItemAzar[ math.random(1, #ItemAzar)], 1) end addEventHandler("onPickupHit", M4Pickup, GiveDayZItem) it gives to me the random random things?
  2. Than You Men! And if i want to the player get a random item the code must be like this? local M4Pickup = createPickup(-2812.4370,-849.909,23.22,2,31,300,0) local 1 = "M4" local 0 = "GPS" local 2 = "Toolbox" local 3 = "Map" function GiveDayZItem(player) setElementData(player, math.random(0, 3), 1) end addEventHandler("onPickupHit", M4Pickup, GiveDayZItem)
  3. Hello all,There is my problem i want to create a script who when somebody hit the pickup get somo Objects but... I hit the Pickup and nothing happened :c,Can you help me please? a lot of thanks --server.lua local M4Pickup = createPickup(-2812.4370,-849.909,23.22,2,31,300,0) function GiveDayZItem() setElementData(source, "Coyote Backpack", 1) setElementData(source, "Map", 1) setElementData(source, "GPS", 1) setElementData(source, "Toolbox", 1) end addEvent( "GiveDayZItem", true ) addEventHandler( "onPickupHit", M4Pickup, GiveDayZItem ) Basicly When you hit the pickup you will get in your inventory(Defined in the main resource) these things I apreciate all the help. sorry for my bad english,Thanks! --client.lua function GiveDayZ() triggerServerEvent ( "GiveDayZItem", getLocalPlayer() ) end addEventHandler("onPickupHit", GiveDayZ )
  4. Its Say The program cant start MSVCP110.dll its not registered or something like that
  5. Hello To all i have a problem,When i try to connect to a server it says 'Conection Timed Out' And i cant join in the server,The same thing happened whit all the servers,I cant joint to any server,Can somebody help me?
  6. So It should be like this server: function drug( ) if(guiRadioButtonGetSelected(rdoCannabis))then setPlayerGravity ( localPlayer, 3.0 ) end end addEvent( "onClick", true ) addEventHandler("onClick", root , drug) client.lua function triggerToServer ( ) triggerServerEvent ( "onClick", getLocalPlayer() ) end addEventHandler("onClientGUIClick", btnTakeHit , triggerToServer, false)
  7. Hello I am doing a Drug panel,But when you click the buton "Take a hit" doesnt happened see here: function takeAHit( button ) if(guiRadioButtonGetSelected(rdoCannabis))then setPlayerGravity ( localPlayer, 3.0 ) end end addEventHandler ( "onClientGUIClick", btnTakeHit , takeAHit, false ) And say this on debugscript WARNING: drug/client.lua:92: Bad argument @'AddEventHandler' [Expected element at argument 2,Got nil] Whats is the problem , Can somebody help me?
  8. hahahaha sheet its 448 ! A lot of thanks Mr.Prestege
  9. Thanks a lot,But the vehicle doesnt spawn
  10. So the serverside must be like this server.lua function createvehicle() if (source==GUIEditor_Button[1]) then local x,y,z = getElementPosition(localPlayer) veh = createVehicle(449, x,y,z) end end addEvent( "onClick", true ) addEventHandler("onClientGUIClick", root , vehicle) client.lua function createVehicle () triggerServerEvent ( "onClick", getLocalPlayer() ) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , createVehicle, false)
  11. All thank you,but i have a question,in the vehicle on client side its a fake vehicle,How can i make the server side? I am learning but is a chaos trying to learn whit my bad english,Can you explain me? thanks (Y)
  12. hello i am making this script,When you click on the button you get a vehicle but they doesnt work see the code client.lua function vehicle(thePlayer) local x,y,z = getElementPosition(thePlayer) veh = createVehicle(449, x,y,z) end addEventHandler("onClientGUIClick", GUIEditor_Button[1] , vehicle, false) hope you can help me
  13. Not exactly,I only want to change team for gangs,And make a remote call for the resource for make it works
  14. Hello, I wanted to change a resource called turf, but errors occurred meant that instead of having getPlayerTeam getPlayerGang but this would not work says getPlayerGang is a nil value, here are the original and modified code Original: server side: local pArea = createRadarArea( 2130, 630, 200, 100, 255, 255, 255, 125 ) local pArea2 = createRadarArea( 2488.8793945313, 680.78289794922, 250, 130, 255, 255, 255, 125 ) local pCuboid = createColCuboid( 2133.1950683594, 633.66455078125, 10, 197.5, 92, 30 ) local pCuboid2 = createColCuboid( 2486.5935058594, 678.20172119141, 9.5689830780029, 245, 133, 30 ) local pArea3 = createRadarArea( 1858, 623, 140, 165, 255, 255, 255, 125 ) local pCuboid3 = createColCuboid( 1856.2864990234, 627.07629394531, 9, 138.25, 152.75, 30 ) local pArea4 = createRadarArea( 1577, 663, 180, 130, 255, 255, 255, 125 ) local pCuboid4 = createColCuboid( 1576.8956298828, 662.84362792969, 9.671875, 181, 120.5, 30 ) local pArea5 = createRadarArea( 2778, 834, 110, 190, 255, 255, 255, 125 ) local pCuboid5 = createColCuboid( 2777.4248046875, 833.88018798828, 9.6484375, 113.5, 188, 30 ) addEventHandler("onResourceStart", resourceRoot, function() outputDebugString("|~| Turf system by manve1 |~| Has been turned on! |~| This system was downloaded from MTA Community. |~|", 3, 0, 255, 0) end ) --[[addEventHandler("onResourceStop", resourceRoot, function() outputDebugString("|~| Turf system by manve1 |~| Has been turned off! |~| This system was downloaded from MTA Community. |~|", 3, 0, 255, 0) saveS = xmlLoadFile( 'file_saves.xml' ) local save_info = xmlFindChild(saveS, 'turf', 0) xmlNodeSetAttribute( save_info, 'saved', 'nothing new' ) end )]] addEventHandler( 'onColShapeHit', pCuboid, function( player ) if (getPlayerTeam( player )) then local pTeam = getPlayerTeam( player ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea ) if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then triggerClientEvent(player, 'friendly', player) else setRadarAreaFlashing( pArea, true ) triggerClientEvent(player, 'time', player) triggerClientEvent(player, 'countdown', player) pArea1Timer = setTimer( function() setRadarAreaColor (pArea, iR, iG, iB, 100); givePlayerMoney( player, 4000 ); outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", player, 0, 255, 0, true ); setRadarAreaFlashing( pArea, false ) end, 6000, 1 ) end else triggerClientEvent(player, 'group', player) end end ) addEventHandler( 'onColShapeLeave', root, function( player ) if( source == pCuboid ) then setRadarAreaFlashing( pArea, false ) triggerClientEvent(player, 'time2', player) triggerClientEvent(player, 'friendly2', player) if isTimer( pArea1Timer ) then killTimer( pArea1Timer ) end end end ) ----------------------------- addEventHandler( 'onColShapeHit', root, function( p ) if (getPlayerTeam( p )) then if( source == pCuboid2 ) then local pTeam = getPlayerTeam( player ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea2 ) if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then triggerClientEvent(player, 'friendly', player) else setRadarAreaFlashing( pArea2, true ) triggerClientEvent(player, 'time', player) pArea2Timer = setTimer( function() setRadarAreaColor (pArea2, iR2, iG2, iB2, 100); givePlayerMoney( p, 4000 ); outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); setRadarAreaFlashing( pArea2, false ) end, 600000, 1 ) end end else triggerClientEvent(player, 'group', player) end end ) addEventHandler( 'onColShapeLeave', root, function( p ) if( source == pCuboid2 ) then setRadarAreaFlashing( pArea2, false ) triggerClientEvent(player, 'time2', player) triggerClientEvent(player, 'friendly2', player) if isTimer( pArea2Timer ) then killTimer( pArea2Timer ) end end end ) ------------------------------------ addEventHandler( 'onColShapeHit', root, function( p ) if (getPlayerTeam( p )) then if( source == pCuboid3 ) then local pTeam = getPlayerTeam( player ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea3 ) if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then triggerClientEvent(player, 'friendly', player) else setRadarAreaFlashing( pArea3, true ) triggerClientEvent(player, 'time', player) pArea3Timer = setTimer( function() setRadarAreaColor (pArea3, iR2, iG2, iB2, 100); givePlayerMoney( p, 4000 ); outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); setRadarAreaFlashing( pArea3, false ) end, 600000, 1 ) end end else triggerClientEvent(player, 'group', player) end end ) addEventHandler( 'onColShapeLeave', root, function( p ) if( source == pCuboid3 ) then setRadarAreaFlashing( pArea3, false ) triggerClientEvent(player, 'time2', player) triggerClientEvent(player, 'friendly2', player) if isTimer( pArea3Timer ) then killTimer( pArea3Timer ) end end end ) ------------------------------------- addEventHandler( 'onColShapeHit', root, function( p ) if (getPlayerTeam( p )) then if( source == pCuboid4 ) then local pTeam = getPlayerTeam( player ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea4 ) if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then triggerClientEvent(player, 'friendly', player) else setRadarAreaFlashing( pArea4, true ) triggerClientEvent(player, 'time', player) pArea4Timer = setTimer( function() setRadarAreaColor (pArea4, iR2, iG2, iB2, 100); givePlayerMoney( p, 4000 ); outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); setRadarAreaFlashing( pArea4, false ) end, 600000, 1 ) end end else triggerClientEvent(player, 'group', player) end end ) addEventHandler( 'onColShapeLeave', root, function( p ) if( source == pCuboid4 ) then setRadarAreaFlashing( pArea4, false ) triggerClientEvent(player, 'time2', player) triggerClientEvent(player, 'friendly2', player) if isTimer( pArea3Timer ) then killTimer( pArea3Timer ) end end end ) ----------------------------------- addEventHandler( 'onColShapeHit', root, function( p ) if (getPlayerTeam( p )) then if( source == pCuboid5 ) then local pTeam = getPlayerTeam( player ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea5 ) if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then triggerClientEvent(player, 'friendly', player) else setRadarAreaFlashing( pArea5, true ) triggerClientEvent(player, 'time', player) pArea5Timer = setTimer( function() setRadarAreaColor (pArea5, iR2, iG2, iB2, 100); givePlayerMoney( p, 4000 ); outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); setRadarAreaFlashing( pArea5, false ) end, 600000, 1 ) end end else triggerClientEvent(player, 'group', player) end end ) addEventHandler( 'onColShapeLeave', root, function( p ) if( source == pCuboid5 ) then setRadarAreaFlashing( pArea5, false ) triggerClientEvent(player, 'time2', player) triggerClientEvent(player, 'friendly2', player) if isTimer( pArea5Timer ) then killTimer( pArea5Timer ) end end end ) modified: Server Side: exports [ "gang_system" ]:getPlayerGang ( player ) local pArea = createRadarArea( 2130, 630, 200, 100, 255, 255, 255, 125 ) local pArea2 = createRadarArea( 2488.8793945313, 680.78289794922, 250, 130, 255, 255, 255, 125 ) local pCuboid = createColCuboid( 2133.1950683594, 633.66455078125, 10, 197.5, 92, 30 ) local pCuboid2 = createColCuboid( 2486.5935058594, 678.20172119141, 9.5689830780029, 245, 133, 30 ) local pArea3 = createRadarArea( 1858, 623, 140, 165, 255, 255, 255, 125 ) local pCuboid3 = createColCuboid( 1856.2864990234, 627.07629394531, 9, 138.25, 152.75, 30 ) local pArea4 = createRadarArea( 1577, 663, 180, 130, 255, 255, 255, 125 ) local pCuboid4 = createColCuboid( 1576.8956298828, 662.84362792969, 9.671875, 181, 120.5, 30 ) local pArea5 = createRadarArea( 2778, 834, 110, 190, 255, 255, 255, 125 ) local pCuboid5 = createColCuboid( 2777.4248046875, 833.88018798828, 9.6484375, 113.5, 188, 30 ) addEventHandler("onResourceStart", resourceRoot, function() outputDebugString("|~| Turf system by manve1 |~| Has been turned on! |~| This system was downloaded from MTA Community. |~|", 3, 0, 255, 0) end ) --[[addEventHandler("onResourceStop", resourceRoot, function() outputDebugString("|~| Turf system by manve1 |~| Has been turned off! |~| This system was downloaded from MTA Community. |~|", 3, 0, 255, 0) saveS = xmlLoadFile( 'file_saves.xml' ) local save_info = xmlFindChild(saveS, 'turf', 0) xmlNodeSetAttribute( save_info, 'saved', 'nothing new' ) end )]] addEventHandler( 'onColShapeHit', pCuboid, function( player ) if (getPlayerGang( player )) then local pTeam = getPlayerGang( player ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea ) if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then triggerClientEvent(player, 'friendly', player) else setRadarAreaFlashing( pArea, true ) triggerClientEvent(player, 'time', player) triggerClientEvent(player, 'countdown', player) pArea1Timer = setTimer( function() setRadarAreaColor (pArea, iR, iG, iB, 100); givePlayerMoney( player, 4000 ); outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", player, 0, 255, 0, true ); setRadarAreaFlashing( pArea, false ) end, 6000, 1 ) end else triggerClientEvent(player, 'group', player) end end ) addEventHandler( 'onColShapeLeave', root, function( player ) if( source == pCuboid ) then setRadarAreaFlashing( pArea, false ) triggerClientEvent(player, 'time2', player) triggerClientEvent(player, 'friendly2', player) if isTimer( pArea1Timer ) then killTimer( pArea1Timer ) end end end ) ----------------------------- addEventHandler( 'onColShapeHit', root, function( p ) if (getPlayerGang( p )) then if( source == pCuboid2 ) then local pTeam = getPlayerGang( player ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea2 ) if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then triggerClientEvent(player, 'friendly', player) else setRadarAreaFlashing( pArea2, true ) triggerClientEvent(player, 'time', player) pArea2Timer = setTimer( function() setRadarAreaColor (pArea2, iR2, iG2, iB2, 100); givePlayerMoney( p, 4000 ); outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); setRadarAreaFlashing( pArea2, false ) end, 600000, 1 ) end end else triggerClientEvent(player, 'group', player) end end ) addEventHandler( 'onColShapeLeave', root, function( p ) if( source == pCuboid2 ) then setRadarAreaFlashing( pArea2, false ) triggerClientEvent(player, 'time2', player) triggerClientEvent(player, 'friendly2', player) if isTimer( pArea2Timer ) then killTimer( pArea2Timer ) end end end ) ------------------------------------ addEventHandler( 'onColShapeHit', root, function( p ) if (getPlayerGang( p )) then if( source == pCuboid3 ) then local pTeam = getPlayerGang( player ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea3 ) if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then triggerClientEvent(player, 'friendly', player) else setRadarAreaFlashing( pArea3, true ) triggerClientEvent(player, 'time', player) pArea3Timer = setTimer( function() setRadarAreaColor (pArea3, iR2, iG2, iB2, 100); givePlayerMoney( p, 4000 ); outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); setRadarAreaFlashing( pArea3, false ) end, 600000, 1 ) end end else triggerClientEvent(player, 'group', player) end end ) addEventHandler( 'onColShapeLeave', root, function( p ) if( source == pCuboid3 ) then setRadarAreaFlashing( pArea3, false ) triggerClientEvent(player, 'time2', player) triggerClientEvent(player, 'friendly2', player) if isTimer( pArea3Timer ) then killTimer( pArea3Timer ) end end end ) ------------------------------------- addEventHandler( 'onColShapeHit', root, function( p ) if (getPlayerGang( p )) then if( source == pCuboid4 ) then local pTeam = getPlayerGang( player ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea4 ) if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then triggerClientEvent(player, 'friendly', player) else setRadarAreaFlashing( pArea4, true ) triggerClientEvent(player, 'time', player) pArea4Timer = setTimer( function() setRadarAreaColor (pArea4, iR2, iG2, iB2, 100); givePlayerMoney( p, 4000 ); outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); setRadarAreaFlashing( pArea4, false ) end, 600000, 1 ) end end else triggerClientEvent(player, 'group', player) end end ) addEventHandler( 'onColShapeLeave', root, function( p ) if( source == pCuboid4 ) then setRadarAreaFlashing( pArea4, false ) triggerClientEvent(player, 'time2', player) triggerClientEvent(player, 'friendly2', player) if isTimer( pArea3Timer ) then killTimer( pArea3Timer ) end end end ) ----------------------------------- addEventHandler( 'onColShapeHit', root, function( p ) if (getPlayerGang( p )) then if( source == pCuboid5 ) then local pTeam = getPlayerGang( player ) local iR, iG, iB = getTeamColor( pTeam ) local rR, gG, bB = getRadarAreaColor( pArea5 ) if ( iR == rR ) and ( iG == gG ) and ( iB == bB ) then triggerClientEvent(player, 'friendly', player) else setRadarAreaFlashing( pArea5, true ) triggerClientEvent(player, 'time', player) pArea5Timer = setTimer( function() setRadarAreaColor (pArea5, iR2, iG2, iB2, 100); givePlayerMoney( p, 4000 ); outputChatBox( "Congratulations, #FFFF00 you have taken the turf!", p, 0, 255, 0, true ); setRadarAreaFlashing( pArea5, false ) end, 600000, 1 ) end end else triggerClientEvent(player, 'group', player) end end ) addEventHandler( 'onColShapeLeave', root, function( p ) if( source == pCuboid5 ) then setRadarAreaFlashing( pArea5, false ) triggerClientEvent(player, 'time2', player) triggerClientEvent(player, 'friendly2', player) if isTimer( pArea5Timer ) then killTimer( pArea5Timer ) end end end ) I want to change the Teams For gang ,They are the resource gang_system of castillo https://community.multitheftauto.com/ind ... ls&id=1514
  15. I was thinking if i put it maybe it was the solution
  16. Im trying and trying to learn,Reading the wiki,Ask for help but this Wasted me local myMarker = createMarker(1882.3262939453, -1314.8422851563, 14.500373840332, 'cylinder', 2.0, 255, 0, 0, 150) function MarkerHit( hitElement, setElementPosition ) setElementPosition ( source, 0, 0, 0 ) end addEventHandler( "onMarkerHit", setElementPosition, MarkerHit ) How can i fix it for you get on it and teleport to you onto a x y z position
  17. Tranks a lot,But how can i put only you can use the addarmor command whit the space of 5 minutes? setTimer?
  18. So Castillo,The code must be function givePlayerArmor ( player, command ) local accountname = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user.".. accountname, aclGetGroup ( "vip" ) ) then setPlayerArmor ( player, 100 ) end end addCommandHandler ( "addarmor", givePlayerArmor )
  19. I make this script (Reading the wiki) for the VIP,When a user vip start this command they should be have a 100% armor but when i start the resource and i start the comand i dont have the armor,Whats is bad in the code? viparmor.lua function givePlayerArmor ( player, command ) local accountname = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user.".. accountname, aclGetGroup ( "vip" ) ) then setPlayerArmor ( player, 100 ) end addCommandHandler ( "addarmor", givePlayerArmor )
  20. Thanks castillo it works,And how can i make like i have a anim window,How can i do only the members VIP on the aclgroup can open it?
  21. Hello,Im trying to doing a resource who make it the group in ACL Get all The Weapon Stats to 1000 But this dont work,Someone can help me? it is the code function changeBodyStrength ( player, commandName ) local accountname = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user."..accountname,aclGetGroup("swat")) then ( setPlayerStat ( player, 73, 1000 ) ) addCommandHandler ( "vipstat", changeBodyStrength ) Im reading the wiki but i dont know
  22. Hello I saw this Script in the forum,The script are made by taalasmaa and SirniNamaz,but I want to add to the script functions like When you use the cannabis you lose 1 hit and you have low gravity for 3 mins And Sell drugs,Can somebody help to create a nice script? here is the code For Taalasmaa client.lua function trolo() x,y = guiGetScreenSize() guiDrugs = guiCreateWindow(x-285-20,y-253-20,285,253,"F3 - Drug Manager",false) lblDrug = guiCreateLabel(17,31,32,16,"Drug:",false,guiDrugs) lblAmount = guiCreateLabel(203,31,50,15,"Amount:",false,guiDrugs) rdoCannabis = guiCreateRadioButton(15,55,135,17,"Cannabis",false,guiDrugs) guiRadioButtonSetSelected(rdoCannabis,true) rdoHeroin = guiCreateRadioButton(15,79,135,17,"Heroin",false,guiDrugs) rdoCocaine = guiCreateRadioButton(15,104,135,17,"Cocaine",false,guiDrugs) rdoLSD = guiCreateRadioButton(15,129,135,17,"LSD",false,guiDrugs) rdoEcstasy = guiCreateRadioButton(15,154,135,17,"Ecstasy",false,guiDrugs) rdoOpium = guiCreateRadioButton(15,180,135,17,"Opium",false,guiDrugs) btnTakeHit = guiCreateButton(39,208,96,30,"Take a Hit",false,guiDrugs) btnSell = guiCreateButton(145,208,96,30,"Sell",false,guiDrugs) lblCannabis = guiCreateLabel(200,54,54,14,"0",false,guiDrugs) guiLabelSetVerticalAlign(lblCannabis,"center") guiLabelSetHorizontalAlign(lblCannabis,"center",false) lblHeroin = guiCreateLabel(200,76,54,14,"0",false,guiDrugs) guiLabelSetVerticalAlign(lblHeroin,"center") guiLabelSetHorizontalAlign(lblHeroin,"center",false) lblCocaine = guiCreateLabel(200,102,54,14,"0",false,guiDrugs) guiLabelSetVerticalAlign(lblCocaine,"center") guiLabelSetHorizontalAlign(lblCocaine,"center",false) lblLSD = guiCreateLabel(200,127,54,14,"0",false,guiDrugs) guiLabelSetVerticalAlign(lblLSD,"center") guiLabelSetHorizontalAlign(lblLSD,"center",false) lblEcstasy = guiCreateLabel(200,153,54,14,"0",false,guiDrugs) guiLabelSetVerticalAlign(lblEcstasy,"center") guiLabelSetHorizontalAlign(lblEcstasy,"center",false) lblOpium = guiCreateLabel(200,179,54,14,"0",false,guiDrugs) guiLabelSetVerticalAlign(lblOpium,"center") guiLabelSetHorizontalAlign(lblOpium,"center",false) guiSetVisible(guiDrugs,false) end addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),trolo) function drugShowHide () if (guiGetVisible(guiDrugs)==false) then guiSetVisible(guiDrugs,true) showCursor(true) else guiSetVisible(guiDrugs,false) showCursor(false) end end bindKey("F3","down",drugShowHide) function oncQuit() amountCannabis = guiGetText(lblCannabis) amountHeroin = guiGetText(lblHeroin) amountCocaine = guiGetText(lblCocaine) amountLSD = guiGetText(lblLSD) amountEcstasy = guiGetText(lblEcstasy) amountOpium = guiGetText(lblOpium) triggerServerEvent("saveDrugAmount",getLocalPlayer(),getLocalPlayer(),amountCannabis,amountHeroin,amountCocaine,amountLSD,amountEcstasy,amountOpium) end addEventHandler("onClientPlayerQuit",getRootElement(),oncQuit) function outputDrug (var1, var2, var3, var4, var5, var6) guiSetText ( lblCannabis,var1) guiSetText ( lblHeroin,var2) guiSetText ( lblCocaine,var3) guiSetText ( lblLSD,var4) guiSetText ( lblEcstasy,var5) guiSetText ( lblOpium,var6) end addEvent( "outputDrug2", true ) addEventHandler( "outputDrug2", getRootElement(), outputDrug ) addEvent("firstTime",true) addEventHandler("firstTime",getRootElement(), function() outputChatBox ("Test Measage") guiSetText(lblCannabis,"2") guiSetText(lblHeroin,"2") guiSetText(lblCocaine,"0") guiSetText(lblLSD,"0") guiSetText(lblEcstasy,"0") guiSetText(lblOpium,"0") end) server.lua addEvent("saveDrugAmount",true) addEventHandler("saveDrugAmount",getRootElement(), function(player,amountCannabisS,amountHeroinS,amountCocaineS,amountLSDS,amountEcstasyS,amountOpiumS) playeraccount = getPlayerAccount(player) if (playeraccount) then setAccountData(playeraccount,"amountCannabis",tonumber(amountCannabisS)) setAccountData(playeraccount,"amountHeroin",tonumber(amountHeroinS)) setAccountData(playeraccount,"amountCocaine",tonumber(amountCocaineS)) setAccountData(playeraccount,"amountLSDS",tonumber(amountLSDS)) setAccountData(playeraccount,"amountEcstasy",tonumber(amountEcstasyS)) setAccountData(playeraccount,"amountOpium",tonumber(amountOpiumS)) end end) function loadDrugAmount() playeraccount = getPlayerAccount(source) if (playeraccount) then amountCannabis2 = getAccountData(playeraccount,"amountCannabis") amountHeroin2 = getAccountData(playeraccount,"amountHeroin") amountCocaine2 = getAccountData(playeraccount,"amountCocaine") amountLSD2 = getAccountData(playeraccount,"amountLSDS") amountEcstasy2 = getAccountData(playeraccount,"amountEcstasy") amountOpium2 = getAccountData(playeraccount,"amountOpium") if (amountCannabis2) then triggerClientEvent (source, "outputDrug2", getRootElement(), amountCannabis2, amountHeroin2, amountCocaine2, amountLSD2, amountEcstasy2, amountOpium2 ) else triggerClientEvent(source,"firstTime",getRootElement()) end end end addEventHandler("onPlayerLogin",getRootElement(),loadDrugAmount)
×
×
  • Create New...