-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
-- Player on-join function onJoin() fadeCamera(source, true, 5) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) outputChatBox("Welcome to testing server.", source, 255, 255, 255, true) outputChatBox(" ", source, 255, 255, 255, true) setCameraMatrix(source, -1687, 1313, 25, -1529, 1235, 1) setTimer(function() fadeCamera(source, false, 3) end, 6000, 1) setTimer(camera_1, 7000, 1, source) end addEventHandler("onPlayerJoin", getRootElement(), onJoin) -- Camera 1 function camera_1(player) fadeCamera(player, true, 3) setCameraMatrix(player, -1469, 760, 59, -1610, 832, 8 ) setTimer(camera_2, 7000, 1, player) setTimer(function() fadeCamera(player, false, 3) end, 6000, 1) end -- Camera 2 function camera_2(player) fadeCamera(player, true, 3) setCameraMatrix(player, -1852, 1100, 168, -1080, 454, 2) setTimer(camera_1, 7000, 1, player) setTimer(function() fadeCamera(player, false, 3) end, 6000, 1) end
-
function onKill(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then setPlayerWantedLevel ( killer, 3 ) outputChatBox ( getPlayerName ( killer ) .. "#FFFF00Has Kill a Player and Have 3 Stars!!", getRootElement(), 255, 255, 255, true ) end end addEventHandler("onPlayerWasted", getRootElement(), onKill)
-
Can you post the part of the script which executes camera_1 and camera_2?
-
function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement) if (hitElement and getElementType(hitElement) == "object") then destroyElement(hitElement) end end addEventHandler("onClientPlayerWeaponFire", root, onClientPlayerWeaponFireFunc) This should destroy the object you've just shoot at.
-
You're welcome .
-
First, that would be the same, second, you're just copying the code from the wiki, and editing the variable names. My code works perfectly, I've tested it.
-
De nada, espero te funcione (a mi me funciona, pero no lo uso asi).
-
vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } function vehicle(thePlayer, cmd, ...) local vehName = table.concat({...}, " ") local x, y, z = getElementPosition ( thePlayer ) local id = getVehicleModelFromPartName ( vehName ) if id and tonumber(id) then createVehicle ( id, x+3, y+3, z ) end end addCommandHandler("spawnveh", vehicle) function getVehicleModelFromPartName(partName) local model = getVehicleModelFromName(partName) if model then return tonumber(model) else for index, id in ipairs (vehicleIDS) do if (string.find(getVehicleNameFromModel(id), tostring(partName))) then return tonumber(id) end end end end Seems to be working.
-
Yo ya cree esto para SAUR, te dejo el codigo. -- -- c_water.lua -- addEventHandler( "onClientResourceStart", resourceRoot, function() -- Version check if getVersion ().sortable < "1.1.0" then return end -- Create shader myShader, tec = dxCreateShader ( "water.fx" ) if myShader then outputChatBox( "Using technique " .. tec ) -- Set textures local textureVol = dxCreateTexture ( "images/smallnoise3d.dds" ); local textureCube = dxCreateTexture ( "images/cube_env256.dds" ); dxSetShaderValue ( myShader, "microflakeNMapVol_Tex", textureVol ); dxSetShaderValue ( myShader, "showroomMapCube_Tex", textureCube ); enabled = false end end ) function setWaterShaderEnabled(bool) if bool then engineApplyShaderToWorldTexture ( myShader, "waterclear256" ) -- Update water color incase it gets changed by persons unknown waterTimer = setTimer( function() if myShader then local r,g,b,a = getWaterColor() dxSetShaderValue ( myShader, "gWaterColor", r/255, g/255, b/255, a/255 ); end end ,100,0 ) else if isTimer(waterTimer) then killTimer(waterTimer) end engineRemoveShaderFromWorldTexture ( myShader, "waterclear256" ) end enabled = bool end addCommandHandler("shader_water", function () setWaterShaderEnabled(not enabled) end)
-
Run a function in another lua file but within same resource?
Castillo replied to UserAccount3's topic in Scripting
Well, just execute it, if you haven't defined the function as local, then should work. If you want to execute a function from a resource to another then export it with: -- meta.xml: function="functionName" type="functionType" /> and then from the other resource you can do: exports["resourceName"]:functionName() -
"thePlayer" does not exists in your script... function onKill(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then outputChatBox("You killed a player", killer, 255, 255, 255, false) givePlayerMoney(killer, 100) end end addEventHandler("onPlayerWasted", getRootElement(), onKill) This should give $100 to the killer.
-
function onKill(ammo, killer, weapon, bodypart) if (source and getElementType(source) == "player") then outputChatBox("You killed a player", thePlayer, 255, 255, 255, false) end end addEventHandler("onPlayerWasted", getRootElement(), onKill) What I get from what you said is that you want to check if the player/ped you've just killed is a player.
-
The script will not do magic, you must have a function to load the peds from the XML, then you should create a table and store them by a index, or name.
-
What do you mean by put a ped in a XML file? do you mean a value for then create it?
-
By pedestrian you mean a ped that you created via createPed right? if so, then of course, use destroyElement.
-
If you use the vehicle, then you can use the variable with a vehicle element.
-
MTA is Open Source, if we've had to pay to open a server, it would lose A LOT of players I'm sure.
-
If is not there, then you can't.
-
You're using vG (valhalla gaming) scripts, aren't you?
-
Copy my code again, I just noticed you put a wrong name for event handler.
-
function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playerTeam = getPlayerTeam ( source ) if playerTeam then local playerTeam = getTeamName(playerTeam) setAccountData ( playeraccount, "xsrpg.team", playerTeam ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local playerTeam = getAccountData ( playeraccount, "xsrpg.team" ) if ( playerTeam ) then setPlayerTeam ( source, getTeamFromName(playerTeam) ) end end end addEventHandler ( "onPlayerLogin" getRootElement ( ), onPlayerLogin )
-
That's because it got removed, Bmat uploaded a 'new version' which was just a URL to his website.
-
You must create the font first. myFont = dxCreateFont( "myFont.ttf", 20 ) dxDrawText( "dxDrawText", 100, 350, 300, 350, tocolor(255,255,0), 1, myFont )
-
function checkEdit(edit) local text = guiGetText(edit) if not tonumber(text) then return false end local text = tonumber(text) if text < 1 or text < 10 then return true else return false end end Should work.
