Jump to content

Anubhav

Members
  • Posts

    2,277
  • Joined

  • Last visited

Everything posted by Anubhav

  1. addCommandHandler("gostaff", function(plr) local staffName = dbPoll(dbQuery(adminDB, "SELECT * FROM staffList WHERE staff=?", getAccountName(getPlayerAccount(plr))), -1) if (not (#staffName == 0)) then local staffNamer = dbPoll(dbQuery(adminDB, "SELECT * FROM adminSaver WHERE acc=?", getAccountName(getPlayerAccount(plr))), -1) if #staffNamer ~= 0 then dbExec(adminDB, "DELETE FROM adminSaver WHERE acc=?", getAccountName(getPlayerAccount(plr))) end local acc, x, y, z, skin, dim, inte = getAccountName(getPlayerAccount(plr)), getElementPosition(plr), getElementModel(plr), getElementDimension(plr), getElementInterior(plr) local r, g, b = getTeamColor(getTeamFromName("Army")) setPlayerNametagColor(plr, r, g, b) setPlayerTeam(plr, getTeamFromName("Army")) setElementModel(plr, 217) setElementData(plr, "isPlayerStaff", true) setElementData(plr, "Occupation", "Staff") outputChatBox("You're now on duty!", plr, 225, 225, 225) exports.killmessages:outputMessage(getPlayerName(plr).." is now on-staff-duty!", root, 0, 255, 0) local t = getTeamName(getPlayerTeam(plr)) dbExec(adminDB, "INSERT INTO adminSaver VALUES(?,?,?,?,?,?,?,?)", acc, x, y, z, skin, dim, inte, tostring(t)) else return end end ) I used this no errors. Now I select it again. addCommandHandler("offduty", function(plr) if getElementData(plr, "isPlayerStaff") then local answer = dbPoll(dbQuery(adminDB,"SELECT * FROM adminSaver WHERE acc=?", getAccountName(getPlayerAccount(plr))), -1) if #answer ~= 0 then fadeCamera( plr, false, 1.0, 0, 0, 0 ) setTimer(fadeCamera, 5000, 1, plr, true ) for k,v in ipairs(answer) do setTimer(spawnPlayer, 5000, 1, plr, v.x, v.y, v.z, 0, v.skin, 0, 0, getTeamFromName(v.teamName or nil) ) end outputChatBox("Now you are off-duty!", plr) exports.killmessages:outputMessage(getPlayerName(plr).." is now off-staff-duty!", root, 0, 255, 0) setElementData(plr, "isPlayerStaff", false) dbExec(adminDB, "DELETE FROM adminSaver WHERE acc=?", getAccountName(getPlayerAccount(plr))) end end end ) No errors, keeps spawning me at same position even If I take another and use /gostaff! Help!
  2. Train @ Come to BoD and I'll show you! EDIT: I fixed it !
  3. Its a nil value then. Check if S exist!
  4. function givePlayerXP(ammo, killer, weapon, bodypart) if ( getElementType (killer) == "player" ) then H = getElementData(killer, "XP") or 0 X = math.random ( 50, 150) setElementData(killer, "XP", tonumber(H)+X) local H = tonumber(H) + X local g_XP = tonumber(H) if g_XP >= pointsToLevel[tonumber(S)+1] then -- line #25 setElementData(killer,"Level",tonumber(S)+1) triggerClientEvent('LevelSound', root ) end if g_XP >= pointsToLevel[D+1] then setElementData(killer,"Rank",D+1) triggerClientEvent('LevelSound', root ) end end end addEventHandler("onPedWasted", getRootElement(), givePlayerXP) addEventHandler ( "onZombieWasted", getRootElement(), givePlayerXP )
  5. addEventHandler("onClientRender", root, function () local Level = getElementData(localPlayer,"Level") or 0 if Level == 0 then dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, ":zGmode/ranks/0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 else local toDraw = string.find(Level, ".png.png") if toDraw then local m = Level:gsub(".png.png", ".png") dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, Level, 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 else outputChatBox("some thing wrong!") end end end )
  6. addEventHandler("onClientRender", root, function () local Level = getElementData(localPlayer,"Level") or 0 if Level == 0 then dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, ":zGmode/ranks/0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 else dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, Level, 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 end ) lol did wrong check -.-
  7. addEventHandler("onClientRender", root, function () local Level = getElementData(localPlayer,"Level") or 0 if Level == 0 then dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, ":zGmode/ranks/0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 else dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, Level, 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 end ) lol did wrong check -.-
  8. addEventHandler("onClientRender", root, function () local Level = getElementData(localPlayer,"Level") or 0 if Level ~= 0 then dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, ":zGmode/ranks/0.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 else dxDrawImage(95*sW, 675*sH, 40*sW, 40*sH, Level, 0, 0, 0, tocolor(255, 255, 255, 255), false) -- Line #20 end )
  9. This should work! exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,40,'Level') function scoreLevel () local account = getPlayerAccount(source) local Level = getElementData(source,"Level") or 0 if isGuestAccount ( account ) then setElementData(source, "Level",":resourceName/ranks/0.png") else setElementData(source, "Level", ":resourceName/ranks/"..tostring(Level)..".png" ) end end addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40) end )
  10. @Joa fix is this: local phonew, phoneh = getPhoneSize() addEvent("onClientClickFirstAccept", true) addEvent("onClientEnableSwitcher", true) addEvent("onClientDisableSwitcher", true) addEvent("onClientRunApplication", true) addEvent("onClientSelectedSettingsPanelElement", true) addEventHandler("onClientResourceStart", root, function(res) if res ~= getThisResource() then return false end mailBox, mailid = createPhoneWindow(tocolor(210, 210, 210), tocolor(210, 210, 210), true, "transparent") mailApp = addApplication("Dialog Box", "applications/mail/mail.png", "FFAA00", 48, 48, function() showWindow(mailid) end) local fide, cpanel = createSettingsPanel(mailid) addSettingsPanelElement(fide, "Remove dialog") local topAppBar = guiCreateStaticImage(0, 0, phonew, 50, "images/element.png", false, mailBox) guiSetProperty(topAppBar, "ImageColours", "tl:FFFFAA00 tr:FFFFAA00 bl:FFFFAA00 br:FFFFAA00") local label = guiCreateLabel(10, 20, 150, 30, "Dialog Box", false, topAppBar) guiLabelSetVerticalAlign(label, "center") guiSetFont(label, guiCreateFont("fonts/medium.ttf", 15)) guiLabelSetColor(label, 250, 250, 250) userBox, userList, LemeNTS = guiCreateStaticGridList(-1, 50, phonew, phoneh-120, false, mailBox) guiSetProperty(userList, "ImageColours", "tl:00CCCCCC tr:00CCCCCC bl:00CCCCCC br:00CCCCCC") guiSetProperty(LemeNTS, "ImageColours", "tl:00CCCCCC tr:00CCCCCC bl:00CCCCCC br:00CCCCCC") usercol = guiStaticGridListAddColumn(userBox, "", 1) addEventHandler("onClientRunApplication", root, function(i) if i == mailApp then checkUsers() end end) local Zbutton = createButton(10, phoneh-40, phonew-20, 30, " Open dialog", "FFAAAAAA", false, mailBox, true) checkUsers() local senderBox, sendid = createPhoneWindow(tocolor(210, 210, 210), tocolor(210, 210, 210), true, "transparent") local topMsgBar = guiCreateStaticImage(0, 0, phonew, 50, "images/element.png", false, senderBox) guiSetProperty(topMsgBar, "ImageColours", "tl:FFFFAA00 tr:FFFFAA00 bl:FFFFAA00 br:FFFFAA00") memoPerepiska = guiCreateMemo(0, 50, phonew, phoneh-75, "", false, senderBox) guiMemoSetReadOnly(memoPerepiska, true) local w1, h1 = guiGetSize(memoPerepiska, false) local ram2 = guiCreateStaticImage(0, 0, 3, h1, "images/element.png", false, memoPerepiska) local ram3 = guiCreateStaticImage(w1-3, 0, 3, h1, "images/element.png", false, memoPerepiska) local ram4 = guiCreateStaticImage(0, h1-3, w1, 3, "images/element.png", false, memoPerepiska) local ram1 = guiCreateStaticImage(0, 0, w1, 5, "images/element.png", false, memoPerepiska) guiSetProperty(ram1, "ImageColours", "tl:FFFFAA00 tr:FFFFAA00 bl:FFFFAA00 br:FFFFAA00") guiSetProperty(ram4, "ImageColours", "tl:FFFFAA00 tr:FFFFAA00 bl:FFFFAA00 br:FFFFAA00") editBox = guiCreateEdit(0, phoneh-25, phonew-30, 25, "", false, senderBox) local w2, h2 = guiGetSize(editBox, false) local rom1 = guiCreateStaticImage(0, 0, w2, 5, "images/element.png", false, editBox) local rom2 = guiCreateStaticImage(0, 0, 3, h2, "images/element.png", false, editBox) local rom3 = guiCreateStaticImage(w2-3, 0, 3, h2, "images/element.png", false, editBox) local rom4 = guiCreateStaticImage(0, h2-3, w2, 3, "images/element.png", false, editBox) local sendButton = createButton(phonew-30, phoneh-25, 30, 25, "Send", "FFFF9100", false, senderBox, true) guiSetFont(sendButton, guiCreateFont("fonts/light.ttf", 9)) guiLabelSetHorizontalAlign(sendButton, "center") guiLabelSetColor(sendButton, 250, 250, 250) local backMsg = createButton(0, 20, 50, 30, "Back", "00787878", false, topMsgBar, true) guiLabelSetVerticalAlign(backMsg, "center") guiLabelSetHorizontalAlign(backMsg, "center") guiSetFont(backMsg, guiCreateFont("fonts/bold.ttf", 12)) guiLabelSetColor(backMsg, 250, 250, 250) local usverName = guiCreateLabel(50, 20, phonew-50, 30, "", false, topMsgBar) guiLabelSetVerticalAlign(usverName, "center") guiLabelSetHorizontalAlign(usverName, "center") guiSetFont(usverName, guiCreateFont("fonts/bold.ttf", 12)) guiLabelSetColor(usverName, 250, 250, 250) addEventHandler("onClientGUIClick", root, function() if getElementType(source) == "gui-edit" or getElementType(source) == "gui-memo" then guiSetInputMode("no_binds") else guiSetInputMode("allow_binds") end end ) local user, usver addEventHandler("onClientGUIClick", Zbutton, function() if source ~= Zbutton then return false end local rw, cl = guiStaticGridListGetSelectedItem(userBox) if rw ~= nil and rw ~= false and rw ~= -1 then guiSetText(memoPerepiska, "") user = getPlayerName(localPlayer) usver = guiStaticGridListGetItemText(userBox, rw, usercol) guiSetText(usverName, usver) triggerServerEvent("getUserDialog", localPlayer, user, usver) local grub, _, _ = guiStaticGridListGetItemColor(userBox, rw, usercol) if grub == 200 then guiStaticGridListSetItemColor(userBox, rw, usercol, 170, 170, 170) end guiStaticGridListSetSelectedItem(userBox, rw, usercol) guiMemoSetCaretIndex(memoPerepiska, string.len(guiGetText(memoPerepiska))) showWindow(sendid, "open") else createPhoneInfo("Item not found") end end, false) addEventHandler("onClientSelectedSettingsPanelElement", root, function(id, text) if id == fide then if text == "Remove dialog" then local rw, cl = guiStaticGridListGetSelectedItem(userBox) if rw ~= nil and rw ~= false and rw ~= -1 then usver = guiStaticGridListGetItemText(userBox, rw, usercol) if usver and getPlayerFromName(usver) ~= nil then triggerServerEvent("removeUserDialog", localPlayer, localPlayer, getPlayerFromName(usver)) guiSetText(memoPerepiska, "") createPhoneInfo("Dialog removed.\nUser: "..usver) else outputShtorka("The user has not selected") end else outputShtorka("The user has not selected") end end end end) addEventHandler("onClientGUIClick", sendButton, function() local rw, cl = guiStaticGridListGetSelectedItem(userBox) if rw ~= nil and rw ~= false and rw ~= -1 and user ~= nil then local fmessaga = guiGetText(editBox) if fmessaga ~= "" and fmessaga ~= " " then if not string.find(guiGetText(memoPerepiska), ":") then zmessaga = string.format("%s: %s", getPlayerName(localPlayer), fmessaga) else zmessaga = guiGetText(memoPerepiska).."\n"..string.format("%s: %s", getPlayerName(localPlayer), fmessaga) end fmessaga = string.format("%s: %s", getPlayerName(localPlayer), fmessaga) triggerServerEvent("onUserSendMessage", localPlayer, user, usver, zmessaga, fmessaga) guiSetText(editBox, "") else createPhoneInfo("Message not entered") end else createPhoneInfo("The user has not selected") end end, false) addEventHandler("onClientGUIAccepted", editBox, function() if source ~= editBox then return false end local rw, cl = guiStaticGridListGetSelectedItem(userBox) if rw ~= nil and rw ~= false and rw ~= -1 and user ~= nil then local fmessaga = guiGetText(editBox) if fmessaga ~= "" and fmessaga ~= " " then if not string.find(guiGetText(memoPerepiska), ":") then zmessaga = string.format("%s: %s", getPlayerName(localPlayer), fmessaga) else zmessaga = guiGetText(memoPerepiska).."\n"..string.format("%s: %s", getPlayerName(localPlayer), fmessaga) end fmessaga = string.format("%s: %s", getPlayerName(localPlayer), fmessaga) triggerServerEvent("onUserSendMessage", localPlayer, user, usver, zmessaga, fmessaga) guiSetText(editBox, "") else createPhoneInfo("Message not entered") end else createPhoneInfo("The user has not selected") end end) addEventHandler("onClientGUIClick", backMsg, function() if source ~= backMsg then return false end hideWindow(sendid, "back") showWindow(mailid) checkUsers() end, false) addEventHandler("onClientMouseEnter", backMsg, function() if source ~= backMsg then return false end guiSetAlpha(backMsg, 0.5) end) addEventHandler("onClientMouseLeave", backMsg, function() if source ~= backMsg then return false end guiSetAlpha(backMsg, 1) end) end) local rowname={} local adduser={} function checkUsers() for xc = 0, guiStaticGridListGetRowCount(userBox) do guiStaticGridListRemoveRow(userBox, xc) end --guiStaticGridListClear(userBox) for i, v in ipairs(getElementsByType("player")) do if localPlayer == v then return end rowname[v] = guiStaticGridListAddRow(userBox) guiStaticGridListSetItemText(userBox, rowname[v], usercol, getPlayerName(v)) guiStaticGridListSetSelectedItem(userBox, 1, usercol) end end addEvent("onClientSelectNotification", true) addEvent("onClientUpdateMessageBox", true) addEventHandler("onClientUpdateMessageBox", root, function(zmsg, usr) if usr ~= nil and usr ~= false then usr = getPlayerName(usr) local rw, _ = guiStaticGridListGetSelectedItem(userBox) if rw ~= nil and rw ~= false and rw ~= -1 then nam = guiStaticGridListGetItemText(userBox, rw, usercol) if tostring(nam) == tostring(usr) then guiSetText(memoPerepiska, zmsg) guiMemoSetCaretIndex(memoPerepiska, string.len(guiGetText(memoPerepiska))) local notz = addNotification("Mail", "You have new message\nFrom: "..usr, nil, "applications/mail/mail.png", 200, 0, 0, true, true) addEventHandler("onClientSelectNotification", root, function(z) if z == notz then showWindow(mailid) end end) else for li = 0, guiStaticGridListGetRowCount(userBox) do if tostring(guiStaticGridListGetItemText(userBox, li, usercol)) == tostring(usr) then local notz = addNotification("Mail", "You have new message\nFrom: "..usr, nil, "applications/mail/mail.png", 200, 0, 0, true, true) addEventHandler("onClientSelectNotification", root, function(z) if z == notz then showWindow(mailid) end end) guiStaticGridListSetItemColor(userBox, li, usercol, 200, 0, 0) end end end else for li = 0, guiStaticGridListGetRowCount(userBox) do if tostring(guiStaticGridListGetItemText(userBox, li, usercol)) == tostring(usr) then local notz = addNotification("Mail", "You have new message\nFrom: "..usr, nil, "applications/mail/mail.png", 200, 0, 0, true, true) addEventHandler("onClientSelectNotification", root, function(z) if z == notz then showWindow(mailid) end end) guiStaticGridListSetItemColor(userBox, li, usercol, 200, 0, 0) end end end guiMemoSetCaretIndex(memoPerepiska, string.len(guiGetText(memoPerepiska))) else guiSetText(memoPerepiska, zmsg) guiMemoSetCaretIndex(memoPerepiska, string.len(guiGetText(memoPerepiska))) end end) addEvent("showInfoAboutMessages", true) addEventHandler("showInfoAboutMessages", root, function() createPhoneInfo("Dialog was not exists") end) function guiCreateQuadMemo(x, y, w1, h1, str, rel, par, c1, c2, c3, c4) if not c1 then c1 = "FFFFFF" end if not c2 then c2 = "FFFFFF" end if not c3 then c3 = "FFFFFF" end if not c4 then c4 = "FFFFFF" end local memo = guiCreateMemo(x, y, w1, h1, str, rel, par) local ram2 = guiCreateStaticImage(0, 0, 3, h1, "images/element.png", false, memo) local ram3 = guiCreateStaticImage(w1-3, 0, 3, h1, "images/element.png", false, memo) local ram4 = guiCreateStaticImage(0, h1-3, w1, 3, "images/element.png", false, memo) local ram1 = guiCreateStaticImage(0, 0, w1, 5, "images/element.png", false, memo) guiSetProperty(ram1, "ImageColours", "tl:FF"..c1.." tr:FF"..c1.." bl:FF"..c1.." br:FF"..c1)
  11. exports.scoreboard:addScoreboardColumn("Level",getRootElement(),1,40,'Level') function scoreLevel () local account = getPlayerAccount(source) local Level = getElementData(source,"Level") or 0 if isGuestAccount ( account ) then setElementData(source, "Level",":resourceName/ranks/0.png") else setElementData(source, "Level", ":resourceName/ranks/"..tostring(Level)..".png" ) end addEventHandler("onPlayerSpawn", getRootElement(), scoreLevel) addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),function() call(getResourceFromName("scoreboard"),"addScoreboardColumn","Level", getRootElement(), 1, 40) end ) end
  12. Exported functions added!
  13. Bonsai, I was doing, but I was with my friend, he told me slowly and I fixed 1 by 1 so deny @ I will add some exports for sure today!
  14. function viivat(race) outputChatBox("3", getRootElement(), 255, 255, 255) playSoundFrontEnd ( race, 43 ) setTimer ( viivat2, 1000, 1, race ) end addCommandHandler("viivat", viivat) function viivat2(racesecond) outputChatBox("2", getRootElement(), 255, 255, 255) playSoundFrontEnd ( racesecond, 43 ) setTimer ( viivat3, 1000, 1, racesecond ) end function viivat3(racethird) outputChatBox("1", getRootElement(), 255, 255, 255) playSoundFrontEnd ( racethird, 43 ) setTimer ( viivat4, 1000, 1, racethird ) end function viivat4(racefinal) outputChatBox("NYT!", getRootElement(), 255, 255, 0) playSoundFrontEnd ( racefinal, 44 ) end
  15. Omg this resource famous! NOTE: THANKS FOR RATING ABOVE 4! <3 Thanks everyone who has rated it and downloaded and loved it! Salute, from Anubhav. Give me ideas to make something.
  16. [lua] addEventHandler("onPlayerVehicleExit", root, function() cancelEvent() end)
  17. I belive race resource uses the same(thing) as I said!(!!!!!!)
  18. onResourceStart and the loop can do the work.
  19. Its obvious, it will draw the last player only!
×
×
  • Create New...