-
Posts
74 -
Joined
-
Last visited
Everything posted by |H|TiTanium
-
It wasn't working, then I tried deleting some spaces between functions and parentheses, and now it works perfectly. Thank you for helping me.
-
Basically when a player presses the "myButton2" button, the three edit boxes should output player's position. Like this: I click on "myButton2" ( which says "Get Pos" ), then the first edit box shows my X cord. the 2nd shows my Y cord, and 3rd shows Z position. Tell me what is wrong please and help me please. function tele() local x = guiGetText ( myEdit2 ) local y = guiGetText ( myEdit3 ) local z = guiGetText ( myEdit4 ) getElementPosition ( localplayer, x, y, z ) guiSetText ( myEdit2, x ) guiSetText ( myEdit3, y ) guiSetText ( myEdit4, z ) end addEventHandler ( "onClientGUIClick", myButton2, tele, false )
-
Basically this thing doesn't work : Probably I'm forgetting something, so this is what I got, and stil the same, Nothing works, no rectangle, and not even ped's health. Client: local x, y = guiGetScreenSize() local tigre1 = nil addEventHandler("onClientRender",getRootElement(), function () if ( isElement ( tigre1 ) ) then local mx, my, mz = getElementPosition(tigre1) local mcx, mcy, mcz = getCameraMatrix() if isLineOfSightClear ( mcx , mcy, mcz, mx, my, mz, true, false, false, true, false, true, false, getLocalPlayer ( )) then local x1,y1,z1 = getElementPosition (getLocalPlayer()) local x2,y2,z2 = getElementPosition (tigre1) local visibleto = getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2) if visibleto < 75 then local sx,sy = getScreenFromWorldPosition ( x2,y2,z2+1.45 ) if sx and sy then if y/102-visibleto/5 > 0 then dxDrawRectangle ( sx-x/14/2+visibleto/2, sy+y/25-visibleto/3, x/14-visibleto,y/146.3-visibleto/10, tocolor(0,0,0,245) ) if getElementHealth(tigre1) > 1 then dxDrawRectangle ( sx-x/14/2+visibleto/2, sy+y/25-visibleto/3, x/14*getElementHealth(tigre1)/100-visibleto,y/146.3-visibleto/10, tocolor(190,0,0,245) ) end end end end end end end) addEvent ("get:element",true) addEventHandler ( "get:element", root, function (element) tigre1 = element outputChatBox ( "element" ) end) addEventHandler ( "onClientResourceStart", resourceRoot, function() triggerServerEvent ( "ped:clientready", getLocalPlayer(), getLocalPlayer() ) end) Server side: function sendServer(playerToSendTo) triggerClientEvent (playerToSendTo, "get:element", root, tigre1 ) end addEvent ( "ped:clientready", true ) addEventHandler ( "ped:clientready", root, sendServer )
-
Anyone here to tell me what is wrong above ? Ps.: sorry for double post.
-
I'd love playing in a "Far Cry" gamemode. If you need help about mapping just call me and I will be glad helping you. I may not be a pro scripter, but I have excellent mapping skills.
-
If you get many players, you could do something like Need for Speed, then you're free to drive around San Andreas, but to get money, respect, etc. you have to join races, then you go to place, and start the race with others. Be careful, some races will make you wanted, and you'll have to escape from Cops in order to avoid losing your car or paying to don't lose it.
-
I'm using slothbot, so I didn't understand half thing you have made, I'm not that expert as you see .-. Also, I didn't get what denny said, he told me to overwrite/replace/edit something while everything seems to be done for me, probably I'm forgetting something, so this is what I got, and stil the same, Nothing works, no rectangle, and not even ped's health. Client: local x, y = guiGetScreenSize() local tigre1 = nil addEventHandler("onClientRender",getRootElement(), function () if ( isElement ( tigre1 ) ) then local mx, my, mz = getElementPosition(tigre1) local mcx, mcy, mcz = getCameraMatrix() if isLineOfSightClear ( mcx , mcy, mcz, mx, my, mz, true, false, false, true, false, true, false, getLocalPlayer ( )) then local x1,y1,z1 = getElementPosition (getLocalPlayer()) local x2,y2,z2 = getElementPosition (tigre1) local visibleto = getDistanceBetweenPoints3D(x1,y1,z1,x2,y2,z2) if visibleto < 75 then local sx,sy = getScreenFromWorldPosition ( x2,y2,z2+1.45 ) if sx and sy then if y/102-visibleto/5 > 0 then dxDrawRectangle ( sx-x/14/2+visibleto/2, sy+y/25-visibleto/3, x/14-visibleto,y/146.3-visibleto/10, tocolor(0,0,0,245) ) if getElementHealth(tigre1) > 1 then dxDrawRectangle ( sx-x/14/2+visibleto/2, sy+y/25-visibleto/3, x/14*getElementHealth(tigre1)/100-visibleto,y/146.3-visibleto/10, tocolor(190,0,0,245) ) end end end end end end end) addEvent ("get:element",true) addEventHandler ( "get:element", root, function (element) tigre1 = element outputChatBox ( "element" ) end) addEventHandler ( "onClientResourceStart", resourceRoot, function() triggerServerEvent ( "ped:clientready", getLocalPlayer(), getLocalPlayer() ) end) Server side: function sendServer(playerToSendTo) triggerClientEvent (playerToSendTo, "get:element", root, tigre1 ) end addEvent ( "ped:clientready", true ) addEventHandler ( "ped:clientready", root, sendServer )
-
I'm gonna give a check, thank you
-
Do something like Assassins creed.When logged in, you get a target to kill, and another assassin should kill you. I'm gonna edit as soon as I get more ideas
-
Do you have a good wiki ( better than the limited one from mta ) showing examples, tutorials, full explanation ?
-
but is it possible to show ped's health on a rectangle ? created using dxdrawrectangle
-
I give up, too many things, mta wiki is too limited, it says one thing while I can do another one totally different. Examples are bad, short explanation of how free I'm to use functions.
-
Client side : local x,y = guiGetScreenSize() function PETvida() local sx, sy = getScreenFromWorldPosition (getElementPosition(tigre1)) if sx then dxDrawRectangle( sx, sy, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) end end addEvent( "onGetHealth", true ) addEventHandler( "onGetHealth", getRootElement(), PETvida ) Server side(I think showing the whole function is not needed): tigre1 = call (getResourceFromName("slothbot"), "spawnBot", x+3, y+1, z, rot, skin, interior, dimension, team, weapon, mode, modesubject) setElementData ( tigre1, "pet", cachorro ) setElementExtraHealth ( tigre1, 999 ) triggerClientEvent ( "onGetHealth", getRootElement(), tigre1 ) else outputChatBox("Você não tem dinheiro para criar um PET", thePlayer, 225, 0, 0) end end Is it going to work, so I would "share" variables ... and the first code, is it right ?
-
Even if they are global ? I thought that, but I wasn't sure of how do I do, I'm starting to give up. If you have any tips about how do I do dxDrawRectangle using a server-side variable, please tell me. How do I "share" variables between both sides. Also check this please, tell me if the only thing is wrong is the variable ( I didn't get element health yet ) : local rootElement = getRootElement() local x,y = guiGetScreenSize() function PETvida() local sx, sy = getScreenFromWorldPosition (getElementPosition(tigre1)) if sx then dxDrawRectangle( sx, sy, x/2.02, y/2, tocolor ( 0, 0, 0, 150 ) ) end end function HandleTheRendering() addEventHandler("onClientRender",rootElement, PETvida) end addEventHandler("onBotSpawned",rootElement, HandleTheRendering)
-
And what about the rest of the code ?
-
The above code is supposed to get Ped's health and show it in a progressBar( which should be above its head ). It doesn't work, I don't get anything from debugscript, but it doesn't work, progressbar is not created... If you know what is wrong, please tell me and help me fixing, tigre1 is created server-side ( using slothbot ). Probably if you find any error, it's not the only one, so try to help me, please. local rootElement = getRootElement() function PETvida() if ( isElement ( tigre1 ) ) then local pedX, pedY = getElementPosition ( tigre1 ) if ( isElement ( tigre1 ) ) then local vida = getElementHealth ( tigre1 ) local sx, sy = getScreenFromWorldPosition (getElementPosition(tigre1)) if sx then life = guiCreateProgressBar( pedX, pedY+5, sx, sy, true, nil ) -- Made pedY+5 to make it above Ped's health and not on its body guiProgressBarSetProgress(life, tonumber (vida)) end end end end function HandleTheRendering() addEventHandler("onClientRender",rootElement, PETvida) end addEventHandler("onBotSpawned",rootElement, HandleTheRendering)
-
I'm not able to test it now, but I think it's not going to work. Maybe you have misunderstood me, but for what I know these codes aren't related. Also is it possible to output element's health to a progress bar ?
-
I wanna know if it's possible to attach a label to a ped, and the label's text should get set using an editor. Also I'll need a progress bar showing ped's health above its head. I was planing to use atachElementToElement, but it says in wiki that it doesn't work with peds. If you know a way of doing these, please help me
-
It says waiting , but I know it's not, because it's moving ...
-
I don't get anything ... I think they are set again to Following. It's the default mode... I tried adding the first code, and I got nothing on debugscript, I don't what is wrong. It just stops moving, and after almost 2 seconds it jumps and starts moving again
-
It works fine, for 1 second, the Ped stops moving, but suddenly it just jumps and starts moving again, I tried using: local mode = exports.slothbot:getBotMode(ped_name) if mode then exports.slothbot:setBotWait(ped_name) end But it doesn't work, so this is the basic function, which stops the Ped for almost 2 seconds, and then fails. They are already global, I just need a way of stopping them til the player types the command again. function ficar ( ) exports.slothbot:setBotWait(tigre1) exports.slothbot:setBotWait(pantera1) exports.slothbot:setBotWait(cachorro1) exports.slothbot:setBotWait(lobo1) exports.slothbot:setBotWait(raposa1) exports.slothbot:setBotWait(cachorro2) exports.slothbot:setBotWait(pitbull1) exports.slothbot:setBotWait(pitbull2) end addCommandHandler( "stay", ficar )
-
Perfectly !!! Is there any tutorial/wiki for those nil and return?, I've already tried to find return on mta wiki and got none, also mta wiki is limited and it doesn't show all options we do have, like guiGridListGetSelectedItem, I never thought about using it that way, thought I was supposed to use it with guiGridListGetItemText . I'm not that good at these, and I love scripting, so I wish to know more and stop asking for help and start helping someone else. Thank you again
-
Please, anyone here
-
Well, it works if the player clicks twice fastly, but it doesn't work if the player clicks once on the row, wait sometime and then click again on the row, it keeps bugged and the Ped is not deleted. Also, I don't know why, but if the Player clicks outside the GridList ( any area, except labels ) the Ped is created, instead of getting none return. Example : I'm looking at GUI, then I click on title of myWindow, the Ped keeps being created while I'm clicking on title of the window. function fechadaGUI ( ) guiGridListSetSelectedItem (myGridList, 0, 0) if ( isElement ( foxprev ) ) then destroyElement(foxprev); end if ( isElement ( panteraprev ) ) then destroyElement(panteraprev); end if ( isElement ( pastorprev ) ) then destroyElement(pastorprev); end if ( isElement ( rotprev ) ) then destroyElement(rotprev); end if ( isElement ( loboprev ) ) then destroyElement(loboprev); end if ( isElement ( tigreprev ) ) then destroyElement(tigreprev); end end addEventHandler( "onClientGUIDoubleClick", myGridList, fechadaGUI, false )
-
I found a bug, if you click repeatedly on the same row, another Ped is created and so on, how do I disable clicking on the same row multiple times ? I tried wiki, but I don't have enough time to keep looking for, gtg soon.