Jump to content

JR10

Retired Staff
  • Posts

    2,947
  • Joined

  • Last visited

Everything posted by JR10

  1. LOL? dude read the topic better next time and he already fixed it.
  2. function main() medicblip = createBlip ( 2036, -1408, 17, 22, 0, 0, 0, 255 ) medicpickup = createPickup (2036, -1408, 17, 3, 1277, 100) end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), main) addEventHandler ("onPickupUse", getRootElement(), function (playerWhoUses) if (source == medicpickup) then giveWeapon (playerWhoUses, 14, 1, true) setElementData (playerWhoUses, "job", "medic") else end end) addEventHandler ("onPlayerDamage", getRootElement(), function(attacker, weapon, bodypart, loss) if (weapon == 15) and getElementData ( attacker, "job" == "medic" )then setElementHealth ( targetPlayer, getElementHealth(targetPlayer) + 10 ) givePlayerMoney ( attacker, 450 ) cancelEvent() else end end
  3. JR10

    Admin panel

    if he got no permission then he wont be able to open the panel and does the admin panel resource is in Admin group?
  4. JR10

    Admin panel

    The resource was long time ago and not updated any more if i'm right.
  5. no this is just an example you should replace 0, 0, 0 with the your coordinates also you might want to lower 10 a bit.
  6. A cube is a collision cuboid you can use it with addEventHandler('onColShapeHit', colShape, onMyColShapeHit) and you should use it to open the garage when a player approches it. example: (another shape function) local myColShape = createColTube(0, 0, 0, 10, 10) addEventHandler('onColShapeHit', myColShape, function(hitElement, dim) if getElementType(hitElement) == 'player' then outputChatBox(getElementName(hitElement)..' has entered the col shape') end end )
  7. Then they modified it which should be easy to someone who have basic skills in lua.
  8. i mean a 10 mintue .
  9. setTimer(function, 600000, 1) a 10 minute timer.
  10. Numberr = 0 --- < how to change this with command ? function EditNumber(pla,cmd,number) Numberr = tonumber(number) setTimer(NumberValue,1000,1) end addCommandHandler("editnumber",EditNumber) function NumberValue(Numberr) outputChatBox("Number is"..tostring(Numberr)) end
  11. JR10

    showElementHealth

    he is not talking about that your function had useless things, i think.
  12. yes i did but your coords are wrong its not ontop of it its inside it. function cadirkur () local x,y,z = getElementPosition(getLocalPlayer()) cadir = createObject(1678,x,y+3,z) addEventHandler('onClientRender', root, Dx) end addCommandHandler("kur",cadirkur) function Dx() local x,y,z = getElementPosition(cadir) local isim = getPlayerName(getLocalPlayer()) local sx,sy = getScreenFromWorldPosition(x,y,z+4) dxDrawText (isim,sx,sy-1) end
  13. JR10

    loginWindow

    here: if username == user and password == apple then should be: if username == 'user' and password == 'apple' then
  14. I tested it and it worked.
  15. function cadirkur () local x,y,z = getElementPosition(getLocalPlayer()) createObject(1678,x,y+3,z) addEventHandler('onClientRender', root, Dx) end addCommandHandler("kur",cadirkur) function Dx() local x,y,z = getElementPosition(getLocalPlayer()) local isim = getPlayerName(getLocalPlayer()) local sx,sy = getScreenFromWorldPosition(x,y,z+1) dxDrawText (isim,sx,sy-1) end
  16. function cadirkur () local x,y,z = getElementPosition(getLocalPlayer()) createObject(1678,x,y+3,z) addEventHandler('onClientRender', root, Dx) end addCommandHandler("kur",cadirkur) function Dx() local x,y,z = getElementPosition(getLocalPlayer()) local isim = getPlayerName(getLocalPlayer()) local sx,sy = getScreenFromWorldPosition(x,y+3,z+3) dxDrawText (isim,sx,sy) end
  17. No, function cadirkur () local x,y,z = getElementPosition(getLocalPlayer()) createObject(1678,x,y+3,z) addEventHandler('onClientRender', root, Dx) end addCommandHandler("kur",cadirkur) function Dx() x,y,z = getElementPosition(getLocalPlayer()) local isim = getPlayerName(getLocalPlayer()) local sx,sy = getScreenFromWorldPosition(x,y+3,z+3) dxDrawText (isim,sx,sy) end
  18. What the error says?? EDIT: it is client i forgot here: function cadirkur () local x,y,z = getElementPosition(getLocalPlayer()) local sx,sy = getScreenFromWorldPosition(x,y+3,z+3) local isim = getPlayerName(getLocalPlayer()) createObject(1678,x,y+3,z) dxDrawText (isim,sx,sy) end addCommandHandler("kur",cadirkur) and the text won't appear beacause it needs to be onClientRender.
  19. No problem, good luck.
  20. JR10

    loginWindow

    The problem is the relative you specified it true while its not : function createLoginWindow() wdwLogin = guiCreateWindow(787,419,187,323,"Login System by Sparrow",false) lblUser = guiCreateLabel(22,40,142,17,"Username ",false,wdwLogin) lblPass = guiCreateLabel(25,167,127,20,"Password",false,wdwLogin) edtUser = guiCreateEdit(21,71,141,32,"",false,wdwLogin) edtPass = guiCreateEdit(23,202,141,32,"",false,wdwLogin) guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) btnLogin = guiCreateButton(31,263,133,41,"Login",false,wdwLogin) guiSetFont(btnLogin,"sa-header") guiSetVisible(wdwLogin, false) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createLoginWindow() outputChatBox("Welcome to MTA:SA Server, please log in.") if (wdwLogin ~= nil) then guiSetVisible (wdwLogin ,true) showCursor(true) guiSetInputEnabled(true) else outputChatBox("An unexpected error was ocurred and the log in Window was not created") end end ) Tested it and it worked.
  21. JR10

    loginWindow

    it's damn obvious function loginHandler(username,password) if username == user and password == apple then if (client) then spawnPlayer(client, 1959.55, -1714.46, 10) setCameraTarget(client, client) outputChatBox("You succesfully logged, your stats will be saved.") end else outPutChatBox("Invalid username and password, please re-connect and try again.",client) end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,loginHandler)
  22. JR10

    loginWindow

    line 3?? post the line.
  23. JR10

    loginWindow

    Try this: function createLoginWindow() wdwLogin = guiCreateWindow(787,419,187,323,"Login System by Sparrow",true) lblUser = guiCreateLabel(22,40,142,17,"Username ",true,wdwLogin) lblPass = guiCreateLabel(25,167,127,20,"Password",true,wdwLogin) edtUser = guiCreateEdit(21,71,141,32,"",true,wdwLogin) edtPass = guiCreateEdit(23,202,141,32,"",true,wdwLogin) guiEditSetMaxLength(edtUser, 50) guiEditSetMaxLength(edtPass, 50) btnLogin = guiCreateButton(31,263,133,41,"Login",true,wdwLogin) guiSetFont(btnLogin,"sa-header") guiSetVisible(wdwLogin, false) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createLoginWindow() outputChatBox("Welcome to MTA:SA Server, please log in.") if (wdwLogin ~= nil) then guiSetVisible (wdwLogin ,true) showCursor(true) guiSetInputEnabled(true) else outputChatBox("An unexpected error was ocurred and the log in Window was not created") end end ) function clientSubmitLogin (button,state) if button =="left" and state == "up" then local username = getGuiText(edtUser) local password =getGuiText(edtPass) if username and password then triggerServerEvent("submitLogin", getRootElement (), username, password) guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) else outputChatBox("Please enter a username and password") end end end
  24. JR10

    FR Gui...

    Ok try this ---------------------------- -------- Icon window ------- ---------------------------- wndIcon = { 'wnd', text = 'Icon Window', width = 250, controls = { { 'lst', id='IconGridList', width=230, height=280, columns={ {text='Icons', attr='name'} }, rows={xml='icons.xml', attrs={'id', 'name'}}, }, {'btn', id='Use', onclick=onDoubleClick}, {'btn', id='Close', closeswindow=true} } } function getIconIDByName(name) for i, v in ipairs(getElementsByType('icon')) do if getElementData(v, 'name') == name then return tonumber(getElementData(v, 'id')) end end end onDoubleClick = function (botton, state) local row, column = guiGridListGetSelectedItem(IconGridList) local text = guiGridListGetItemText(IconGridList, row, column) local icon = getIconIDByName(text) local leaf = createPickup(0, 0, 0, 3, icon) attachElements(leaf, g_Me, 0, 0, 1.5) end
  25. It's possible, you just need to find the row and column then use guiGridListSetItemText EDIT: here is a way of editing one row function updatePlayerStateInGridlist() local rows = guiGridListGetRowCount(gridList) for i=0, rows do if guiGridListGetItemText(gridList, i, 1) == getPlayerName(getLocalPlayer()) then if getElementHealth(getLocalPlayer()) > 0 then guiGridListSetItemText(gridList, i, 2, 'Alive', false, false) else guiGridListSetItemText(gridList, i, 2, 'Dead', false, false) end end end end just set a timer for the function.
×
×
  • Create New...