-
Posts
2,753 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Captain Cody
-
Never mind, I messed up sorry. Set your server side to this function win(ammo, killer, weapon, bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local H = getElementData(killer, "EXP") or 0 local S = getElementData(killer, "LV") or 0 local noob = getPlayerName(source) local experience = 200 setElementData(killer, "EXP", tonumber(H)+experience) local H = tonumber(H) + experience triggerClientEvent(killer, "onTestExp", killer, experience) local yourExperience = math.ceil (H/1000) local gunExperience = (H/5)/33 setElementData(killer, "LV", yourExperience) setElementData(killer, "experience.rank",tostring(yourExperience)) if gunExperience < 1001 then setElementData(killer, "player.weaponExp",gunExperience) for i=69,79 do setPedStat (killer,i,gunExperience) end end end end end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "LV", getAccountData(account, "LV") or "0") setElementData(source, "EXP", getAccountData(account, "EEXP") or "0") setElementData(source, "player.key", getAccountData(account, "player.key") or "Guest") setElementData(source, "experience.rank", getAccountData(account, "experience.rank") or "Guest") setElementData(source, "player.weaponExp", getAccountData(account, "player.weaponExp")) if gunExperience < 1001 then for i=69,79 do setPedStat (killer,i,gunExperience) end end end addEventHandler ("onPlayerLogin", root, onLogin) function onLogout (_,account) setElementData(source, "LV", 0) setElementData(source, "EXP", 0) setElementData(source, "reputation.point", 0) setElementData(source, "experience.rank", "Newbie") setElementData(source, "player.key", "Guest") end addEventHandler ("onPlayerLogout", root, onLogout) function saveData(thePlayer, theAccount) local theAccount = getPlayerAccount(source) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "LV", getElementData(thePlayer, "LV")) setAccountData (theAccount, "EEXP", getElementData(thePlayer, "EXP")) setAccountData (theAccount, "experience.rank", getElementData(thePlayer, "experience.rank")) setAccountData (theAccount, "player.key", getElementData(thePlayer, "player.key")) setAccountData (theAccount, "player.weaponExp", getElementData(thePlayer, "player.weaponExp")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) ---this is top of me addCommandHandler ( "setxp", function ( thePlayer, _, who, EXP ) if getElementData(thePlayer, "player.key") == "dashty123" then if ( who ) then local EXP = tonumber (EXP) or 0 local ThePlayer = getPlayerFromParticalName ( who ) if ( ThePlayer ) then setElementData( ThePlayer,"EXP",EXP ) outputChatBox("Your XP has been set to "..EXP, ThePlayer, 255, 0, 0, true) else outputChatBox("Couldn't find '"..who.."'", thePlayer, 255, 0, 0, true) end else outputChatBox("Couldn't find '"..who.."'", thePlayer, 255, 0, 0, true) end end end ) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end function outputChange(dataName,oldValue) if getElementType(source) == "player" and dataName == "experience.rank" and oldValue then local newValue = getElementData(source,dataName) outputChatBox("Congratulations you are Rank up #FFFFFF'"..'Just Do it'.."'",source, 255, 0, 0, true) triggerClientEvent(source, "onClientRankUp", source) end end addEventHandler("onElementDataChange",getRootElement(),outputChange) addEventHandler("onPlayerLogin", root, function(_, account) if not getAccountData(account, "player.key") then setElementData(source, "player.key", getAccountName(account)) setAccountData(account, "player.key", getElementData(source, "player.key")) else end end) addEvent("addToTeam", true) addEventHandler("addToTeam", root, function (playername, teamname) local player = getPlayerFromName(playername or "") local team = getTeamFromName(teamname or "") if player and team then local r, g, b = getTeamColor ( team ) setPlayerTeam(player, team) setPlayerNametagColor ( player, r, g, b ) outputChatBox("You have been moved to #FFFFFF"..getTeamName(team).."#FF0000.", player, 255, 0, 0, true) end end) addEvent("kickFromTeam", true) addEventHandler("kickFromTeam", root, function (playername, teamname) local player = getPlayerFromName(playername or "") local team = getTeamFromName(teamname or "") if player and team then local red, green, blue = math.random (50, 255), math.random (50, 255), math.random (50, 255) setPlayerTeam(player, nil) setPlayerNametagColor(player, red, green, blue) outputChatBox("You have been kicked out of the #FFFFFF"..team.."#FF0000.", player, 255, 0, 0, true) end end) addEvent("promotePlayer",true) addEventHandler("promotePlayer",root, function(playername, rank) local player = getPlayerFromName(playername or "") if player then if rank then setElementData(player, "clan.rank", rank) outputChatBox("You have been promoted to a #FFFFFF"..tostring(rank), player, 255, 0, 0, true) end end end) addEvent("DemotePlayer",true) addEventHandler("DemotePlayer",root, function(playername, rank) local player = getPlayerFromName(playername or "") if player then if rank then setElementData(player, "clan.rank", rank) outputChatBox("You have been demoted to a #FFFFFF"..tostring(rank), player, 255, 0, 0, true) end end end) function loopFix( thePlayer, _, who, lossp ) if getElementData(thePlayer, "player.key") == "vievsonic" then if ( who ) then local LossC = tonumber (lossp) or 0 local ThePlayer = getPlayerFromParticalName ( who ) if ( ThePlayer ) then setElementData( ThePlayer,"EXP",LossC ) end end end end addCommandHandler ( "fixbug", loopFix) addEventHandler( 'onPlayerLogin', root, function ( ) local account = getPlayerAccount( source ) if account and not isGuestAccount( account ) then local accountName = getAccountName( account ) if accountName == "dashty123" then aclGroupAddObject (aclGetGroup("Admin"), "user."..accountName) setElementData(source, "ACL", "Lui") end end end ) function RGBToHex(red, green, blue) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255)) then return nil end return string.format("#%.2X%.2X%.2X", red, green, blue) end
-
function win(ammo, killer, weapon, bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local H = getElementData(killer, "EXP") or 0 local S = getElementData(killer, "LV") or 0 local noob = getPlayerName(source) local experience = 200 setElementData(killer, "EXP", tonumber(H)+experience) local H = tonumber(H) + experience triggerClientEvent(killer, "onTestExp", killer, experience) local yourExperience = math.ceil (H/1000) local gunExperience = (H/5)/5 setElementData(killer, "LV", yourExperience) setElementData(killer, "experience.rank",tostring(yourExperience)) if gunExperience < 1001 then for i=69,79 do setPedStat (killer,i,gunExperience) end end end end end Should work, untested.
-
Oh I kind of ignored what your whole plan was. I'll write something later that'll fix it.
-
I'm sorry I wasn't thinking about that at the time, try this local text = "" bindKey ( "backspace", "down", function () if text ~= "" then string.sub ( text, 1, #text - 1 ) end end ) addEventHandler ( "onClientCharacter", root, function ( key ) if not key == "backspace" then text = text .. key end end ) addEventHandler ( "onClientRender", root, function () dxDrawText ( text, 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) end ) -- Updated version of other guys code.
-
Oh sorry try this. local text = {} addEventHandler("onClientCharacter", root, function (c) text[#text+1] = c end ) bindKey("backspace", "down", function () text[#text] = nil end) function getText() local TText = "" for i,v in pairs(text) do local TText = TText..v end return TText end addEventHandler("onClientRender", root, function () dxDrawText(getText(), 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) end )
-
local text = {} addEventHandler("onClientCharacter", root, function (c) text[#text+1] = c end ) bindKey("backspace", "down", function () text[#text] = nil end) function getText() local Text = "" for i,v in pairs(text) do local Text = Text..v end return Text end addEventHandler("onClientRender", root, function () dxDrawText(getText(), 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) end )
-
function win(ammo, killer, weapon, bodypart) if (killer and getElementType(killer) == "player" and killer ~= source) then local H = getElementData(killer, "EXP") or 0 local S = getElementData(killer, "LV") or 0 local noob = getPlayerName(source) local experience = 200 setElementData(killer, "EXP", tonumber(H)+experience) local H = tonumber(H) + experience triggerClientEvent(killer, "onTestExp", killer, experience) local yourExperience = math.ceil (H/1000) setElementData(killer, "LV", yourExperience) setElementData(killer, "experience.rank", "1") end end Divides your experience by one thosand (Seams to be what you were doing) then rounds it up to the nearest whole number.
-
local text = "" addEventHandler("onClientCharacter", root, function (c) text = text..c end ) addEventHandler("onClientRender", root, function () dxDrawText(text, 654, 354, 778, 377, tocolor(255, 255, 255, 255), 1, f2, "left", "top", true, true, true, true, true) end )
-
is this server side or client sided.
-
Yes they are, but some times getLocalPlayer() and localPlayer return different results at times.
-
Can I see the rest of the script, to ensue it's defined correctly.
-
Getting the objects ready to load up into mta is the easy part, making the objects stream in / load correctly is where you will run into issues.
-
Vice city map pictured there is missing no textures, just a few buildings (Not sure why though.) It's just the streaming that's the issue there. And I used a mixture of SanVice and another Conversion (Forgot the name). The new streamer is 100x better then the old one though.
-
I actually have my streamer set up to use the base tables that Scene2Res generates to load the files. (I myself converted a few maps such as vice city and gostown and was tired of manually converting so my recent build uses Scene2Res base. But any ways, the Sceen2Res is an incomplete loader, there's a few things missing that basic screws up map loading and makes it look terrible. Here's a video of an older map conversion I did (Older streamer so not as good) running vice city And here's a more recent look at the streamer (This is still an older one, I've improved it even more. Newer one has even better object loading and mini map / f11 support.
-
To do a map like so, you need a custom streamer, LODs have to be tuned correctly, etc. I have one set up for just this if you're willing to pay for it.
-
Both of my server shut down randomly, message "Killed"
Captain Cody replied to [PXG]Blue's topic in Servers
Can be 1 of three things : #1 Some ones hacking your server #2 A resource is causing it #3 (1, and 2 combined) a back door. -
There's that or you can use setElementData
-
Make sure the image is defined right and what not.
-
Yes you have to convert it.
-
garages = { {14795,4105.1455078125,-1620.6474609375,226.63835144043,180,0,0}, {14795,4105.1455078125,-1620.6474609375,216.1208190918,0,0,0} } markers = { {2066.962890625,-1831.306640625,13.546875}, {1848.5556640625,-1856.2978515625,13.3828125}, {1024.705078125,-1025.365234375,32.1015625}, {-1936.2119140625,243.2685546875,34.4609375}, {-1904.5869140625,282.06640625,41.046875}, {-2426.064453125,1023.9189453125,50.397659301758}, {-1786.8173828125,1212.4912109375,25.125}, {-1420.451171875,2587.189453125,55.84326171875} } for _,g in ipairs(garages) do garage = createObject(g[1],g[2],g[3],g[4],g[5],g[6]) end for _,t in pairs(markers) do marker = createMarker(t[1],t[2],t[3]-1,"cylinder",3,255,255,255,255) addEventHandler("onMarkerHit",marker,onHit) end function onHit(element,dimension) if (getElementType(element) == "vehicle") then setElementPosition(element,4104.921875,-1621.7041015625,211.47169494629) setElementFrozen(element,true) end end
-
Double check it's dimension, interior, make 100% sure there's nothing in debug. Etc
-
ok try this Ped = createPed(280, 1560.900390625, -1680.2060546875, 64.498291015625,0,false) setElementFrozen(Ped, true) setElementDimension(Ped, 3) setElementInterior(Ped, 22) setElementData(Ped, "talk", 1, false) setElementData(Ped, "name", "SGT J. McDonald", false) function popuppdPedMenu() L0_1 = getElementData(localPlayer, "exclusiveGUI") if L0_1 then return end if not _UPVALUE0_ then L0_1 = 200 L1_2 = 150 x,y = guiGetScreenSize() _UPVALUE0_ = guiCreateWindow((x/2)-(L0_1/20),(y/2)-(L1_2/2), L0_1, L1_2, "How can we help you?", false) bPhotos = guiCreateButton(0.05, 0.2, 0.87, 0.2, "I want to report a crime.", true, _UPVALUE0_) addEventHandler("onClientGUIClick", bPhotos, helpButtonFunction, false) bAdvert = guiCreateButton(0.05, 0.5, 0.87, 0.2, "I want to speak to an Officer.", true, _UPVALUE0_) addEventHandler("onClientGUIClick", bAdvert, appointmentButtonFunction, false) bSomethingElse = guiCreateButton(0.05, 0.8, 0.87, 0.2, "I'm fine, thanks.", true, _UPVALUE0_) addEventHandler("onClientGUIClick", bSomethingElse, otherButtonFunction, false) triggerServerEvent("pd:ped:start", getLocalPlayer(), getElementData(_UPVALUE1_, "name")) showCursor(true) end end addEvent("pd:popupPedMenu", true) addEventHandler("pd:popupPedMenu", getRootElement(), popuppdPedMenu) function closepdPedMenu() destroyElement(_UPVALUE0_) _UPVALUE0_ = nil showCursor(false) end function helpButtonFunction() closepdPedMenu() triggerServerEvent("pd:ped:help", getLocalPlayer(), getElementData(_UPVALUE0_, "name")) end function appointmentButtonFunction() closepdPedMenu() triggerServerEvent("pd:ped:appointment", getLocalPlayer(), getElementData(_UPVALUE0_, "name")) end function otherButtonFunction() closepdPedMenu() end Also few things I noticed -- --- UPVALUE0 element data "name" is undefined --- UPVALUE1 Is undefined in general
-
Ok few things, -- First, any thing in debugscript? (Type /debugscript 3) -- Second, can I see the whole code, so I can see if there's anything wrong earlier in the code? -- Third, make sure the cords for where you want the ped are correct.
-
Well I fixed as many as I could find, and cleaned it up lot. L0_0 = createPed(280, 1560.900390625, -1680.2060546875, 64.498291015625) setPedRotation(L0_0, 0) setElementFrozen(L0_0, true) setElementDimension(L0_0, 3) setElementInterior(L0_0, 22) setElementData(L0_0, "talk", 1, false) setElementData(L0_0, "name", "SGT J. McDonald", false) function popuppdPedMenu() L0_1 = getElementData(localPlayer, "exclusiveGUI") if L0_1 then return end if not _UPVALUE0_ then L0_1 = 200 L1_2 = 150 x,y = guiGetScreenSize() _UPVALUE0_ = guiCreateWindow((x/2)-(L0_1/20),(y/2)-(L1_2/2), L0_1, L1_2, "How can we help you?", false) bPhotos = guiCreateButton(0.05, 0.2, 0.87, 0.2, "I want to report a crime.", true, _UPVALUE0_) addEventHandler("onClientGUIClick", bPhotos, helpButtonFunction, false) bAdvert = guiCreateButton(0.05, 0.5, 0.87, 0.2, "I want to speak to an Officer.", true, _UPVALUE0_) addEventHandler("onClientGUIClick", bAdvert, appointmentButtonFunction, false) bSomethingElse = guiCreateButton(0.05, 0.8, 0.87, 0.2, "I'm fine, thanks.", true, _UPVALUE0_) addEventHandler("onClientGUIClick", bSomethingElse, otherButtonFunction, false) triggerServerEvent("pd:ped:start", getLocalPlayer(), getElementData(_UPVALUE1_, "name")) showCursor(true) end end addEvent("pd:popupPedMenu", true) addEventHandler("pd:popupPedMenu", getRootElement(), popuppdPedMenu) function closepdPedMenu() destroyElement(_UPVALUE0_) _UPVALUE0_ = nil showCursor(false) end function helpButtonFunction() closepdPedMenu() triggerServerEvent("pd:ped:help", getLocalPlayer(), getElementData(_UPVALUE0_, "name")) end function appointmentButtonFunction() closepdPedMenu() triggerServerEvent("pd:ped:appointment", getLocalPlayer(), getElementData(_UPVALUE0_, "name")) end function otherButtonFunction() closepdPedMenu() end
-
So many issues I see here, I'm not even sure where to start.
