X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 takePlayerMoney tapl was not working in clientSide now its work on ClientSide and server side and can you help me with the script Link to comment
Alpha Posted May 23, 2012 Share Posted May 23, 2012 so for example well be like this ? --client-side addEvent('onHaveGunLicense', true) addEventHandler('onHaveGunLicense', root, function() button = guiCreateButton('Buy License',0,0,0) end) --serverSide local acc = getPlayerAccount(source) if not getAccountData(acc,"onHaveGunLicense") or tonumber(getAccountData(acc,"onHaveGunLicense")) ~= 1 then triggerClientEvent('onHaveGunLicense', source) else outputChatBox('You Dont Have GunLicense',source,255,255,0) end if not getAccountData(acc,"onHaveGunLicense") or tonumber(getAccountData(acc,"onHaveGunLicense")) ~= 1 then This if statement checks if he doesn't have a license, so it should be: Server: --serverSide local acc = getPlayerAccount(source) if not getAccountData(acc,"onHaveGunLicense") or tonumber(getAccountData(acc,"onHaveGunLicense")) ~= 1 then triggerClientEvent('onHaveGunLicense', source) else outputChatBox('You Already Have GunLicense',source,255,255,0) end Link to comment
TAPL Posted May 23, 2012 Share Posted May 23, 2012 takePlayerMoney tapl was not working in clientSide now its work on ClientSide and server side and can you help me with the script what version was not working? Link to comment
TAPL Posted May 23, 2012 Share Posted May 23, 2012 idont know realy . it's never got problem i think you was doing it wrong Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 see what wiki wrote ! Note: Using this function client side (not recommended) will not change a players money server side. and i was using it like this not worng ! takePlayerMoey(1000) --clientSide. Link to comment
TAPL Posted May 23, 2012 Share Posted May 23, 2012 see what wiki wrote !Note: Using this function client side (not recommended) will not change a players money server side. and i was using it like this not worng ! takePlayerMoey(1000) --clientSide. Wrong it's takePlayerMoney(1000) not takePlayerMoey(1000) Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 oh forget n dam you tapl ! Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 Ok Now i got this --serverSide addEvent('givecard', true) addEventHandler('givecard', root, function() local acc = getPlayerAccount(source) if not getAccountData(acc,"onHaveGunLicense") or tonumber(getAccountData(acc,"onHaveGunLicense")) ~= 1 then triggerClientEvent('onHaveGunLicense', source) else outputChatBox('You Already Have GunLicense',source,255,255,0) end --clientSide GUIEditor_Button[27] = guiCreateButton(0.668,0.5,0.3594,0.0945,"Buy license $5000",true,GUIEditor_Tab[8]) guiSetAlpha(GUIEditor_Button[27],1) guiSetFont(GUIEditor_Button[27],"default-bold-small") elseif (source == GUIEditor_Button[27]) then triggerServerEvent ("givecard",localPlayer) Link to comment
Alpha Posted May 23, 2012 Share Posted May 23, 2012 Do you have any problems with it? Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 --clientSide GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Progress = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(408,279,511,283,"Buy gun license (v1.0)",false) GUIEditor_Window[2] = guiCreateWindow(0.3,0.15,0.30,0.1,"Oh damn!",true) guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) guiSetAlpha(GUIEditor_Window[2],1) guiBringToFront(GUIEditor_Window[2]) label = guiCreateLabel (0.20,0.25,0.65,0.3,"You dont have enough money to buy that.",true,GUIEditor_Window[2]) button = guiCreateButton (0.35,0.6,0.3,0.2,"Ok",true,GUIEditor_Window[2]) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Image[1] = guiCreateStaticImage(168,23,166,141,"images/mtalogo.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(162,162,196,49,"Buy gun license $ 3000",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Label[1] = guiCreateLabel(10,254,296,16,"To Buy Weapons You Need to Buy gun license",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Button[2] = guiCreateButton(403,22,99,18,"Exit",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[2],"clear-normal") GUIEditor_Progress[1] = guiCreateProgressBar(537,26,0,5,false,GUIEditor_Window[1]) addEventHandler('onClientGUIClick', root, function() local money = getPlayerMoney(localPlayer) if (source == GUIEditor_Button[1]) then if (money >= 3000) then takePlayerMoney(3000) triggerServerEvent ("givecard",localPlayer) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2] ) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) showCursor( false ) local Marker2 = createMarker ( 286, -35, 1001, "cylinder", 2, 255, 255, 0, 150 ) setElementInterior( Marker2, 1, 286, -35, 1001 ) addEventHandler('onClientMarkerHit', Marker2, function ( hitPlayer ) if ( hitPlayer == localPlayer ) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor( true ) end end) end end) --serverSide addEventHandler ( "onResourceStart", getResourceRootElement(), function ( ) ped = createPed ( 46, 286, -35, 1001 ) setElementInterior( ped, 1, 286, -35, 1001 ) end ) problem, is the marker dont show and the ped gives me his back and guis dont show problem, is the marker dont show and the ped gives me his back and guis dont show Link to comment
TwiX! Posted May 23, 2012 Share Posted May 23, 2012 --clientSide GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Progress = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(408,279,511,283,"Buy gun license (v1.0)",false) GUIEditor_Window[2] = guiCreateWindow(0.3,0.15,0.30,0.1,"Oh damn!",true) guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) guiSetAlpha(GUIEditor_Window[2],1) guiBringToFront(GUIEditor_Window[2]) label = guiCreateLabel (0.20,0.25,0.65,0.3,"You dont have enough money to buy that.",true,GUIEditor_Window[2]) button = guiCreateButton (0.35,0.6,0.3,0.2,"Ok",true,GUIEditor_Window[2]) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Image[1] = guiCreateStaticImage(168,23,166,141,"images/mtalogo.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(162,162,196,49,"Buy gun license $ 3000",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Label[1] = guiCreateLabel(10,254,296,16,"To Buy Weapons You Need to Buy gun license",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Button[2] = guiCreateButton(403,22,99,18,"Exit",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[2],"clear-normal") GUIEditor_Progress[1] = guiCreateProgressBar(537,26,0,5,false,GUIEditor_Window[1]) addEventHandler('onClientGUIClick', root, function() local money = getPlayerMoney(localPlayer) if (source == GUIEditor_Button[1]) then if (money >= 3000) then takePlayerMoney(3000) triggerServerEvent ("givecard",localPlayer) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2] ) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) showCursor( false ) local Marker2 = createMarker ( 286, -35, 1001, "cylinder", 2, 255, 255, 0, 150 ) setElementInterior( Marker2, 1, 286, -35, 1001 ) end end ) addEventHandler('onClientMarkerHit', resourceRoot, function ( hitPlayer ) if getElementType(hitPlayer) == "player" then if source == Marker2 then guiSetVisible ( GUIEditor_Window[1], true ) showCursor( true ) end end end ) --serverSide addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), function ( ) ped = createPed ( 46, 286, -35, 1001 ) setElementInterior( ped, 1, 286, -35, 1001 ) end ) Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 Dont Work i well just make the shop form 0 and make it work . Link to comment
TwiX! Posted May 23, 2012 Share Posted May 23, 2012 Dont Work i well just make the shop form 0 and make it work . maybe /debugscript 3? Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 No TwiX its a mess must be Organized i well start form 0 and finsh it i want make a working shop by my slef Link to comment
Jaysds1 Posted May 23, 2012 Share Posted May 23, 2012 try this: --clientSide GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Progress = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(408,279,511,283,"Buy gun license (v1.0)",false) GUIEditor_Window[2] = guiCreateWindow(0.3,0.15,0.30,0.1,"Oh damn!",true) guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) guiSetAlpha(GUIEditor_Window[2],1) guiBringToFront(GUIEditor_Window[2]) label = guiCreateLabel (0.20,0.25,0.65,0.3,"You dont have enough money to buy that.",true,GUIEditor_Window[2]) button = guiCreateButton (0.35,0.6,0.3,0.2,"Ok",true,GUIEditor_Window[2]) guiWindowSetMovable(GUIEditor_Window[1],false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Image[1] = guiCreateStaticImage(168,23,166,141,"images/mtalogo.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(162,162,196,49,"Buy gun license $ 3000",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Label[1] = guiCreateLabel(10,254,296,16,"To Buy Weapons You Need to Buy gun license",false,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Button[2] = guiCreateButton(403,22,99,18,"Exit",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[2],"clear-normal") GUIEditor_Progress[1] = guiCreateProgressBar(537,26,0,5,false,GUIEditor_Window[1]) addEventHandler('onClientGUIClick', guiRoot, function() --changed root to guiRoot local money = getPlayerMoney(localPlayer) if (source == GUIEditor_Button[1]) then if (money >= 3000) then takePlayerMoney(3000) triggerServerEvent ("givecard",localPlayer) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2] ) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],false) showCursor( false ) local Marker2 = createMarker ( 286, -35, 1001, "cylinder", 2, 255, 255, 0, 150 ) setElementInterior( Marker2, 1, 286, -35, 1001 ) addEventHandler('onClientMarkerHit', Marker2,function ( hitPlayer ) if ( hitPlayer == localPlayer ) then guiSetVisible ( GUIEditor_Window[1], true ) showCursor( true ) end end) end end,true) --remember to add true for sources or false for single buttons --serverSide addEventHandler ( "onResourceStart",resourceRoot,function ( ) ped = createPed ( 46, 286, -35, 1001 ) setElementInterior( ped, 1, 286, -35, 1001 ) end) Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 to late jaysds1 i alredy delete the script iam making it form 0 Link to comment
X-SHADOW Posted May 23, 2012 Author Share Posted May 23, 2012 ok this is what i made server-Side marker1 = createMarker ( 296.4638671875,-38.150390625,1000.515625, "cylinder", 1.5, 255, 255, 0, 170 ) setElementInterior ( marker1, 1, 296.4638671875,-38.150390625,1000.515625 ) marker2 = createMarker ( 293.66009521484,-37.552013997217,1001.515625, "cylinder", 1.0, 255, 255, 0, 170 ) setElementInterior ( marker2, 1, 293.66009521484,-37.552013997217,1001.515625 ) function weapondealer1() WeaponSeller = createPed ( 30, 296.390625,-40.2216796875,1001.515625 ) setElementInterior ( WeaponSeller, 1, 296.390625,-40.2216796875,1001.515625 ) setElementFrozen (WeaponSeller, true) setPedAnimation( WeaponSeller, "BAR", "BARman_idle") WeaponSeller2 = createPed ( 188, 294.03039550781,-40.217727661133,1001.515625 ) setElementInterior ( WeaponSeller2, 1, 294.03039550781,-40.217727661133,1001.515625 ) setElementFrozen (WeaponSeller2, true) setPedAnimation( WeaponSeller2, "BAR", "BARman_idle") end addEventHandler ("onResourceStart", resourceRoot, weapondealer1) function FreezeBots() local Bots = getElementsByType("ped") for k,v in ipairs(Bots) do setElementFrozen(v,true) end end function showGUI (jugador) if (source == marker1) then triggerClientEvent (jugador,"showGUI",getRootElement(),jugador) end end addEventHandler ("onMarkerHit",getRootElement(),showGUI) function showGUI (jugador) if (source == marker2) then triggerClientEvent (jugador,"showGUI2",getRootElement(),jugador) end end addEventHandler ("onMarkerHit",getRootElement(),showGUI) function give45 () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,22,51,true) end addEvent("give45",true) addEventHandler("give45",getRootElement(),give45) function givesilenced () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,23,51,true) end addEvent("givesilenced",true) addEventHandler("givesilenced",getRootElement(),givesilenced) function givedeagle () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,24,21,true) end addEvent("givedeagle",true) addEventHandler("givedeagle",getRootElement(),givedeagle) function givesh () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,25,50,true) end addEvent("givesh",true) addEventHandler("givesh",getRootElement(),givesh) function giveso () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,26,25,true) end addEvent("giveso",true) addEventHandler("giveso",getRootElement(),giveso) function giveSP () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,27,35,true) end addEvent("giveSP",true) addEventHandler("giveSP",getRootElement(),giveSP) function givetec () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,32,200,true) end addEvent("givetec",true) addEventHandler("givetec",getRootElement(),givetec) function giveuzi () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,28,200,true) end addEvent("giveuzi",true) addEventHandler("giveuzi",getRootElement(),giveuzi) function givemp5 () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,29,120,true) end addEvent("givemp5",true) addEventHandler("givemp5",getRootElement(),givemp5) function givem4 () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,31,200,true) end addEvent("givem4",true) addEventHandler("givem4",getRootElement(),givem4) function giveak () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,30,120,true) end addEvent("giveak",true) addEventHandler("giveak",getRootElement(),giveak) function givecs () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,33,40,true) end addEvent("givecs",true) addEventHandler("givecs",getRootElement(),givecs) function gives () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,34,40,true) end addEvent("gives",true) addEventHandler("gives",getRootElement(),gives) function givenade () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,16,20,true) end addEvent("givenade",true) addEventHandler("givenade",getRootElement(),givenade) function givesat () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,40,1,true) giveWeapon (source,39,10,true) end addEvent("givesat",true) addEventHandler("givesat",getRootElement(),givesat) function givecoc () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,18,20,true) end addEvent("givecoc",true) addEventHandler("givecoc",getRootElement(),givecoc) function giveknife () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else giveWeapon (source,4,1,true) end addEvent("giveknife",true) addEventHandler("giveknife",getRootElement(),giveknife) function givehealth () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else setElementHealth (source, 100, true) end addEvent("givehealth", true) addEventHandler("givehealth", getRootElement(),givehealth) function givearmor () if getAccountData(acc,"onHaveGunLicense") ~= false then outputChatBox('Error You Must Have GunLicense',source,255,0,0) else setPedArmor (source, 100, true) end addEvent("givearmor", true) addEventHandler("givearmor", getRootElement(),givearmor) addEvent('givecard', true) addEventHandler('givecard',root,function() local acc = getPlayerAccount(source) if getAccountData(acc,"onHaveGunLicense") ~= false then setAccountData(source,'onHaveGunLicense', true) else outputChatBox('* Sorry but you not have a Gun License ',source,255,0,0) end end) end client-Side GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[3] = guiCreateWindow(408,279,511,283,"Buy gun license (v1.0)",false) GUIEditor_Window[4] = guiCreateWindow(0.3,0.15,0.30,0.1,"Oh damn!",true) guiSetVisible(GUIEditor_Window[3],false) guiSetVisible(GUIEditor_Window[4],false) guiSetAlpha(GUIEditor_Window[4],1) guiBringToFront(GUIEditor_Window[4]) label = guiCreateLabel (0.20,0.25,0.65,0.3,"You dont have enough money to buy that.",true,GUIEditor_Window[4]) button = guiCreateButton (0.35,0.6,0.3,0.2,"Ok",true,GUIEditor_Window[4]) guiWindowSetMovable(GUIEditor_Window[3],false) guiWindowSetSizable(GUIEditor_Window[3],false) GUIEditor_Image[1] = guiCreateStaticImage(168,23,166,141,"images/mtalogo.png",false,GUIEditor_Window[3]) GUIEditor_Button[1] = guiCreateButton(162,162,196,49,"Buy gun license $ 3000",false,GUIEditor_Window[3]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Label[1] = guiCreateLabel(10,254,296,16,"To Buy Weapons You Need to Buy gun license",false,GUIEditor_Window[3]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Button[3] = guiCreateButton(403,22,99,18,"Exit",false,GUIEditor_Window[3]) guiSetFont(GUIEditor_Button[3],"clear-normal") addEventHandler("onClientGUIClick",getRootElement(), function (player) if (source == GUIEditor_Button[29]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) elseif (source == GUIEditor_Button[30]) then guiSetVisible (GUIEditor_Window[2],false) showCursor (false) elseif (source == GUIEditor_Button[1]) then money = getPlayerMoney (source) if (money >= 100) then player = getLocalPlayer() outputChatBox ("You bought a Pistol $100",225,225,0) takePlayerMoney(100) triggerServerEvent ("give45",getLocalPlayer(),give45) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2]) then money = getPlayerMoney (source) if (money >= 200) then player = getLocalPlayer() outputChatBox ("You bought a Silenced $200",225,225,0) takePlayerMoney(200) triggerServerEvent ("givesilenced",getLocalPlayer(),givesilenced) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[3]) then money = getPlayerMoney (source) if (money >= 600) then player = getLocalPlayer() outputChatBox ("You bought a Desert Eagle $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("givedeagle",getLocalPlayer(),givedeagle) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[4]) then money = getPlayerMoney (source) if (money >= 500) then player = getLocalPlayer() outputChatBox ("You bought a Shotgun $500",225,225,0) takePlayerMoney(500) triggerServerEvent ("givesh",getLocalPlayer(),givesh) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[5]) then money = getPlayerMoney (source) if (money >= 700) then player = getLocalPlayer() outputChatBox ("You bought a Sawn Off $700",225,225,0) takePlayerMoney(700) triggerServerEvent ("giveso",getLocalPlayer(),giveso) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[6]) then money = getPlayerMoney (source) if (money >= 1000) then player = getLocalPlayer() outputChatBox ("You bought a SPAZ-12 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveSP",getLocalPlayer(),giveSP) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[7]) then money = getPlayerMoney (source) if (money >= 400) then player = getLocalPlayer() outputChatBox ("You bought a Tec-9 $400",225,225,0) takePlayerMoney(400) triggerServerEvent ("givetec",getLocalPlayer(),givetec) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[8]) then money = getPlayerMoney (source) if (money >= 600) then player = getLocalPlayer() outputChatBox ("You bought a Uzi $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("giveuzi",getLocalPlayer(),giveuzi) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[9]) then money = getPlayerMoney (source) if (money >= 800) then player = getLocalPlayer() outputChatBox ("You bought a MP5 $800",225,225,0) takePlayerMoney(800) triggerServerEvent ("givemp5",getLocalPlayer(),givemp5) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[11]) then money = getPlayerMoney (source) if (money >= 1000) then player = getLocalPlayer() outputChatBox ("You bought an AK-47 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveak",getLocalPlayer(),giveak) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[10]) then money = getPlayerMoney (source) if (money >= 2000) then player = getLocalPlayer() outputChatBox ("You bought a M4 $2000",225,225,0) takePlayerMoney(2000) triggerServerEvent ("givem4",getLocalPlayer(),givem4) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[13]) then money = getPlayerMoney (source) if (money >= 3000) then player = getLocalPlayer() outputChatBox ("You bought a Sniper $3000",225,225,0) takePlayerMoney(3000) triggerServerEvent ("gives",getLocalPlayer(),gives) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[12]) then money = getPlayerMoney (source) if (money >= 1000) then player = getLocalPlayer() outputChatBox ("You bought a Country Sniper $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givecs",getLocalPlayer(),givecs) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[25]) then money = getPlayerMoney (source) if (money >= 1000) then player = getLocalPlayer() outputChatBox ("You bought a MedKit $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givehealth",getLocalPlayer(),givehealth) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[26]) then money = getPlayerMoney (source) if (money >= 1500) then player = getLocalPlayer() outputChatBox ("You bought a Bullet Proof Vest $1500",225,225,0) takePlayerMoney(1500) triggerServerEvent ("givearmor",getLocalPlayer(),givearmor) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == button) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],true) elseif (source == GUIEditor_Button[1]) then local money = getPlayerMoney(localPlayer) if (money >= 3000) then takePlayerMoney(3000) triggerServerEvent ("givecard",localPlayer) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) elseif ( source == GUIEditor_Button[3] ) then guiSetVisible(GUIEditor_Window[3],true) guiSetVisible(GUIEditor_Window[4],false) end end end) function showGUI () guiSetVisible (GUIEditor_Window[1],true) showCursor (true) end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),showGUI) function showGUI2 () guiSetVisible (GUIEditor_Window[3],true) showCursor (true) end addEvent ("showGUI2",true) addEventHandler ("showGUI2",getRootElement(),showGUI2) Link to comment
Jaysds1 Posted May 23, 2012 Share Posted May 23, 2012 For the server-side, use: not getAccountData(acc,"onHaveGunLicense") and you forgot the last end in every giveGUN function, and for the giveGunLicense: addEvent('givecard', true) addEventHandler('givecard',root,function() local acc = getPlayerAccount(source) if getAccountData(acc,"onHaveGunLicense") ~= false then setAccountData(acc,'onHaveGunLicense', true) --changed source to acc else outputChatBox('* Sorry but you not have a Gun License ',source,255,0,0) end end) Damn, this one took long for me, Client-side: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[3] = guiCreateWindow(408,279,511,283,"Buy gun license (v1.0)",false) GUIEditor_Window[4] = guiCreateWindow(0.3,0.15,0.30,0.1,"Oh damn!",true) guiSetVisible(GUIEditor_Window[3],false) guiSetVisible(GUIEditor_Window[4],false) guiSetAlpha(GUIEditor_Window[4],1) guiBringToFront(GUIEditor_Window[4]) label = guiCreateLabel (0.20,0.25,0.65,0.3,"You dont have enough money to buy that.",true,GUIEditor_Window[4]) button = guiCreateButton (0.35,0.6,0.3,0.2,"Ok",true,GUIEditor_Window[4]) guiWindowSetMovable(GUIEditor_Window[3],false) guiWindowSetSizable(GUIEditor_Window[3],false) GUIEditor_Image[1] = guiCreateStaticImage(168,23,166,141,"images/mtalogo.png",false,GUIEditor_Window[3]) GUIEditor_Button[1] = guiCreateButton(162,162,196,49,"Buy gun license $ 3000",false,GUIEditor_Window[3]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Label[1] = guiCreateLabel(10,254,296,16,"To Buy Weapons You Need to Buy gun license",false,GUIEditor_Window[3]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Button[3] = guiCreateButton(403,22,99,18,"Exit",false,GUIEditor_Window[3]) guiSetFont(GUIEditor_Button[3],"clear-normal") addEventHandler("onClientGUIClick",guiRoot,function() money = getPlayerMoney (localPlayer) --source is the button the person clicked, use localPlayer if (source == GUIEditor_Button[29]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) elseif (source == GUIEditor_Button[30]) then guiSetVisible (GUIEditor_Window[2],false) showCursor (false) elseif (source == GUIEditor_Button[1]) then if (money >= 100) then outputChatBox ("You bought a Pistol $100",225,225,0) takePlayerMoney(100) triggerServerEvent ("give45",getLocalPlayer(),give45) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2]) then if (money >= 200) then outputChatBox ("You bought a Silenced $200",225,225,0) takePlayerMoney(200) triggerServerEvent ("givesilenced",getLocalPlayer(),givesilenced) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[3]) then if (money >= 600) then outputChatBox ("You bought a Desert Eagle $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("givedeagle",getLocalPlayer(),givedeagle) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[4]) then if (money >= 500) then outputChatBox ("You bought a Shotgun $500",225,225,0) takePlayerMoney(500) triggerServerEvent ("givesh",getLocalPlayer(),givesh) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[5]) then if (money >= 700) then outputChatBox ("You bought a Sawn Off $700",225,225,0) takePlayerMoney(700) triggerServerEvent ("giveso",getLocalPlayer(),giveso) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[6]) then if (money >= 1000) then outputChatBox ("You bought a SPAZ-12 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveSP",getLocalPlayer(),giveSP) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[7]) then if (money >= 400) then outputChatBox ("You bought a Tec-9 $400",225,225,0) takePlayerMoney(400) triggerServerEvent ("givetec",getLocalPlayer(),givetec) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[8]) then if (money >= 600) then outputChatBox ("You bought a Uzi $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("giveuzi",getLocalPlayer(),giveuzi) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[9]) then if (money >= 800) then outputChatBox ("You bought a MP5 $800",225,225,0) takePlayerMoney(800) triggerServerEvent ("givemp5",getLocalPlayer(),givemp5) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[11]) then if (money >= 1000) then outputChatBox ("You bought an AK-47 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveak",getLocalPlayer(),giveak) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[10]) then if (money >= 2000) then outputChatBox ("You bought a M4 $2000",225,225,0) takePlayerMoney(2000) triggerServerEvent ("givem4",getLocalPlayer(),givem4) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[13]) then if (money >= 3000) then outputChatBox ("You bought a Sniper $3000",225,225,0) takePlayerMoney(3000) triggerServerEvent ("gives",getLocalPlayer(),gives) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[12]) then if (money >= 1000) then outputChatBox ("You bought a Country Sniper $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givecs",getLocalPlayer(),givecs) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[25]) then if (money >= 1000) then outputChatBox ("You bought a MedKit $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givehealth",getLocalPlayer(),givehealth) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[26]) then if (money >= 1500) then outputChatBox ("You bought a Bullet Proof Vest $1500",225,225,0) takePlayerMoney(1500) triggerServerEvent ("givearmor",getLocalPlayer(),givearmor) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == button) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],true) elseif (source == GUIEditor_Button[1]) then if (money >= 3000) then takePlayerMoney(3000) triggerServerEvent ("givecard",localPlayer) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) elseif ( source == GUIEditor_Button[3] ) then guiSetVisible(GUIEditor_Window[3],true) guiSetVisible(GUIEditor_Window[4],false) end end end,true) --forgot the true, since it's a button and it's for a group of buttons function showGUI () if(eventName=="showGUI")then guiSetVisible (GUIEditor_Window[1],true) showCursor (true) else guiSetVisible (GUIEditor_Window[3],true) showCursor(true) end end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),showGUI) addEvent ("showGUI2",true) addEventHandler ("showGUI2",getRootElement(),showGUI) Link to comment
X-SHADOW Posted May 24, 2012 Author Share Posted May 24, 2012 Jaysds1 but i want if he dont have linces and want buy tell him ('Sorry You Must Have ..') who ? Link to comment
Jaysds1 Posted May 24, 2012 Share Posted May 24, 2012 change those give functions to this: function giveGUN() if(not getAccountData(acc,"GunLicense")then outputChatBox("Sorry You Must Have A Gun License",client,100,0,0) else giveWeapon(thewep) end end Link to comment
X-SHADOW Posted May 24, 2012 Author Share Posted May 24, 2012 server triggerd clientside event showGUI,but event is not added clientside --clientSide GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[3] = guiCreateWindow(408,279,511,283,"Buy gun license (v1.0)",false) GUIEditor_Window[4] = guiCreateWindow(0.3,0.15,0.30,0.1,"Oh damn!",true) guiSetVisible(GUIEditor_Window[3],false) guiSetVisible(GUIEditor_Window[4],false) guiSetAlpha(GUIEditor_Window[4],1) guiBringToFront(GUIEditor_Window[4]) label = guiCreateLabel (0.20,0.25,0.65,0.3,"You dont have enough money to buy that.",true,GUIEditor_Window[4]) button = guiCreateButton (0.35,0.6,0.3,0.2,"Ok",true,GUIEditor_Window[4]) guiWindowSetMovable(GUIEditor_Window[3],false) guiWindowSetSizable(GUIEditor_Window[3],false) GUIEditor_Image[1] = guiCreateStaticImage(168,23,166,141,"images/mtalogo.png",false,GUIEditor_Window[3]) GUIEditor_Button[1] = guiCreateButton(162,162,196,49,"Buy gun license $ 3000",false,GUIEditor_Window[3]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Label[1] = guiCreateLabel(10,254,296,16,"To Buy Weapons You Need to Buy gun license",false,GUIEditor_Window[3]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Button[3] = guiCreateButton(403,22,99,18,"Exit",false,GUIEditor_Window[3]) guiSetFont(GUIEditor_Button[3],"clear-normal") addEventHandler("onClientGUIClick",root,function() money = getPlayerMoney (localPlayer) if (source == GUIEditor_Button[29]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) elseif (source == GUIEditor_Button[30]) then guiSetVisible (GUIEditor_Window[2],false) showCursor (false) elseif (source == GUIEditor_Button[1]) then if (money >= 100) then outputChatBox ("You bought a Pistol $100",225,225,0) takePlayerMoney(100) triggerServerEvent ("give45",getLocalPlayer(),give45) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2]) then if (money >= 200) then outputChatBox ("You bought a Silenced $200",225,225,0) takePlayerMoney(200) triggerServerEvent ("givesilenced",getLocalPlayer(),givesilenced) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[3]) then if (money >= 600) then outputChatBox ("You bought a Desert Eagle $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("givedeagle",getLocalPlayer(),givedeagle) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[4]) then if (money >= 500) then outputChatBox ("You bought a Shotgun $500",225,225,0) takePlayerMoney(500) triggerServerEvent ("givesh",getLocalPlayer(),givesh) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[5]) then if (money >= 700) then outputChatBox ("You bought a Sawn Off $700",225,225,0) takePlayerMoney(700) triggerServerEvent ("giveso",getLocalPlayer(),giveso) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[6]) then if (money >= 1000) then outputChatBox ("You bought a SPAZ-12 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveSP",getLocalPlayer(),giveSP) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[7]) then if (money >= 400) then outputChatBox ("You bought a Tec-9 $400",225,225,0) takePlayerMoney(400) triggerServerEvent ("givetec",getLocalPlayer(),givetec) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[8]) then if (money >= 600) then outputChatBox ("You bought a Uzi $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("giveuzi",getLocalPlayer(),giveuzi) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[9]) then if (money >= 800) then outputChatBox ("You bought a MP5 $800",225,225,0) takePlayerMoney(800) triggerServerEvent ("givemp5",getLocalPlayer(),givemp5) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[11]) then if (money >= 1000) then outputChatBox ("You bought an AK-47 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveak",getLocalPlayer(),giveak) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[10]) then if (money >= 2000) then outputChatBox ("You bought a M4 $2000",225,225,0) takePlayerMoney(2000) triggerServerEvent ("givem4",getLocalPlayer(),givem4) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[13]) then if (money >= 3000) then outputChatBox ("You bought a Sniper $3000",225,225,0) takePlayerMoney(3000) triggerServerEvent ("gives",getLocalPlayer(),gives) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[12]) then if (money >= 1000) then outputChatBox ("You bought a Country Sniper $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givecs",getLocalPlayer(),givecs) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[25]) then if (money >= 1000) then outputChatBox ("You bought a MedKit $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givehealth",getLocalPlayer(),givehealth) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[26]) then if (money >= 1500) then outputChatBox ("You bought a Bullet Proof Vest $1500",225,225,0) takePlayerMoney(1500) triggerServerEvent ("givearmor",getLocalPlayer(),givearmor) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == button) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],true) elseif ( source == GUIEditor_Button[3] ) then guiSetVisible(GUIEditor_Window[3],true) guiSetVisible(GUIEditor_Window[4],false) elseif (source == GUIEditor_Button[1]) then if (money >= 3000) then takePlayerMoney(3000) triggerServerEvent ("givecard",localPlayer) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) function showGUI () if(eventName=="showGUI")then guiSetVisible (GUIEditor_Window[1],true) showCursor (true) else guiSetVisible (GUIEditor_Window[3],true) showCursor(true) end end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),showGUI) addEvent ("showGUI2",true) addEventHandler ("showGUI2",getRootElement(),showGUI) end end end) createBlip ( 1367, -1279, 13 , 6 ) --serverSide marker1 = createMarker ( 296.4638671875,-38.150390625,1000.515625, "cylinder", 1.5, 255, 255, 0, 170 ) setElementInterior ( marker1, 1, 296.4638671875,-38.150390625,1000.515625 ) marker2 = createMarker ( 293.66009521484,-37.552013997217,1001.515625, "cylinder", 1.0, 255, 255, 0, 170 ) setElementInterior ( marker2, 1, 293.66009521484,-37.552013997217,1001.515625 ) function weapondealer1() WeaponSeller = createPed ( 30, 296.390625,-40.2216796875,1001.515625 ) setElementInterior ( WeaponSeller, 1, 296.390625,-40.2216796875,1001.515625 ) setElementFrozen (WeaponSeller, true) setPedAnimation( WeaponSeller, "BAR", "BARman_idle") WeaponSeller2 = createPed ( 188, 294.03039550781,-40.217727661133,1001.515625 ) setElementInterior ( WeaponSeller2, 1, 294.03039550781,-40.217727661133,1001.515625 ) setElementFrozen (WeaponSeller2, true) setPedAnimation( WeaponSeller2, "BAR", "BARman_idle") end addEventHandler ("onResourceStart", resourceRoot, weapondealer1) function FreezeBots() local Bots = getElementsByType("ped") for k,v in ipairs(Bots) do setElementFrozen(v,true) end end function showGUI (jugador) if (source == marker1) then triggerClientEvent (jugador,"showGUI",getRootElement(),jugador) end end addEventHandler ("onMarkerHit",getRootElement(),showGUI) function showGUI (jugador) if (source == marker2) then triggerClientEvent (jugador,"showGUI2",getRootElement(),jugador) end end addEventHandler ("onMarkerHit",getRootElement(),showGUI) function give45 () giveWeapon (source,22,51,true) end addEvent("give45",true) addEventHandler("give45",getRootElement(),give45) function givesilenced () giveWeapon (source,23,51,true) end addEvent("givesilenced",true) addEventHandler("givesilenced",getRootElement(),givesilenced) function givedeagle () giveWeapon (source,24,21,true) end addEvent("givedeagle",true) addEventHandler("givedeagle",getRootElement(),givedeagle) function givesh () giveWeapon (source,25,50,true) end addEvent("givesh",true) addEventHandler("givesh",getRootElement(),givesh) function giveso () giveWeapon (source,26,25,true) end addEvent("giveso",true) addEventHandler("giveso",getRootElement(),giveso) function giveSP () giveWeapon (source,27,35,true) end addEvent("giveSP",true) addEventHandler("giveSP",getRootElement(),giveSP) function givetec () giveWeapon (source,32,200,true) end addEvent("givetec",true) addEventHandler("givetec",getRootElement(),givetec) function giveuzi () giveWeapon (source,28,200,true) end addEvent("giveuzi",true) addEventHandler("giveuzi",getRootElement(),giveuzi) function givemp5 () giveWeapon (source,29,120,true) end addEvent("givemp5",true) addEventHandler("givemp5",getRootElement(),givemp5) function givem4 () giveWeapon (source,31,200,true) end addEvent("givem4",true) addEventHandler("givem4",getRootElement(),givem4) function giveak () giveWeapon (source,30,120,true) end addEvent("giveak",true) addEventHandler("giveak",getRootElement(),giveak) function givecs () giveWeapon (source,33,40,true) end addEvent("givecs",true) addEventHandler("givecs",getRootElement(),givecs) function gives () giveWeapon (source,34,40,true) end addEvent("gives",true) addEventHandler("gives",getRootElement(),gives) function givenade () giveWeapon (source,16,20,true) end addEvent("givenade",true) addEventHandler("givenade",getRootElement(),givenade) function givesat () giveWeapon (source,40,1,true) giveWeapon (source,39,10,true) end addEvent("givesat",true) addEventHandler("givesat",getRootElement(),givesat) function givecoc () giveWeapon (source,18,20,true) end addEvent("givecoc",true) addEventHandler("givecoc",getRootElement(),givecoc) function giveknife () giveWeapon (source,4,1,true) end addEvent("giveknife",true) addEventHandler("giveknife",getRootElement(),giveknife) function givehealth () setElementHealth (source, 100, true) end addEvent("givehealth", true) addEventHandler("givehealth", getRootElement(),givehealth) function givearmor () setPedArmor (source, 100, true) end addEvent("givearmor", true) addEventHandler("givearmor", getRootElement(),givearmor) function card () local acc = getPlayerAccount(source) if ( acc ) then setAccountData(acc,'onHaveGunLicense', true) addEvent('givecard', true) addEventHandler('givecard', root, card ) end end and one another probmel Marker 2 is flying not stuck to the gorund Link to comment
Jaysds1 Posted May 24, 2012 Share Posted May 24, 2012 (edited) try this, client-side: GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Image = {} GUIEditor_Window[3] = guiCreateWindow(408,279,511,283,"Buy gun license (v1.0)",false) GUIEditor_Window[4] = guiCreateWindow(0.3,0.15,0.30,0.1,"Oh damn!",true) guiSetVisible(GUIEditor_Window[3],false) guiSetVisible(GUIEditor_Window[4],false) guiSetAlpha(GUIEditor_Window[4],1) guiBringToFront(GUIEditor_Window[4]) label = guiCreateLabel (0.20,0.25,0.65,0.3,"You dont have enough money to buy that.",true,GUIEditor_Window[4]) button = guiCreateButton (0.35,0.6,0.3,0.2,"Ok",true,GUIEditor_Window[4]) guiWindowSetMovable(GUIEditor_Window[3],false) guiWindowSetSizable(GUIEditor_Window[3],false) GUIEditor_Image[1] = guiCreateStaticImage(168,23,166,141,"images/mtalogo.png",false,GUIEditor_Window[3]) GUIEditor_Button[1] = guiCreateButton(162,162,196,49,"Buy gun license $ 3000",false,GUIEditor_Window[3]) guiSetFont(GUIEditor_Button[1],"clear-normal") GUIEditor_Label[1] = guiCreateLabel(10,254,296,16,"To Buy Weapons You Need to Buy gun license",false,GUIEditor_Window[3]) guiLabelSetColor(GUIEditor_Label[1],255,255,0) guiSetFont(GUIEditor_Label[1],"clear-normal") GUIEditor_Button[3] = guiCreateButton(403,22,99,18,"Exit",false,GUIEditor_Window[3]) guiSetFont(GUIEditor_Button[3],"clear-normal") addEventHandler("onClientGUIClick",guiRoot,function() money = getPlayerMoney (localPlayer) if (source == GUIEditor_Button[29]) then guiSetVisible (GUIEditor_Window[1],false) showCursor (false) elseif (source == GUIEditor_Button[30]) then guiSetVisible (GUIEditor_Window[2],false) showCursor (false) elseif (source == GUIEditor_Button[1]) then if (money >= 100) then outputChatBox ("You bought a Pistol $100",225,225,0) takePlayerMoney(100) triggerServerEvent ("give45",getLocalPlayer(),give45) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end elseif (source == GUIEditor_Button[2]) then if (money >= 200) then outputChatBox ("You bought a Silenced $200",225,225,0) takePlayerMoney(200) triggerServerEvent ("givesilenced",getLocalPlayer(),givesilenced) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[3]) then guiSetVisible(GUIEditor_Window[3],false) showCursor(false) elseif (source == GUIEditor_Button[4]) then if (money >= 500) then outputChatBox ("You bought a Shotgun $500",225,225,0) takePlayerMoney(500) triggerServerEvent ("givesh",getLocalPlayer(),givesh) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[5]) then if (money >= 700) then outputChatBox ("You bought a Sawn Off $700",225,225,0) takePlayerMoney(700) triggerServerEvent ("giveso",getLocalPlayer(),giveso) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[6]) then if (money >= 1000) then outputChatBox ("You bought a SPAZ-12 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveSP",getLocalPlayer(),giveSP) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[7]) then if (money >= 400) then outputChatBox ("You bought a Tec-9 $400",225,225,0) takePlayerMoney(400) triggerServerEvent ("givetec",getLocalPlayer(),givetec) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[8]) then if (money >= 600) then outputChatBox ("You bought a Uzi $600",225,225,0) takePlayerMoney(600) triggerServerEvent ("giveuzi",getLocalPlayer(),giveuzi) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[9]) then if (money >= 800) then outputChatBox ("You bought a MP5 $800",225,225,0) takePlayerMoney(800) triggerServerEvent ("givemp5",getLocalPlayer(),givemp5) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[11]) then if (money >= 1000) then outputChatBox ("You bought an AK-47 $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("giveak",getLocalPlayer(),giveak) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[10]) then if (money >= 2000) then outputChatBox ("You bought a M4 $2000",225,225,0) takePlayerMoney(2000) triggerServerEvent ("givem4",getLocalPlayer(),givem4) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[13]) then if (money >= 3000) then outputChatBox ("You bought a Sniper $3000",225,225,0) takePlayerMoney(3000) triggerServerEvent ("gives",getLocalPlayer(),gives) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[12]) then if (money >= 1000) then outputChatBox ("You bought a Country Sniper $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givecs",getLocalPlayer(),givecs) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[25]) then if (money >= 1000) then outputChatBox ("You bought a MedKit $1000",225,225,0) takePlayerMoney(1000) triggerServerEvent ("givehealth",getLocalPlayer(),givehealth) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == GUIEditor_Button[26]) then if (money >= 1500) then outputChatBox ("You bought a Bullet Proof Vest $1500",225,225,0) takePlayerMoney(1500) triggerServerEvent ("givearmor",getLocalPlayer(),givearmor) else guiSetVisible(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[2],true) end elseif (source == button) then guiSetVisible(GUIEditor_Window[2],false) guiSetVisible(GUIEditor_Window[1],true) elseif ( source == GUIEditor_Button[3] ) then guiSetVisible(GUIEditor_Window[3],true) guiSetVisible(GUIEditor_Window[4],false) elseif (source == GUIEditor_Button[1]) then if (money >= 3000) then takePlayerMoney(3000) triggerServerEvent ("givecard",localPlayer) else guiSetVisible(GUIEditor_Window[2],true) guiSetVisible(GUIEditor_Window[1],false) end end end,true) function showGUI () if(eventName=="showGUI")then guiSetVisible (GUIEditor_Window[1],true) showCursor (true) else guiSetVisible (GUIEditor_Window[3],true) showCursor(true) end end addEvent ("showGUI",true) addEventHandler ("showGUI",getRootElement(),showGUI) addEvent ("showGUI2",true) addEventHandler ("showGUI2",getRootElement(),showGUI) createBlip ( 1367, -1279, 13 , 6 ) For the marker, the markers don't attach to the ground, so lower down the (ones) number and see if it's close to the ground Edited May 24, 2012 by Guest Link to comment
X-SHADOW Posted May 24, 2012 Author Share Posted May 24, 2012 lol sorry made you tired with me iam realy sorry 2 problems #1 GUIEditor_Button[3] = guiCreateButton(403,22,99,18,"Exit",false,GUIEditor_Window[3]) dosn't work #2 the Buy licens dont work no erros and dont work the markers i well fix them later Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now