proracer
Members-
Posts
499 -
Joined
-
Last visited
Everything posted by proracer
-
Dont just say that... Type: " /debugscript 3 " at least to see any errors.
-
Line 15 is wrong. 2nd argument 'row' is not a gui element, you should use gridlist .. so try this. local x,y = getElementPosition(getLocalPlayer()) colshape = createColCircle ( x, y, 20.0 ) playerList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) guiSetVisible(playerList,false) function createPlayerList () -- Create the grid list -- Create a players column in the list local column = guiGridListAddColumn( playerList, "Player", 0.85 ) if ( column ) then -- If the column has been created, fill it with players for id, playeritem in ipairs(getElementsWithinColShape ( colshape, "player" )) do local row = guiGridListAddRow ( playerList ) guiGridListSetItemText ( playerList, row, column, getPlayerName ( playeritem ), false, false ) end addEventHandler ( "onClientGUIClick", playerList, click ) end end addEventHandler ( "onClientResourceStart", getRootElement(), createPlayerList ) function click ( button) if button == "left" and source == playerList then local playerName = guiGridListGetItemText ( playerList, guiGridListGetSelectedItem ( playerList ), 1 ) outputChatBox ( playerName ) function visible () guiSetVisible(playerList,true) showCursor(true) end addCommandHandler("pokaz",visible)
-
Try this.. function addTabStaticsInfect ( attacker, weapon, bodypart, loss ) if weapon == 4 then local getElementKills = getElementData ( attacker, "data.kills" ) or 0 local getElementDeaths = getElementData ( source, "data.deaths" ) or 0 setElementData ( attacker, "data.kills", getElementKills + 1 ) setElementData ( source, "data.deaths", getElementDeaths + 1 ) end end addEventHandler ( "onPlayerDamage", root, addTabStaticsInfect )
-
First argument in setVehicleColor (line 11) should be "veh" not "car".
-
We do not take requests, please learn the language yourself. https://wiki.multitheftauto.com/wiki/Main_Page Try to create some codes and if you have problems you can ask here.
-
Any errors..? Did you try deleting 1st arg in line 3? Just leave empty bracket.
-
Yep, instead of getRootElement you should use resourceRoot
-
You mean this...? function setKills ( thePlayer, commandName ) setPedStat ( thePlayer, 121, 999 ) outputChatBox ( "Your kills are set to '999'", source ) end addCommandHandler ( "kills", setKills )
-
We don't accept requests.Try to write some code otherwise nobody will reply... You can try with functions: moveObject combined with onClientMarkerHit
-
Sorry, I didn't know.Im in LUA for just little more than 1 month.
-
For new txd and dff model there is an example of script on Wiki: https://wiki.multitheftauto.com/wiki/EngineReplaceModel For setWaterColor.. Are you sure that script is correct, where is function name, event handler...? It's pretty weird
-
https://wiki.multitheftauto.com/wiki/CreateMarker https://wiki.multitheftauto.com/wiki/OnClientMarkerHit https://wiki.multitheftauto.com/wiki/CreateElement -- choose some random co-ordinates https://wiki.multitheftauto.com/wiki/AttachElements -- and attach object to a player
-
Change removePlayerFromVehicle to removePedFromVehicle
-
Are you joking or serious?
-
Can you please explain yourself better?
-
If I understand correcty then use: https://wiki.multitheftauto.com/wiki/DxDrawText
-
Can't you read ... ? Read first reply.
-
This is not a request forum. Learn scripting first and try to make some code and test it, if it doesn't work, debug it and see errors. If you still can't figure it out than ask here for help. Anyways, try to look here: https://community.multitheftauto.com/index.php?p=resources
-
Try this... function onPlayerJoinLoadClothes ( ) local acc = getPlayerAccount ( source ) if acc then for i=0,17 do getAccountData(acc, "clothes." .. tostring(i) .. ".texture") getAccountData(acc, "clothes." .. tostring(i) .. ".model") addPedClothes ( source, "clothes." .. tostring(i) .. ".texture", "clothes." .. tostring(i) .. ".texture", i) end end end addEventHandler("onPlayerJoin", root, onPlayerJoinLoadClothes) function onPlayerQuitSaveClothes ( ) local playeracc = getPlayerAccount ( source ) if playeracc then for i=0,17 do local texture, model = getPedClothes ( source ) if texture and model then setAccountData(playeracc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(playeracc, "clothes." .. tostring(i) .. ".model", model) end end end end addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes)
-
function onPlayerJoinLoadClothes ( ) local acc = getPlayerAccount ( source ) if acc then for i=0,17 do local texture, model = getPedClothes ( source ) if texture and model then setAccountData(acc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(acc, "clothes." .. tostring(i) .. ".model", model) end end end addEventHandler("onPlayerJoin", root, onPlayerJoinLoadClothes) function onPlayerQuitSaveClothes ( ) local playeracc = getPlayerAccount ( source ) if playeracc then for i=0,17 do local texture, model = getPedClothes ( source ) if texture and model then setAccountData(playeracc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(playeracc, "clothes." .. tostring(i) .. ".model", model) end end end end addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes)
-
function onPlayerQuitSaveClothes() local playeracc = getPlayerAccount(thePlayer) if playeracc then for i=0,17 do local texture, model = getPedClothes(thePlayer) if texture and model then setAccountData(playeracc, "clothes." .. tostring(i) .. ".texture", texture) setAccountData(playeracc, "clothes." .. tostring(i) .. ".model", model) end end end end addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes)
-
Hello guys, me and my friend have been now working on stats system. It doesn't give any errors. It should give points, cash and set new player's rank if he has specified amount of points. function onPlayerSetData ( ) local playeracc = getPlayerAccount ( source ) if ( playeracc ) then getAccountData ( playeracc, "data.cash" ) getAccountData ( playeracc, "data.points" ) getAccountData ( playeracc, "data.wins" ) getAccountData ( playeracc, "data.rank" ) else local playercash = 0 local playerwins = 0 local playerpoints = 0 local playerrank = "Beginner" setAccountData ( playeracc, "data.cash", playercash ) setAccountData ( playeracc, "data.wins", playerwins ) setAccountData ( playeracc, "data.points", playerpoints) setAccountData ( playeracc, "data.rank", playerrank ) outputChatBox ( "Loading stats for" .. playeracc, root, 0, 252, 255, false ) end end addEventHandler ( "onPlayerLogin", root, onPlayerSetData ) function onPlayerQuitSetData ( ) local playeracc = getPlayerAccount ( source ) if ( playeracc ) then setAccountData ( playeracc, "data.cash", getAccountData ( playeracc, "data.cash" ) ) setAccountData ( playeracc, "data.points", getAccountData ( playeracc, "data.points" ) ) setAccountData ( playeracc, "data.wins", getAccountData ( playeracc, "data.wins" ) ) setAccountData ( playeracc, "data.rank", getAccountData ( playeracc, "data.rank" ) ) end end addEventHandler ( "onPlayerQuit", root, onPlayerQuitSetData ) addEventHandler ( "onPlayerLogout", root, onPlayerQuitSetData ) -- Cash, Points and Rank function onGiveCashAndPtsAndRankToPlayer ( mapInfo ) info = mapInfo.modename if ( info ) == "Destruction derby" then local alivePlayers = getAlivePlayers ( ) if #alivePlayers == 1 then local playeracc = getPlayerAccount ( alivePlayers[1] ) if ( playeracc ) then local Cash1 = getAccountData ( playeracc, "data.cash" ) local Cash2 = 250 * getPlayerCount ( ) local Cash3 = Cash1 + Cash2 local Points1 = getAccountData ( playeracc, "data.points" ) local Points2 = 2 * getPlayerCount ( ) local Points3 = Points1 + Points2 -- Rank 1 if Points1 >= 10 then setAccountData ( playeracc, "data.rank", "Newbie" ) outputChatBox ( playeracc .. " has advanced to a new rank: 'Newbie' ", root, 0, 252, 255, false ) end -- Rank 2 if Points1 >= 25 then setAccountData ( playeracc, "data.rank", "Rookie" ) outputChatBox ( playeracc.. " has advanced to a new rank: 'Rookie' ", root, 0, 252, 255, false ) end -- Rank 3 if Points >= 50 then setAccountData ( playeracc, "data.rank", "Amateur" ) outputChatBox ( playeracc.. " has advanced to a new rank: 'Amateur' ", root, 0, 252, 255, false ) end setAccountData ( playeracc, "data.cash", Cash3 ) setAccountData ( playeracc, "data.points", Points3 ) outputChatBox (alivePlayers[1] .. " got " .. Cash3 " $ for suriving ", root, 0, 252, 255, false ) end end end end addEventHandler ( "onPlayerWasted", root, onGiveCashAndPtsAndRankToPlayer ) -- Public stats function playerStats ( source ) local playeracc = getPlayerAccount ( source ) local playercash = getAccountData ( playeracc, "data.cash" ) or 0 local playerpoints = getAccountData ( playeracc, "data.points" ) or 0 local playerrank = getAccountData ( playeracc, "data.rank" ) or "Beginner" if ( playeracc ) then outputChatBox ( "*" .. getPlayerName ( source ) .. " 's Stats: ", root, 0, 252, 255, false ) outputChatBox ( "* Cash Earned: " .. tonumber ( playercash ) .. " $ ", root, 0, 252, 255, false ) outputChatBox ( "* Points Earned: " .. tonumber ( playerpoints ) .. " Points", root, 0, 252, 255, false ) outputChatBox ( "* Current Rank: " .. playerrank, root, 0, 252, 255, false) end end addCommandHandler ( "stats", playerStats ) Edit: I edited the script a bit but still gives no error...
-
Show us your new code you made, please.
