βurak
Members-
Posts
370 -
Joined
-
Last visited
-
Days Won
21
Everything posted by βurak
-
[HELP] FileWrite not writing after first line
βurak replied to DeletedAccount1111's topic in Scripting
can you try this local pedVoices = {} local pedIds = {} local updateTimer local currentSkinIndex = 0 function configureTable() local skinids = getValidPedModels() for i=1,#skinids do pedIds[skinids[i]] = true end end function writeTableDataToFile() local voiceFile = fileCreate("voices.csv") -- file located mods/deathmatch/resources folder fileWrite(voiceFile, "PEDMODEL, VOICETYPE, VOICENAME;\n") for _,v in pairs(pedVoices) do local formattedData = string.format("%s %s %s;\n", v.model_id, v.voice_type, v.voice_name) fileWrite(voiceFile, formattedData) end fileClose(voiceFile) pedVoices = {} pedIds = {} currentSkinIndex = nil end function setPlayerSkinAndAssignTable() if pedIds[currentSkinIndex] then setElementModel(localPlayer, currentSkinIndex) local voiceType, voiceName = getPedVoice(localPlayer) if voiceType and voiceName then data = {model_id=currentSkinIndex, voice_type=voiceType, voice_name=voiceName} table.insert(pedVoices, data) print(data.model_id, data.voice_type, data.voice_name) else data = {model_id=currentSkinIndex, voice_type="none", voice_name="none"} table.insert(pedVoices, data) print(data.model_id, data.voice_type, data.voice_name) end end if currentSkinIndex == 312 then if isTimer(updateTimer) then killTimer(updateTimer) updateTimer = nil end print("saving finished now writing file...") writeTableDataToFile() return end currentSkinIndex = currentSkinIndex + 1 end addCommandHandler("gv", function() if isTimer(updateTimer) then killTimer(updateTimer) updateTimer = nil end configureTable() updateTimer = setTimer(setPlayerSkinAndAssignTable, 1000, 0) end) -
I think this function takes into account things like the player's video settings and the size of the object, so try to set a low value. from wiki
-
The object ID you use in your code cannot be used in mta, maybe that is why these inconsistencies
-
https://community.multitheftauto.com/index.php?p=resources&s=details&id=1873
-
No, this is a code sample, it will not work directly, you need to edit the admin panel.
-
here is an example onPlayerScreenShot event does not carry who took the screenshot addCommandHandler("takess", function(player,_,targetName) if not targetName then return end local targetPlayer = getPlayerFromName(targetName) if not targetPlayer then return end local isScreenShot = takePlayerScreenShot(targetPlayer, 1920, 1080) if isScreenShot then outputChatBox(getPlayerName(player).." taked screenshot to "..targetName) end end)
-
I'm not sure but check this out https://wiki.multitheftauto.com/wiki/CreateLight
-
Hello, I am adding texture to the models using engineImportTXD, but when I enter the 8th id, no texture is assigned to this model. What is the reason for this? local txd = engineLoadTXD ("burlova_city.txd") engineImportTXD(txd, 1879,1947,1881,1902,1930,1880,1905,1938) --not working local txd = engineLoadTXD ("burlova_city.txd") engineImportTXD(txd, 1938) --working bug image https://ibb.co/2gJRrJm
-
marker = createMarker(2169.62500, -1983.23706, 13.55469, "cylinder", 1) vehicles = {} addEventHandler("onMarkerHit", marker, function(player) vehicles[player] = createVehicle(408, 2169.62500 + 3, -1983.23706, 13.55469) end) addEventHandler("onPlayerQuit", root, function(type) if (type == "Quit") then destroyElement(vehicles[source]) --change player to source end end)
-
you can handle it with toggleControl or showChat toggleControl(player,"chatbox", false) --or showChat(player, false)
-
local lamppostList = { [1126] = true --enter lamp post ids } setTimer( function() local pVeh = getPedOccupiedVehicle(localPlayer) -- Get the players vehicle for i,v in pairs(getElementsByType("object", root, true)) do if (isElement(v)) and (getElementType(v) == "object") and (lamppostList[getElementModel(v)]) then if(pVeh) then setElementCollidableWith(pVeh,v, false) setElementCollidableWith(v,pVeh, false) end end end end, 500, 0) can you try this
-
triggerServerEvent("attemptLogin", resourceRoot, Data[1][1], hashedPass) local passVerified = passwordVerify(passHashFromDB, pass) you are comparing hash to hash this function asks for the password in plain text so don't encrypt it on client side --local hashedPass = passwordHash(Data[1][2], "bcrypt",{}) --this
-
Can you show more of the client side?
-
Change player's skin through the serverevent called from client
βurak replied to DarkStalker30's topic in Scripting
you're welcome -
how can i convert pt unit to mta dx scale unit in photoshop?
-
Change player's skin through the serverevent called from client
βurak replied to DarkStalker30's topic in Scripting
can you show more code setElementDimension(client, 0) setElementData(client, "player.isCharCreator", false) setElementData(client, "player.sex", charTable[4]) if charTable[4] then setPedWalkingStyle(client, 118) else setPedWalkingStyle(client, 129) end setElementData(client, "player.skin", charTable[7]) local skin = tonumber(charTable[7]) --setElementModel(player, skin) --no need this setElementData(client, "player.pame", charTable[8]) setElementData(client, "player.isCharCreator", false) spawnPlayer(client, 233.5927734375, -1278.25, 6.351, -100, skin, 0, 0) --use spawnPlayer skin parameter fadeCamera(client, true) setCameraTarget(client) by the way, you don't need to use setElementModel, spawnPlayer function has skin parameter for it -
Change player's skin through the serverevent called from client
βurak replied to DarkStalker30's topic in Scripting
setElementData(client, "player.isCharCreator", false)--working good setElementData(client, "player.sex", charTable[4])--working good if charTable[4] then setPedWalkingStyle(client, 118)--working too else setPedWalkingStyle(client, 129)--working too end setElementData(client, "player.skin", charTable[7]) print(charTable[7]) --show me what is charTable[7] local skin = tonumber(charTable[7]) setElementModel(client, skin)--didn't work Can you debug the CharTable[7] data -
Change player's skin through the serverevent called from client
βurak replied to DarkStalker30's topic in Scripting
can you show the code -
try this for models https://mtaclub.eu/pcrypt
-
addEventHandler("onClientVehicleEnter", root, function(player) local vehicleID = getElementModel(source) if(vehicleID == 425) then toggleControl("vehicle_fire", false) --rockets toggleControl("vehicle_secondary_fire", false) --hunter's minigun end end ) addEventHandler("onClientVehicleExit", root, function(player) local vehicleID = getElementModel(source) if(vehicleID == 425) then toggleControl("vehicle_fire", true) --rockets toggleControl("vehicle_secondary_fire", true) --hunter's minigun end end ) you can do it this way i didn't test it but
- 1 reply
-
- 1
-
Can you give us the error written in debugscript so that we can help you? or tell what is not working
-
can you show the code and also show the error you got let's see what we can do
-
I think the mysql_connect function may not work properly anymore because it belongs to the old mysql module, it is very old, now try using dbConnect
-
addEvent("startMinerJob", true) function startJob(thePlayer) if not (getElementData(thePlayer, "Jobs") == "miner") then setElementData(thePlayer, "Jobs", "miner") end function plant(thePlayer) if (getElementData(thePlayer, "Jobs") == "miner") then x, y, z = getElementPosition(thePlayer) disx = 611.54028 disy = 878.61017 disz = -42.9609 if (getDistanceBetweenPoints3D(x, y, z, disx, disy, disz) < 90) then outputChatBox("Bomb Planted!", thePlayer, 255, 0, 0) setTimer(function() createExplosion(x, y, z, 10) stone1 = createObject(3930, x+0, y+1, z-0.5) stone2 = createObject(3930, x+1*2, y+3, z-0.5) stone3 = createObject(3930, x+2*2, y+2, z-0.5) stone4 = createObject(3930, x+3*2, y+5, z-0.5) stone5 = createObject(3930, x+4*2, y+4, z-0.5) x1, y1, z1 = getElementPosition(stone1) x2, y2, z2 = getElementPosition(stone2) x3, y3, z3 = getElementPosition(stone3) x4, y4, z4 = getElementPosition(stone4) x5, y5, z5 = getElementPosition(stone5) marker1 = createMarker(x1, y1, z1, "cylinder", 1.0, 0, 0, 0, 0) marker2 = createMarker(x2, y2, z2, "cylinder", 1.0, 0, 0, 0, 0) marker3 = createMarker(x3, y3, z3, "cylinder", 1.0, 0, 0, 0, 0) marker4 = createMarker(x4, y4, z4, "cylinder", 1.0, 0, 0, 0, 0) marker5 = createMarker(x5, y5, z5, "cylinder", 1.0, 0, 0, 0, 0) addEventHandler("onMarkerHit", marker1, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker1) setTimer(function(stone1) destroyElement(stone1) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1,stone1) end) addEventHandler("onMarkerHit", marker2, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker2) setTimer(function(stone2) destroyElement(stone2) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1,stone2) end) addEventHandler("onMarkerHit", marker3, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker3) setTimer(function(stone3) destroyElement(stone3) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1,stone3) end) addEventHandler("onMarkerHit", marker4, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker4) setTimer(function(stone4) destroyElement(stone4) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1,stone4) end) addEventHandler("onMarkerHit", marker5, function(thePlayer) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "FIGHT_B", "FightB_G", -1, false, false, false, false) destroyElement(marker5) setTimer(function(stone5) destroyElement(stone5) setPedFrozen(thePlayer, false) givePlayerMoney(thePlayer, 300) end, 3000, 1, stone5) end) end, 5000, 1) end end end addCommandHandler("plant", plant) end addEventHandler("startMinerJob", root, startJob) --[[ Leave Miner Job Section ]] addEvent("leaveMinerJob", true) function leaveJob(thePlayer) if (getElementData(thePlayer, "Jobs") == "miner") then setElementData(thePlayer, "Jobs", nil) outputChatBox("you leaved miner job!", thePlayer, 0, 255, 0) end end addEventHandler("leaveMinerJob", root, leaveJob) try this