maxleonardo3 Posted May 4, 2013 Share Posted May 4, 2013 function VeiculoVIP() if (not isElementInWater) then local playerr = getRootElement() local x, y, z = getElementPosition ( playerr ) carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( playerr, carro ) end end addEvent("VeiculoVIP", true) addEventHandler("VeiculoVIP", resourceRoot, VeiculoVIP) and this good script I made for VIPS but not to create it faser getting someone help ... thanks Link to comment
Baseplate Posted May 4, 2013 Share Posted May 4, 2013 playerr isn't really defined and isElementInWater is wrong. function VeiculoVIP() if (not isElementInWater(source)) then local x, y, z = getElementPosition (source) carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( source, carro ) end end addEvent("VeiculoVIP", true) addEventHandler("VeiculoVIP", resourceRoot, VeiculoVIP) Link to comment
maxleonardo3 Posted May 4, 2013 Author Share Posted May 4, 2013 function VeiculoVIP() if (not isElementInWater(source)) then local x, y, z = getElementPosition (source) carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( source, carro ) end end addEvent("VeiculoVIP", true) addEventHandler("VeiculoVIP", resourceRoot, VeiculoVIP) ERRO Link to comment
iPrestege Posted May 4, 2013 Share Posted May 4, 2013 function VeiculoVIP() if (not isElementInWater(source)) then local x, y, z = getElementPosition (source) carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( source, carro ) end end addEvent("VeiculoVIP", true) addEventHandler("VeiculoVIP", resourceRoot, VeiculoVIP) ERRO What? Link to comment
Turky1 Posted May 4, 2013 Share Posted May 4, 2013 function VeiculoVIP() if (not isElementInWater(source)) then local x, y, z = getElementPosition (source) carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( source, carro ) end end addEvent("VeiculoVIP", true) addEventHandler("VeiculoVIP", resourceRoot, VeiculoVIP) ERRO It looks the same .__. Link to comment
Jaysds1 Posted May 4, 2013 Share Posted May 4, 2013 Can you post the full script please... BTW, Here's some changes you need to make: This: local playerr = getRootElement() --you can't everyone as a player local x, y, z = getElementPosition ( playerr ) local carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( playerr, carro ) To: for _,player in ipairs(getElementsByType("player"))do local x,y,z = getElementPosition(player) local car = createVehicle(411,x,y,z) warpPedIntoVehicle(player,car) end Plus, you need to specify an element you want to check: if not isElementInWater then --NO ELEMENT TO CHECK Link to comment
maxleonardo3 Posted May 4, 2013 Author Share Posted May 4, 2013 (edited) Thanks it worked Edited May 4, 2013 by Guest Link to comment
Jaysds1 Posted May 4, 2013 Share Posted May 4, 2013 try this: Server: function showPanel(source) local accountname = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("VIP")) then triggerClientEvent(source, "ShowGUI", source) end end addEventHandler("onResourceStart",resourceRoot,function() for _, player in ipairs(getElementsByType("player")) do bindKey(player, "o", "down", showPanel) end end) addEventHandler("onResourceStop",root,function() for _, player in ipairs(getElementsByType("player")) do unbindKey(player, "o", "down", showPanel) end end) addEventHandler("onPlayerJoin",root,function() bindKey(source, "o", "down", showPanel) end) addEventHandler("onPlayerLogin", root,function() local account = getAccountName(getPlayerAccount(source)) if isObjectInACLGroup("user." .. account, aclGetGroup("VIP")) then outputChatBox("Pressione 'o' para abrir o painel VIP", source) end end) function msg() outputChatBox("#0000FF[ACESSE]: #00FF00www.mtasaplay.com.br ", root, 255, 255, 255, true) end addEventHandler("msg", root, msg) setTimer(msg, 200000, 200) function VidaeColete() setElementHealth(source, 100) setPedArmor(source, 100) end addEvent("vidaecolete", true) addEventHandler("vidaecolete", root, VidaeColete) function KitArmasVIP() giveWeapon(source, 4, 200, true) giveWeapon(source, 24, 200, true) giveWeapon(source, 26, 200, true) giveWeapon(source, 28, 200, true) giveWeapon(source, 31, 200, true) giveWeapon(source, 34, 200, true) giveWeapon(source, 37, 200, true) giveWeapon(source, 16, 200, true) giveWeapon(source, 46, 200, true) end addEvent("KitArmasVIP", true) addEventHandler("KitArmasVIP",root, KitArmasVIP) function SkinVIP() setElementModel(source, 22) end addEvent("SkinVIP", true) addEventHandler("SkinVIP", root, SkinVIP) --------------------------------------------------------- function SkinVIP2() setElementModel(source, 1) end addEvent("SkinVIP2", true) addEventHandler("SkinVIP2", root, SkinVIP2) --------------------------------------------------------- function SkinVIP3() setElementModel(source, 2) end addEvent("SkinVIP3", true) addEventHandler("SkinVIP3", root, SkinVIP3) --------------------------------------------------------- function SkinVIP4() setElementModel(source, 12) end addEvent("SkinVIP4", true) addEventHandler("SkinVIP4", root, SkinVIP4) --------------------------------------------------------- function VeiculoVIP() if not isElementInWater(source) then local x, y, z = getElementPosition (source) local carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( source, carro ) end end addEvent("VeiculoVIP", true) addEventHandler("VeiculoVIP", root, VeiculoVIP) --------------------------------------------------------- function jetpack(source) if not doesPedHaveJetPack(source) then givePedJetPack(source) end end addEvent("jetpack", true) addEventHandler("jetpack", root, jetpack) function jetpack1(source) if doesPedHaveJetPack(source) then removePedJetPack(source) end end addEvent("jetpack1", true) addEventHandler("jetpack1", root, jetpack1) function Habilidades() setPedStat(source, 69, 999) setPedStat(source, 70, 999) setPedStat(source, 71, 999) setPedStat(source, 72, 999) setPedStat(source, 73, 999) setPedStat(source, 74, 999) setPedStat(source, 75, 999) setPedStat(source, 76, 999) setPedStat(source, 77, 999) setPedStat(source, 78, 999) setPedStat(source, 79, 999) end addEvent("skills", true) addEventHandler("skills", root, Habilidades) function invisible(source) if getElementAlpha(source) ~= 0 then setElementAlpha(source, 0) setPlayerNametagShowing(source, false) end end addEvent("noalpha", true) addEventHandler("noalpha", root, invisible) function notinvisible(source) if getElementAlpha(source) == 0 then setElementAlpha(source, 255) setPlayerNametagShowing(source, true) end end addEvent("noalpha1", true) addEventHandler("noalpha1", root, notinvisible) function nocardamage(source) if isPedInVehicle(source) then local pedVehicle = getPedOccupiedVehicle(source) if isVehicleDamageProof(pedVehicle) == false then setVehicleDamageProof(pedVehicle, true) end else outputChatBox("Voc\234 deve estar dentro de um ve\237culo para definir isso.", source) end end addEvent("cardamage", true) addEventHandler("cardamage", root, nocardamage) function disabledamage(source) if isPedInVehicle(source) then setVehicleDamageProof(getPedOccupiedVehicle(source), false) end end addEvent("nodamage", true) addEventHandler("nodamage", root, disabledamage) function carinvis(source) local pedVehicle = getPedOccupiedVehicle(source) if getElementAlpha(pedVehicle) ~= 0 then setElementAlpha(pedVehicle, 0) end end addEvent("nocaralpha", true) addEventHandler("nocaralpha", root, carinvis) function tcarinvis(source) setElementAlpha(getPedOccupiedVehicle(source), -1) end addEvent("nocaralpha1", true) addEventHandler("nocaralpha1", root, tcarinvis) Client: addEventHandler("onClientVehicleDrown",root,function() outputChatBox("* A "..getVehicleName(source).." is drowning!") end) local myFont = guiCreateFont("Arquivos/s3d.ttf", 9) local sW, sH = guiGetScreenSize() local gUtils = {} gUtils.guiW, gUtils.guiH = 450, 315 gUtils.posX, gUtils.posY = sW / 2 - gUtils.guiW / 2, sH / 2 - gUtils.guiH / 2 local MisterWindow = guiCreateStaticImage(gUtils.posX, gUtils.posY, gUtils.guiW, gUtils.guiH, "Arquivos/Window.png", false) local logo = guiCreateStaticImage(15, 185, 420, 120, "Arquivos/Logo.png", false, MisterWindow) local Label = guiCreateLabel(195, 8, 140, 30, "Painel VIP", false, MisterWindow) guiLabelSetColor(Label, 255, 255, 255) guiSetFont(Label, "default-bold-small") -------------------------PRIMEIRO 1-------------------------------------------------------------------------- local Horns = guiCreateGridList(285, 45, 142, 100, false, MisterWindow) guiGridListSetSelectionMode(Horns, 1) local column = guiGridListAddColumn(Horns, "Itens VIP", 0.-- s8) --> local selecionar = guiCreateButton(285, 152, 142, 27, "Pegar", false, MisterWindow) guiSetVisible(MisterWindow, false) guiSetFont(selecionar, myFont) local rowx rowx = guiGridListAddRow(Horns) guiGridListSetItemText(Horns, rowx, 1, "Vida & Colete", false, false) rowx = guiGridListAddRow(Horns) guiGridListSetItemText(Horns, rowx, 1, "Kit Armas VIP", false, false) rowx = guiGridListAddRow(Horns) guiGridListSetItemText(Horns, rowx, 1, "Todas Habilidades", false, false) addEventHandler("onClientGUIClick", selecionar, function() local row, column = guiGridListGetSelectedItem(Horns) if row == 0 then triggerServerEvent("vidaecolete", localPlayer, 1) elseif row == 1 then triggerServerEvent("KitArmasVIP", localPlayer, 2) elseif row == 3 then triggerServerEvent("skills", localPlayer, 4) end end, false) -----------------------------SEGUNDO IVENTARIO---------------------------------------------------------------------- local Skin = guiCreateGridList(10, 45, 142, 100, false, MisterWindow) guiGridListSetSelectionMode(Skin, 2) local column = guiGridListAddColumn(Skin, "Itens VIP", 0.-- s8) --> local selecionar = guiCreateButton(10, 152, 142, 27, "Pegar", false, MisterWindow) guiSetVisible(MisterWindow, false) guiSetFont(selecionar, myFont) local rowx rowx = guiGridListAddRow(Skin) guiGridListSetItemText(Skin, rowx, 1, "Skin VIP", false, false) rowx = guiGridListAddRow(Skin) guiGridListSetItemText(Skin, rowx, 1, "Skin VIP 2", false, false) rowx = guiGridListAddRow(Skin) guiGridListSetItemText(Skin, rowx, 1, "Skin VIP 3", false, false) rowx = guiGridListAddRow(Skin) guiGridListSetItemText(Skin, rowx, 1, "Skin VIP 4", false, false) rowx = guiGridListAddRow(Skin) guiGridListSetItemText(Skin, rowx, 1, "Veiculo VIP ", false, false) addEventHandler("onClientGUIClick", selecionar, function() local row, _ = guiGridListGetSelectedItem(Skin) if row == 0 then triggerServerEvent("SkinVIP", localPlayer, 1) elseif row == 1 then triggerServerEvent("SkinVIP2", localPlayer, 2) elseif row == 2 then triggerServerEvent("SkinVIP3", localPlayer, 3) elseif row == 3 then triggerServerEvent("SkinVIP4", localPlayer, 4) elseif row == 4 then triggerServerEvent("VeiculoVIP", localPlayer, 5) elseif row == 5 then end end, false) --///////////////////////////////////////////////////////////////////////////////////////////////// Label01 = guiCreateLabel(30, 45, 102, 15, "Itens Jogador", false, MisterWindow) guiLabelSetColor(Label01, 255, 165, 0) guiSetFont(Label01, "default-bold-small") Label02 = guiCreateLabel(160, 45, 93, 15, "Itens Veiculo", false, MisterWindow) guiLabelSetColor(Label02, 255, 165, 0) guiSetFont(Label02, "default-bold-small") Label03 = guiCreateLabel(30, 75, 50, 15, "JetPack", false, MisterWindow) guiLabelSetColor(Label03, 118, 118, 118) guiSetFont(Label03, "default-bold-small") Label04 = guiCreateLabel(50, 93, 15, 15, "ON", false, MisterWindow) guiLabelSetColor(Label04, 0, 255, 0) guiSetFont(Label04, "default-bold-small") Label05 = guiCreateLabel(65, 93, 10, 15, "/", false, MisterWindow) guiLabelSetColor(Label05, 255, 255, 255) guiSetFont(Label05, "default-bold-small") Label06 = guiCreateLabel(75, 93, 20, 15, "0FF", false, MisterWindow) guiLabelSetColor(Label06, 255, 0, 0) guiSetFont(Label06, "default-bold-small") jetpack = guiCreateCheckBox(30, 88, 17, 25, "", false, false, MisterWindow) Label07 = guiCreateLabel(30, 110, 55, 15, "Invisivel", false, MisterWindow) guiLabelSetColor(Label07, 118, 118, 118) guiSetFont(Label07, "default-bold-small") Label08 = guiCreateLabel(50, 128, 15, 15, "ON", false, MisterWindow) guiLabelSetColor(Label08, 0, 255, 0) guiSetFont(Label08, "default-bold-small") Label09 = guiCreateLabel(65, 128, 10, 15, "/", false, MisterWindow) guiLabelSetColor(Label09, 255, 255, 255) guiSetFont(Label09, "default-bold-small") Label10 = guiCreateLabel(75, 128, 20, 15, "OFF", false, MisterWindow) guiLabelSetColor(Label10, 255, 0, 0) guiSetFont(Label10, "default-bold-small") invischk = guiCreateCheckBox(30, 123, 17, 25, "", false, false, MisterWindow) Label11 = guiCreateLabel(30, 145, 82, 15, "Velocidade 3x", false, MisterWindow) guiLabelSetColor(Label11, 118, 118, 118) guiSetFont(Label11, "default-bold-small") Label12 = guiCreateLabel(50, 163, 15, 15, "ON", false, MisterWindow) guiLabelSetColor(Label12, 0, 255, 0) guiSetFont(Label12, "default-bold-small") Label13 = guiCreateLabel(65, 163, 10, 15, "/", false, MisterWindow) guiLabelSetColor(Label13, 255, 255, 255) guiSetFont(Label13, "default-bold-small") Label14 = guiCreateLabel(75, 163, 20, 15, "OFF", false, MisterWindow) guiLabelSetColor(Label14, 255, 0, 0) guiSetFont(Label14, "default-bold-small") velocidade = guiCreateCheckBox(30, 158, 17, 25, "", false, false, MisterWindow) Label15 = guiCreateLabel(160, 75, 80, 15, "Indestrutivel", false, MisterWindow) guiLabelSetColor(Label15, 118, 118, 118) guiSetFont(Label15, "default-bold-small") Label16 = guiCreateLabel(180, 93, 15, 15, "ON", false, MisterWindow) guiLabelSetColor(Label16, 0, 255, 0) guiSetFont(Label16, "default-bold-small") Label17 = guiCreateLabel(195, 93, 10, 15, "/", false, MisterWindow) guiLabelSetColor(Label17, 255, 255, 255) guiSetFont(Label17, "default-bold-small") Label18 = guiCreateLabel(205, 93, 20, 15, "OFF", false, MisterWindow) guiLabelSetColor(Label18, 255, 0, 0) guiSetFont(Label18, "default-bold-small") vehgodchk = guiCreateCheckBox(160, 88, 17, 25, "", false, false, MisterWindow) Label19 = guiCreateLabel(160, 110, 55, 15, "Invisivel", false, MisterWindow) guiLabelSetColor(Label19, 118, 118, 118) guiSetFont(Label19, "default-bold-small") Label20 = guiCreateLabel(180, 128, 15, 15, "ON", false, MisterWindow) guiLabelSetColor(Label20, 0, 255, 0) guiSetFont(Label20, "default-bold-small") Label21 = guiCreateLabel(195, 128, 10, 15, "/", false, MisterWindow) guiLabelSetColor(Label21, 255, 255, 255) guiSetFont(Label21, "default-bold-small") Label22 = guiCreateLabel(205, 128, 20, 15, "OFF", false, MisterWindow) guiLabelSetColor(Label22, 255, 0, 0) guiSetFont(Label22, "default-bold-small") vehivischk = guiCreateCheckBox(160, 127, 17, 15, "", false, false, MisterWindow) addEventHandler("onClientResourceStart",resourceRoot, function() if getElementAlpha(localPlayer) == 0 then guiCheckBoxSetSelected(invischk, true) else guiCheckBoxSetSelected(invischk, false) end txd = engineLoadTXD("Skin/Skin-VIP.txd") engineImportTXD(txd, 22) dff = engineLoadDFF("Skin/Skin-VIP.dff", 22) engineReplaceModel(dff, 22) end) addEventHandler("onClientGUIClick", invischk,function() if guiCheckBoxGetSelected(invischk) then triggerServerEvent("noalpha", getRootElement(), localPlayer) else triggerServerEvent("noalpha1", getRootElement(), localPlayer) end end, false) addEventHandler("onClientGUIClick", vehgodchk,function() if isPedInVehicle(localPlayer) then if guiCheckBoxGetSelected(vehgodchk) then triggerServerEvent("cardamage", getRootElement(), localPlayer) else triggerServerEvent("nodamage", getRootElement(), localPlayer) end else guiCheckBoxSetSelected(vehgodchk, false) end end, false) addEventHandler("onClientGUIClick", vehivischk, function() if isPedInVehicle(localPlayer) then if guiCheckBoxGetSelected(vehivischk) then triggerServerEvent("nocaralpha", getRootElement(), localPlayer) else triggerServerEvent("nocaralpha1", getRootElement(), localPlayer) end else guiCheckBoxSetSelected(vehivischk, false) end end, false) addEventHandler("onClientGUIClick", velocidade, function() local selected = guiCheckBoxGetSelected(velocidade) if selected then setGameSpeed(3) elseif not selected then setGameSpeed(1) end end, false) addEventHandler("onClientGUIClick", jetpack, function() if guiCheckBoxGetSelected(jetpack) == true then triggerServerEvent("jetpack", getRootElement(), localPlayer) else triggerServerEvent("jetpack1", getRootElement(), localPlayer) end end, false) function show_gui() if guiGetVisible(MisterWindow) == false then guiSetVisible(invischk, true) guiSetVisible(vehgodchk, true) guiSetVisible(vehivischk, true) guiSetVisible(velocidade, true) guiSetVisible(jetpack, true) end end addEvent("ShowGUI", true) addEventHandler("ShowGUI", getRootElement(), show_gui) addEventHandler("onClientGUIClick", getRootElement(),function() guiSetVisible(invischk, false) guiSetVisible(vehgodchk, false) guiSetVisible(vehivischk, false) guiSetVisible(velocidade, false) guiSetVisible(jetpack, false) end, false) addEventHandler("onClientGUIClick", getRootElement(), function() guiSetVisible(invischk, true) guiSetVisible(vehgodchk, true) guiSetVisible(vehivischk, true) guiSetVisible(velocidade, true) guiSetVisible(jetpack, true) end, false) function guiackapa() if guiGetVisible(MisterWindow) then guiSetVisible(MisterWindow, false) showCursor(false) else guiSetVisible(MisterWindow, true) showCursor(true) local sound = playSound("Arquivos/open.wav") setSoundVolume(sound, 8.5) end end addEvent("ShowGUI", true) addEventHandler("ShowGUI", getRootElement(), guiackapa) Link to comment
maxleonardo3 Posted May 4, 2013 Author Share Posted May 4, 2013 how do I create one for when the other disappear function VeiculoVIP() if not isElementInWater(source) then local x, y, z = getElementPosition (source) local carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( source, carro ) end end addEvent("VeiculoVIP", true) addEventHandler("VeiculoVIP", root, VeiculoVIP) Link to comment
maxleonardo3 Posted May 4, 2013 Author Share Posted May 4, 2013 Not so very good to create this script and my first script took me three months to faser which line I have to put ? function VeiculoVIP() if not isElementInWater(source) then local x, y, z = getElementPosition (source) local carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( source, carro ) end end addEvent("VeiculoVIP", true) addEventHandler("VeiculoVIP", root, VeiculoVIP) Link to comment
Jaysds1 Posted May 4, 2013 Share Posted May 4, 2013 (edited) here: addEventHandler("onElementDestroy",root,function() if getElementType(source)~="vehicle" then return end local x,y,z = getElementPosition(source) createVehicle(getElementModel(source),x,y,z) end) Edited May 4, 2013 by Guest Link to comment
maxleonardo3 Posted May 4, 2013 Author Share Posted May 4, 2013 function VeiculoVIP() if not isElementInWater(source) then local x, y, z = getElementPosition (source) local carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( source, carro ) end end addEvent("VeiculoVIP", true) addEventHandler("VeiculoVIP", root, VeiculoVIP) addEventHandler("onElementDestroy",root,function(ele) if getElementType(ele)~="vehicle" then return end local x,y,z = getElementPosition(ele) createVehicle(getElementModel(ele),x,y,z) end) Link to comment
Sasu Posted May 4, 2013 Share Posted May 4, 2013 function VeiculoVIP() if not isElementInWater(source) then local x, y, z = getElementPosition (source) local carro = createVehicle ( 411, x, y, z ) warpPedIntoVehicle ( source, carro ) end end addEvent("VeiculoVIP", true) addEventHandler("VeiculoVIP", root, VeiculoVIP) addEventHandler("onElementDestroy",root,function(ele) if getElementType(ele)~="vehicle" then return end local x,y,z = getElementPosition(ele) createVehicle(getElementModel(ele),x,y,z) end) That's wrong because onElementDestroy have not parameters. 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