Jump to content

zocken212

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by zocken212

  1. I don't know if this is allowed,but: When I create the object in the colshape directly, it gets destroyed. If I move it attached into the colshape and detach it there or above it, nothing happends??
  2. Debugscript 3 says nothing, colshape is still intact. Maybe the error is because the object it attached to another object?
  3. Ehm lol. First time I tried it worked, but then I tried it again and it stopped working?? The object seems deleted, but is still visible?
  4. Hey, again a problem from my side (._.). This time I have a problem with checking if there is an object in the colshape. When I move the object to the marker (where the colshape is as well) nothing happends. Here is the code of checking if there is an object: setTimer(function() local shape1 = getElementsWithinColShape(moneyShape1) for index, p in ipairs(shape1) do if getElementModel(p) == 2935 or 2934 then destroyElement(p) end end end,50,0)
  5. Ah ok, thanks. Is there another way to detect an element if it hits an element?
  6. I don't get it even after 5 times of reading. Could someone make an example? Would be helpful.
  7. It does. I'm controlling the object with W,A,S,D, pgup and pgdown.
  8. Hey, I want to detect a created element if it's hit a marker. The element which should hit the marker is moving with moveObject, but when the element hits the marker nothing happends. -- Creates the marker local container1marker = createMarker(2835.4645996094,-2385.0695800781,15.442111968994,"cylinder",1,0,255,0) -- The function for the event function onElementMarkerHit(hitElement,_) if source == container1marker then if getElementType(hitElement) == "object" then outputChatBox("test") end end end addEventHandler("onMarkerHit",getRootElement(),onElementMarkerHit) What's wrong there? (Debugscript says nothing before you ask)
  9. Thank you, it works. But the ship looks somehow not like it should be. The end is at the front, all parts are almost under the water and so on???
  10. I removed that attachElements, but still no object is appearing...
  11. Yea, I mean the shipparts. Also the shader is not appearing.
  12. Debugscript 3 says nothing... No error, forgotten ( or )...
  13. Hey, I have a problem with createObject.I don't know why it doesn't work in this script, but in all other scripts it works.. lolwut function onResourceStartDoThis() local leadShader = createObject(8838,2948.1564941406,-3046.544921875,-10.287460327148,0,0,91.007263183594) local shipParts1 = createObject(5167,2954.525390625,-3013.8371582031,8.9695568084717,0,0,90) local shipParts2 = createObject(5160,2954.525390625,-3015.7006835938,8.9695568084717,0,0,90) local shipParts3 = createObject(5166,2954.5446777344,-3015.7026367188,8.9695568084717,0,0,90) local shipParts4 = createObject(5158,2946.6257324219,-3159.0061035156,15.628360748291,0,0,180) local shipParts5 = createObject(5155,2946.4465332031,-3135.0407714844,24.955896377563,0,0,90) local shipParts6 = createObject(5156,2946.4440917969,-3071.3764648438,14.663120269775,0,0,90) local shipParts7 = createObject(5154,2946.544921875,-3046.2358398438,19.418611526489,0,0,90) local shipParts8 = createObject(5157,2946.4467773438,-2962.5090332031,20.719650268555,0,0,90) attachElements(shipParts1,leadShader) attachElements(shipParts2,leadShader) attachElements(shipParts3,leadShader) attachElements(shipParts4,leadShader) attachElements(shipParts5,leadShader) attachElements(shipParts6,leadShader) attachElements(shipParts7,leadShader) attachElements(shipParts8,leadShader) end addEventHandler("onResourceStart",getResourceRootElement(),onResourceStartDoThis) That's the current script, serverside.
  14. Hey. I have a problem with ipairs: It should look up if there is already one element with a specific data. As long as only one player is on the server it works fine but when 2 are there, it always takes an other element as I want ... addEvent("checkPresidentServer",true) addEventHandler("checkPresidentServer",getRootElement(), function () for index, p in ipairs(getElementsByType("player")) do local element = getElementData(p,"president") if element == "True" then triggerClientEvent(source,"setPresidentToFalse",getRootElement()) elseif element == "False" then triggerClientEvent(source,"setPresidentToTrue",getRootElement()) end end end) It's always set to "setPresidentToTrue", also when there is a president.. EDIT: It's working right now, I placed a "return" below triggerClientEvent(source,"setPresidentToFalse",getRootElement())
  15. addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()), function () addEventHandler("onClientRender",getRootElement(), function () local x,y = guiGetScreenSize() dxDrawText("PTP 0.12 BETA", x*0.75,y*0.9, 1270, 923, tocolor(255, 255, 255, 255), 2.00, "pricedown", "left", "top", false, false, true, false, false) end); end); addEvent("setPlayersCamera",true); addEventHandler("setPlayersCamera",getRootElement(), function () local matrix = setCameraMatrix(1572.1561279297,-1808.7569580078,76.464111328125,1475.1350097656,-1677.6148681641,13.301302909851); setTimer(getRandomCameraPos,10000,1); setTime(5,30); setWeather(1); setCloudsEnabled(false); showCursor(true); end); function getRandomCameraPos() if getElementData(getLocalPlayer(),"login") == "notLoggedIn" then local randomPos = math.random(5) if randomPos == 1 then setCameraMatrix(1028.6870117188,-2036.8507080078,109.07088470459,1172.0684814453,-2036.7298583984,68.401649475098); setTime(5,30); setTimer(getRandomCameraPos,10000,1); elseif randomPos == 2 then setCameraMatrix(220.54316711426,-2030.2954101563,46.9792137146,134.67477416992,-1884.3803710938,2.1879935264587); setTime(5,30); setTimer(getRandomCameraPos,10000,1); elseif randomPos == 3 then setCameraMatrix(1931.7719726563,1192.240234375,97.54972076416,2142.6896972656,1271.0296630859,15.921746253967); setTime(5,30); setTimer(getRandomCameraPos,10000,1); elseif randomPos == 4 then setCameraMatrix(2131.0710449219,921.58319091797,55.947288513184,2016.5047607422,1038.0780029297,10.486658096313); setTime(5,30); setTimer(getRandomCameraPos,10000,1); elseif randomPos == 5 then setCameraMatrix(1572.1561279297,-1808.7569580078,76.464111328125,1475.1350097656,-1677.6148681641,13.301302909851); setTime(5,30); setTimer(getRandomCameraPos,10000,1); end; end; end; GUIEditor = { tab = {}, tabpanel = {}, edit = {}, button = {}, window = {}, label = {}, checkbox = {} } addEvent("showStartGUI",true); addEventHandler("showStartGUI",getRootElement(), function () local sW,sH = guiGetScreenSize() local lpW,lpH = 263, 295 GUIEditor.window[1] = guiCreateWindow(sW/2-lpW/2, sH/2-lpH/2, lpW, lpH, "Welcome to PTP", false); guiWindowSetSizable(GUIEditor.window[1], false); guiSetAlpha(GUIEditor.window[1], 0.00); GUIEditor.tabpanel[1] = guiCreateTabPanel(9, 25, 244, 356, false, GUIEditor.window[1]); GUIEditor.tab[1] = guiCreateTab("Login", GUIEditor.tabpanel[1]); GUIEditor.edit[1] = guiCreateEdit(7, 49, 227, 34, "", false, GUIEditor.tab[1]); GUIEditor.label[1] = guiCreateLabel(7, 36, 227, 13, "Username", false, GUIEditor.tab[1]); guiSetFont(GUIEditor.label[1], "default-bold-small"); guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false); GUIEditor.label[2] = guiCreateLabel(7, 13, 227, 13, "Please login to have all functions!", false, GUIEditor.tab[1]); guiSetFont(GUIEditor.label[2], "default-bold-small"); guiLabelSetHorizontalAlign(GUIEditor.label[2], "center", false); GUIEditor.edit[2] = guiCreateEdit(7, 107, 227, 34, "", false, GUIEditor.tab[1]); guiEditSetMasked(GUIEditor.edit[2], true); GUIEditor.checkbox[1] = guiCreateCheckBox(7, 42, 15, 15, "", false, false, GUIEditor.edit[2]); GUIEditor.label[3] = guiCreateLabel(7, 93, 227, 13, "Password", false, GUIEditor.tab[1]); guiSetFont(GUIEditor.label[3], "default-bold-small"); guiLabelSetHorizontalAlign(GUIEditor.label[3], "center", false); GUIEditor.checkbox[2] = guiCreateCheckBox(7, 151, 15, 15, "", true, false, GUIEditor.tab[1]); GUIEditor.label[4] = guiCreateLabel(26, 150, 153, 16, "Remember me", false, GUIEditor.tab[1]); guiSetFont(GUIEditor.label[4], "default-bold-small"); GUIEditor.button[1] = guiCreateButton(9, 185, 229, 46, "Login and Play", false, GUIEditor.tab[1]); guiSetFont(GUIEditor.button[1], "default-bold-small"); guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA"); GUIEditor.tab[2] = guiCreateTab("Register", GUIEditor.tabpanel[1]); GUIEditor.label[5] = guiCreateLabel(5, 12, 234, 15, "Username", false, GUIEditor.tab[2]); guiSetFont(GUIEditor.label[5], "default-bold-small"); guiLabelSetHorizontalAlign(GUIEditor.label[5], "center", false); GUIEditor.edit[3] = guiCreateEdit(7, 27, 227, 35, "", false, GUIEditor.tab[2]); GUIEditor.label[6] = guiCreateLabel(5, 72, 234, 15, "Password", false, GUIEditor.tab[2]); guiSetFont(GUIEditor.label[6], "default-bold-small"); guiLabelSetHorizontalAlign(GUIEditor.label[6], "center", false); GUIEditor.edit[4] = guiCreateEdit(7, 87, 227, 35, "", false, GUIEditor.tab[2]); GUIEditor.edit[5] = guiCreateEdit(7, 148, 227, 35, "", false, GUIEditor.tab[2]); GUIEditor.label[7] = guiCreateLabel(5, 132, 234, 15, "Password Confirmation", false, GUIEditor.tab[2]); guiSetFont(GUIEditor.label[7], "default-bold-small"); guiLabelSetHorizontalAlign(GUIEditor.label[7], "center", false); GUIEditor.button[2] = guiCreateButton(11, 191, 218, 42, "Register", false, GUIEditor.tab[2]); guiSetFont(GUIEditor.button[2], "default-bold-small"); guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA"); addEventHandler("onClientGUIClick",GUIEditor.button[1],loginFunctionClient,false); addEventHandler("onClientGUIClick",GUIEditor.button[2],registerFunctionClient,false); guiSetInputEnabled(true); local alpha = 0.00; setTimer(function() alpha = alpha + 0.02; guiSetAlpha(GUIEditor.window[1],alpha); end, 50, 50); end); function loginFunctionClient() local username = guiGetText(GUIEditor.edit[1]); local password = guiGetText(GUIEditor.edit[2]); if string.len(username) >= 4 and string.len(username) <= 36 then if string.len(password) >= 4 and string.len(password) <= 36 then triggerServerEvent("loginIntoAccount",getLocalPlayer(),username,password); saveLoginToXML(); else outputChatBox("#00CC00[PTP]#FFFFFF Invalid password length! Minimum: 4, Maximum: 36 !",0,0,0,true); end; else outputChatBox("#00CC00[PTP]#FFFFFF Invalid username length! Minimum: 4, Maximum: 36 !",0,0,0,true); end; end; function registerFunctionClient() local username = guiGetText(GUIEditor.edit[3]); local password = guiGetText(GUIEditor.edit[4]); local passwordconfirm = guiGetText(GUIEditor.edit[5]); if string.len(username) >= 4 and string.len(username) <= 36 then if string.len(password) >= 4 and string.len(password) <= 36 then if string.len(passwordconfirm) >= 4 and string.len(passwordconfirm) <= 36 then triggerServerEvent("registernewAccount",getLocalPlayer(),username,password,passwordconfirm); else outputChatBox("#00CC00[PTP]#FFFFFF Invalid passwordconfirm length! Minimum: 4, Maximum: 36 !",0,0,0,true); end; else outputChatBox("#00CC00[PTP]#FFFFFF Invalied password length! Minimum: 4, Maximum: 36 !",0,0,0,true); end; else outputChatBox("#00CC00[PTP]#FFFFFF Invalid username length! Minimum: 4, Maximum: 36 !",0,0,0,true); end; end; addEvent("fadeLoginGuiOut",true); addEventHandler("fadeLoginGuiOut",getRootElement(), function() outputChatBox("holiker") local alpha = 1.00; setTimer(function() alpha = alpha - 0.02; guiSetAlpha(GUIEditor.window[1],alpha); end, 50, 50); setTimer(function() destroyElement(GUIEditor.window[1]) fadeCamera(true) end, 3500, 1); triggerServerEvent("spawnPlayerForSkinChange",getLocalPlayer()); end); function saveLoginToXML() local username = guiGetText(GUIEditor.edit[1]); local password = guiGetText(GUIEditor.edit[2]); local xmlFile = xmlLoadFile("accountdata.xml"); if not xmlFile then xmlFile = xmlCreateFile("accountdata.xml","settings"); end; xmlNodeSetAttribute(xmlFile,"username",tostring(username)); xmlNodeSetAttribute(xmlFile,"password",tostring(password)); xmlNodeSetAttribute(xmlFile,"saved","true"); xmlSaveFile(xmlFile); xmlUnloadFile(xmlFile); end; addEvent("showFractionMenu",true); addEventHandler("showFractionMenu",getRootElement(), function () local x, y = guiGetScreenSize() local x2,y2 = 599, 178 PTP_Window_Fraction = guiCreateWindow(x/2-x2/2, 0, x2, y2, "PTP 0.12 BETA Fraction Menu", false) guiWindowSetSizable(PTP_Window_Fraction, false) guiSetAlpha(PTP_Window_Fraction,0.00) guiSetVisible(PTP_Window_Fraction,true) local alpha = 0.00 setTimer(function() alpha = alpha + 0.02 guiSetAlpha(PTP_Window_Fraction, alpha) end, 50, 50) GUIEditor.label[1] = guiCreateLabel(19, 21, 557, 15, "You can choose between different fractions. Please choose your fraction now!", false, PTP_Window_Fraction) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false) GUIEditor.label[2] = guiCreateLabel(203, 50, 100, 15, "President Status:", false, PTP_Window_Fraction) guiSetFont(GUIEditor.label[2], "default-bold-small") GUIEditor.label[3] = guiCreateLabel(181, 65, 122, 15, "Vicepresident Status:", false, PTP_Window_Fraction) guiSetFont(GUIEditor.label[3], "default-bold-small") GUIEditor.label[4] = guiCreateLabel(307, 50, 84, 15, "AVIABLE", false, PTP_Window_Fraction) guiSetFont(GUIEditor.label[4], "default-bold-small") guiLabelSetColor(GUIEditor.label[4], 35, 255, 0) GUIEditor.label[5] = guiCreateLabel(307, 65, 84, 15, "UNAVIABLE", false, PTP_Window_Fraction) guiSetFont(GUIEditor.label[5], "default-bold-small") guiLabelSetColor(GUIEditor.label[5], 248, 6, 6) GUIEditor.button[1] = guiCreateButton(9, 129, 109, 39, "President", false, PTP_Window_Fraction) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") GUIEditor.button[2] = guiCreateButton(128, 129, 109, 39, "Vicepresident", false, PTP_Window_Fraction) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFAAAAAA") GUIEditor.button[3] = guiCreateButton(247, 129, 109, 39, "Security", false, PTP_Window_Fraction) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFAAAAAA") GUIEditor.button[4] = guiCreateButton(366, 129, 109, 39, "Terrorist", false, PTP_Window_Fraction) guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA") GUIEditor.button[5] = guiCreateButton(487, 129, 104, 39, "Civilian", false, PTP_Window_Fraction) guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFAAAAAA") GUIEditor.label[6] = guiCreateLabel(104, 104, 381, 15, "Skin will be randomly picked up!", false, PTP_Window_Fraction) guiSetFont(GUIEditor.label[6], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[6], "center", false) addEventHandler("onClientRender",getRootElement(),checkFraction) showCursor(true) addEventHandler("onClientGUIClick",getRootElement(), function () if source == GUIEditor.button[1] then if guiGetText(GUIEditor.label[4]) == "AVAILABLE" then triggerServerEvent("spawnNewPresident",getLocalPlayer()) elseif guiGetText(GUIEditor.label[4]) == "NOT AVAILABLE" then outputChatBox("#00CC00[PTP]#FFFFFF President is currently not available!",0,0,0,true) end elseif source == GUIEditor.button[2] then if guiGetText(GUIEditor.label[5]) == "AVAILABLE" then -- elseif guiGetText(GUIEditor.label[5]) == "NOT AVAILABLE" then outputChatBox("#00CC00[PTP]#FFFFFF Vicepresident is currently not available!",0,0,0,true) end elseif source == GUIEditor.button[3] then triggerServerEvent("spawnNewSecurity",getLocalPlayer()) elseif source == GUIEditor.button[4] then -- elseif source == GUIEditor.button[5] then -- end end) end); addCommandHandler("skin",function() triggerEvent("showFractionMenu",getLocalPlayer()) end); -- DEBUG
  16. addEvent("spawnNewSecurity",true) addEventHandler("spawnNewSecurity",getRootElement(), function () outputChatBox("#00CC00[PTP]#FFFFFF You spawned as security! Use /job to see your task!",source,0,0,0,true) setElementData(source,"security","True") local number = math.random(11) if number == 1 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setCameraTarget(source) setElementModel(source,165) elseif number == 2 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setCameraTarget(source) setElementModel(source,166) elseif number == 3 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setCameraTarget(source) setElementModel(source,280) elseif number == 4 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setCameraTarget(source) setElementModel(source,281) elseif number == 5 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setCameraTarget(source) setElementModel(source,282) elseif number == 6 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setCameraTarget(source) setElementModel(source,283) elseif number == 7 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setCameraTarget(source) setElementModel(source,284) elseif number == 8 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setCameraTarget(source) setElementModel(source,285) elseif number == 9 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setElementModel(source,286) elseif number == 10 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setCameraTarget(source) setElementModel(source,287) elseif number == 11 then spawnPlayer(source,1133.80859375,-2025.0445556641,69.000610351563,0,180,0) setCameraTarget(source) setElementModel(source,288) end end) This is the serverside code and addEventHandler("onClientGUIClick",getRootElement(), function () if source == Button_Security then triggerServerEvent("spawnNewSecurity",getLocalPlayer()) end end) this is client There is nothing wrong or not?
  17. Hey. I have a problem: When I click the first time on my GUI button, only one message appears. But when I press the second time two messages appears. When I press the third time three messages appears and so on. Is there some way to prevent this? My script has no errors or else.. A screen: http://s14.directupload.net/file/d/3320 ... hi_png.htm Regards
  18. Hallo Ich sehe es immer wieder das Leute ihr Auto während des Fluges nach Oben oder unten lenken kann so das der aufprall winkel anders ist, nun frage ich mich wie ich wärend den fluges das car nach oben oder nach unten mit der schnauze lenke? pls help
×
×
  • Create New...