Jump to content

Citizen

Moderators
  • Posts

    1,803
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by Citizen

  1. Maybe try this: local imgTable = { "img/travelling.png","img/image2.png","img/image3.png","img/image4.png" } g_GUI['travelImage'] = guiCreateStaticImage(screenWidth/2-400, screenHeight/2-300,800, 600, ""..imgTable[math.random(#imgTable)], false) if it don't work, try this: local ran = math.random(1,3) outputChatBox("img/travelImage"..ran) g_GUI['travelImage'] = guiCreateStaticImage(screenWidth/2-400, screenHeight/2-300,800, 600, "img/travelImage"..ran, false) and rename your images like this: 'travelImage3.png' or 'travelImage2.png' or 'travelImage3.png' etc If those codes don't works, it's maybe because the path is wrong ( the image aren't in the 'img' folder ) or those images aren't in the png format or you there aren't in your meta.xml
  2. Try this: Server: function gettingPlayerPos() addEventHandler("onResourceStart", getRootElement(), function () local result = mysql_query(handler, "SELECT * FROM tc_biznesy" ) if (result) then while true do local data = mysql_fetch_assoc(result) if (not data) then break end local bizx,bizy,bizz bizx = data["bizx"] bizy = data["bizy"] bizz = data["bizz"] outputChatBox("1st Trigger" ) triggerClientEvent("gettingPos", getRootElement(), bizx, bizy, bizz) --- For test --- outputChatBox("2st Trigger" ) bizx = 1 bizy = 2 bizz = 3 triggerClientEvent("gettingPos", getRootElement(), bizx, bizy, bizz) end mysql_free_result(result) end end) end Client: addEvent("gettingPos", true) function gettingPlayerPos (bizx, bizy, bizz) outputChatBox( bizx.." "..bizy.." "..bizz ) addEventHandler("onClientRender", getRootElement(), function () local cx, cy, cz = getElementPosition( localPlayer ) if cx == bizx and cy == bizy and cz == bizz then outputChatBox("Witaj") end end) end addEventHandler("gettingPos", getRootElement(), gettingPlayerPos)
  3. try this? addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() bindKey ( "F2", "down", function( ) if (guiGetVisible(MainWindowLevel) == false) then guiSetVisible(MainWindowLevel,true) startShowingShopLevelMenu() elseif (guiGetVisible(MainWindowLevel) == true) then guiSetVisible(MainWindowLevel,false) showCursor(false) end end) end) No because you create again the gui when you want to show it. Create this gui when the player join, then you will only use guiSetVisible: addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() startShowingShopLevelMenu() bindKey ( "F2", "down", function( ) if (guiGetVisible(MainWindowLevel) == false) then guiSetVisible(MainWindowLevel,true) elseif (guiGetVisible(MainWindowLevel) == true) then guiSetVisible(MainWindowLevel,false) showCursor(false) end end ) end) Ok ?
  4. lol I seen: "the event onPlayerDamage can be canceled" instead of can't
  5. Nice work ! Yes but if you only can get the settings from the server, you have to create a triggerClient/ServerEvent
  6. theMarker = createMarker ( 0, 0, 3, "cylinder", 5, 255, 255, 255, 255 ) function attach ( hitElement, matchingDim ) if ( getElementType( hitElement ) == "vehicle" ) then -- if the element is a vehicle attachElements ( hitElement, source ) -- attach the element ( the vehicle ) to the marker hited ( the source is the marker hited ) else outputChatBox ( "Only vehicles can be attached here" ) end end addEventHandler ( "onMarkerHit", theMarker, attach ) function detach ( thePlayer, commandName ) local Pvehicle = getPedOccupiedVehicle( thePlayer ) -- we get the player's vehicle detachElements ( pVehicle ) -- the second argument is not compulsory end addCommandHandler ( "detach", detach )
  7. Solidsnake ( and me ) think that you create the gui every times ( when you want to show it ) So just use this function 1 time ( startShowingShopLevelMenu ) Then use guiSetVisible( MainWindowLevel , true ) to show it again.
  8. So: function healFlowers (attacker, attackerweapon, bodypart, loss) if (attackerweapon == 14) then cancelEvent() end end addEventHandler ("onPlayerDamage", getRootElement(), healFlowers )
  9. No Solidsnake means this ( line3 ): player = findPlayer(...) He wants that you show us the: function findPlayer( blabla ) blablabla end
  10. Citizen

    hey !!!!!

    That's why it's free
  11. Sorry I wanted to say line 5 instead of 20
  12. You need those functions/events: onMarkerHit attachElements addCommandHandler detachElements But the problem with the attachElements, is to find the correct Offsets ! So see this page to fix the problem
  13. And why do you want this information ?
  14. I really don't know but maybe try this: addEvent("selectSkill",true) addEventHandler( "selectSkill", getLocalPlayer(), function(skillsID) if (tonumber(skillsID)) then guiGridListSetItemText(MainGrid,tonumber(skillsID),5,"purchased",false,false) guiGridListSetItemColor (MainGrid,tonumber(skillsID),5,0,255,0) local datasSk = setElementData(getLocalPlayer(),"SkillBuy",skillsID) outputChatBox("set data skill "..tostring(skillsID).." , "..tostring(datasSk)) outputChatBox("text change "..tonumber(skillsID)) end end )
  15. I think he means this: call(getResourceFromName("editor"),"import",thisResource) You making a very hard script, you are a noob, and you forgot the () at getResourceFromName ? that's strange At line 20: why getElementsByType ? It's not getElementsByName ? Maybe there is a bad setElementData( ..., "posZ" ) for the first Carshade ?
  16. Citizen

    Help ???

    function spawnWasted(player) local skin = getElementModel ( player ) repeat until spawnPlayer ( player, 1606.76, 1816.60, 10.82, 180, skin ) fadeCamera(player, true) setCameraTarget(player, player) -- setPlayerTeam (player, nil) in spawnPlayer function, the team is already nil takePlayerMoney ( player, 150 ) end addEventHandler("onPlayerWasted", root, function() setTimer(spawnWasted, 1800, 1, source) end )
  17. O,o, you copied me? i said that in another topic ^^ Haha no but I think like that
  18. What's the problem ? There no errors ? I think there is a conflict with your GM. Try this: local gate_test = createColCircle ( 2482, -1701, 20 ) function elementColShapeHitTheColCircle( theElement ) outputChatBox( getElementType( theElement ).. " entered the colCircle!" ) end addEventHandler( "onColShapeHit", gate_test, elementColShapeHitTheColCircle ) EDIT: I tested this code and it works perfectly !
  19. We are not your slaves ! Try by yourself !
  20. Any errors ? Try this for debug: guiGridListSetItemText(GUIEditor_Grid[211],10,5,"purchased",false,false)
  21. Yeah sorry my bad I was a bad syntax of the triggerClientEvent in my mind sorry client: function startShowingShopLevelMenu() showCursor(true) GUIEditor_Grid = {} MainWindowLevel = guiCreateWindow(0.2234,0.0586,0.5969,0.9102,"New Skills Shop",true) MainButton = guiCreateButton(0.1289,0.9418,0.6974,0.0370,"Buy Skill",true,MainWindowLevel) GUIEditor_Grid[211] = guiCreateGridList(0.0419,0.0354,0.9058,0.8970,true,MainWindowLevel) guiGridListSetSelectionMode(GUIEditor_Grid[211],1) ------- Remove this: ------------- -- for i = 1, 19 do -- guiGridListAddRow(GUIEditor_Grid[211]) -- end ---------------------------------- guiGridListAddColumn(GUIEditor_Grid[211],"ID",0.2) guiGridListAddColumn(GUIEditor_Grid[211],"Name",0.2) guiGridListAddColumn(GUIEditor_Grid[211],"$",0.2) guiGridListAddColumn(GUIEditor_Grid[211],"Level",0.2) guiGridListAddColumn(GUIEditor_Grid[211],"Status",0.2) addEventHandler ("onClientGUIClick", MainButton, onClientPlayerSkillBuy) for i,v in ipairs (skillsLevelsTable) do local row21 = guiGridListAddRow (GUIEditor_Grid[211]) guiGridListSetItemText (GUIEditor_Grid[211], row21, 1, v[1], false, true) guiGridListSetItemText (GUIEditor_Grid[211], row21, 2, v[2], false, true) guiGridListSetItemText (GUIEditor_Grid[211], row21, 3, v[3], false, true) guiGridListSetItemText (GUIEditor_Grid[211], row21, 4, v[4], false, true) guiGridListSetItemText (GUIEditor_Grid[211], row21, 5, v[5], false, true) guiGridListSetItemText (GUIEditor_Grid[211], row21, 6, v[6], false, true) end end server: function getSkillFunc(player,Levelids) if ( Levelids ) then local skillsID = tonumber( Levelids ) triggerClientEvent(source, "selectSkill", getRootElement() ,skillsID) return true else return false end end
  22. hmm i must be a little slow today - i dont understand you... you want to trigger event for all clients, but only add event in one client? i is like this triggerClientEvent( "selectSkill",player, skillsID) this triggerClientEvent(player, "selectSkill", skillsID) trigger the event for one client and set skillsID as source in a handler function... Where do you see that I want to trigger for all clients ? I want for only the corect client so: triggerClientEvent(player, "selectSkill", skillsID) Because:
  23. Try with onColShapeHit: function elementColShapeHit( theElement ) if source == gate_test then -- if element entered the created colshape outputChatBox( getElementType( theElement ) .. " entered the colCircle!" ) end end addEventHandler( "onColShapeHit", getRootElement(), elementColShapeHit )
  24. -.-" he can search it by hisself... I use the wiki every weeks since 2009, and I never seen this page, it was the 1st time ( and I don't know where is this page in the MainPage of the wiki; where is it please? )
×
×
  • Create New...