Jump to content

Killerhamster10

Members
  • Posts

    13
  • Joined

  • Last visited

Killerhamster10's Achievements

Square

Square (6/54)

0

Reputation

  1. Ahhh! How could i forget this cmd Thank you veryyyyyyyyyy much
  2. Ah, i forget the SetItemData part Okay now i have this code to fill my grid: function fill_list(thePlayer,level) local row = guiGridListAddRow (grid) guiGridListSetItemText ( grid, row, playername, getPlayerName(thePlayer), false, false ) guiGridListSetItemText ( grid, row, wantedlevel, tostring(level), false, false ) guiGridListSetItemData(grid,row,playername,getPlayerName(thePlayer)) guiGridListSetItemData(grid,row,wantedlevel,tostring(level)) end It's not nil But now i have another problem: function doit () local row,col = guiGridListGetSelectedItem(grid) outputChatBox(tostring(row).. " " ..tostring(col)) --Print the row and the col if row and col and row ~= -1 and col ~= -1 then local target = guiGridListGetItemData(grid,row,col) --Set the target local myBlip = createBlipAttachedTo ( tostring(target), 41,0,0,0,255,g_Player) outputChatBox(tostring(target).. " was set as a waypoint icon on the map",255,0,0,g_Player) triggerServerEvent ( "setTarget", getRootElement(),getLocalPlayer(), target ) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) openend = false end end I got a bad argument at line 8, in the myBlip line. Idk if (tostring(target)) is right... Maybe one of you have a idea?
  3. Hey, I have this GUI and try to get a grid 0variable with guiGridListGetItemData. But the target (which is localed as the grid data - line 33) is always nil even if i select a item Can somebody help? function create_grid(player) if getElementType(player) == "player" and player == g_Player then GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(0.0113,0.1644,0.2804,0.3772,"Police Jobs",true) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_Grid[1] = guiCreateGridList(12,27,301,260,false,GUIEditor_Window[1]) guiGridListSetSelectionMode(GUIEditor_Grid[1],2) playername = guiGridListAddColumn(GUIEditor_Grid[1],"Player",0.5) wantedlevel = guiGridListAddColumn(GUIEditor_Grid[1],"Wanted Level",0.5) GUIEditor_Button[1] = guiCreateButton(13,297,110,20,"Set as target",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick", GUIEditor_Button[1], doit, false) GUIEditor_Button[2] = guiCreateButton(201,297,110,20,"Cancel",false,GUIEditor_Window[1]) addEventHandler("onClientGUIClick", GUIEditor_Button[2], doit, false) showCursor(true) end end addEvent( "show_grid", true ) addEventHandler( "show_grid", getRootElement(), create_grid) local target local row,col function doit () row,col = guiGridListGetSelectedItem(GUIEditor_Grid[1]) outputChatBox(tostring(row).. " " ..tostring(col)) if row and col and row ~= -1 and col ~= -1 then target = guiGridListGetItemData(GUIEditor_Grid[1],row,col) local myBlip = createBlipAttachedTo ( test, 41,0,0,0,255,g_Player) outputChatBox(tostring(target)) outputChatBox(getPlayerName(target)) outputChatBox("The target was set as a waypoint icon on the map",255,0,0,g_Player) triggerServerEvent ( "setTarget", getRootElement(),getLocalPlayer(), target ) guiSetVisible(GUIEditor_Window[1], false) showCursor(false) openend = false end end
  4. Hey, I have a big problem. I wanted to make a function which checks something and if it is wrong it will cancel a event. This is my code: function enterVehicle (theVehicle) local id = getElementModel (theVehicle) if normalcars[getElementModel (theVehicle)] then if (getAccountData (getPlayerAccount (source), "License-A") == "false") then --removePedFromVehicle ( source ) outputChatBox ( "You're not allowed to drive this car! Buy a license at the office!", source,255,0,0 ) cancelEvent() elseif (getAccountData (getPlayerAccount (source), "License-A") == "true") then outputChatBox ( "You're allowed to drive this car!", source) end end if aircrafts[getElementModel (theVehicle)] then if (getAccountData (getPlayerAccount (source), "License-B") == "false") then --removePedFromVehicle (source) outputChatBox ( "You're not allowed to fly this aircraft! Buy a license at the office!", source,255,0,0 ) cancelEvent() elseif (getAccountData (getPlayerAccount (source), "License-B") == "true") then outputChatBox ( "You're allowed to fly this aircraft!", source ) end end if military[getElementModel (theVehicle)] then if (getAccountData (getPlayerAccount (source), "License-C") == "false") then --removePedFromVehicle (source) outputChatBox ( "You're not allowed to use military vehicles or aircrafts! Buy a license at the office!", source,255,0,0 ) cancelEvent() elseif (getAccountData (getPlayerAccount (source), "License-C") == "true") then outputChatBox ( "You're allowed to use military vehicles or aircrafts!", source ) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) But it doesn't cancel the event... Can someone help me? Sorry for my english Greetings
  5. Hey, I'm working on buymap script and want to do this with xml. So i created this script: addEvent("onMapStarting") addEventHandler('onMapStarting', getRootElement(), function() local mapName = getMapName() if mapName and mapName ~= "None" then saveMapData ("MapName",getMapName()) end end ) function loadMapData (player,datatype) local mapName = getMapName() if mapName and mapName ~= "None" then local root = xmlLoadFile ("maps.xml") if (root) then local MapsNode = xmlFindChild (root,"map",0) if (MapsNode) then local MapRootNode = xmlFindChild (MapNode,"MAP_" .. getMapName() .. "||",0) if not (MapRootNode == false) then local MapData = xmlNodeGetAttribute (MapRootNode,datatype) if (MapData) then xmlUnloadFile (root) return MapData else xmlNodeSetAttribute (MapRootNode,datatype,0) xmlSaveFile (root) xmlUnloadFile (root) return 0 end else local MapRootNode = xmlCreateChild (MapNode,"MAP_" .. getMapName().. "||") xmlNodeSetAttribute (MapRootNode,datatype,0) xmlSaveFile (root) xmlUnloadFile (root) return 0 end end end end end function saveMapData (datatype,newvalue) local mapName = getMapName() if mapName and mapName ~= "None" then local root = xmlLoadFile ("maps.xml") if (root) then local MapNode = xmlFindChild (root,"map",0) if (MapNode) then local MapRootNode = xmlFindChild (MapNode,"MAP_" .. getMapName().. "||",0) if not (MapRootNode == false) then local newNodeValue = xmlNodeSetAttribute (MapRootNode,datatype,newvalue) xmlSaveFile (root) xmlUnloadFile (root) return newNodeValue else local MapRootNode = xmlCreateChild (MapNode,"MAP_" .. getMapName().. "||") local newNodeValue = xmlNodeSetAttribute (MapRootNode,datatype,newvalue) xmlSaveFile (root) xmlUnloadFile (root) return newNodeValue end end end end end I don't get any error but it doesn't save the map everytime. That means, when i have the empty xml and start the script and a map, it saves it in the xml. But when i change the map, it doesn't save it... Can someone help me? Greetings
  6. Okay it is working, thx! But now we have another problem: We want to use teamchat for admins only, so that only admins can read it. With the script i'm now using the teamchat doesn't work Is there a way to make it work again? Greetingsd
  7. Hey, This is my script: function setPlayerChatColor(message) local thePlayer = getPlayerName(source) if thePlayer:find("TAG//") then outputChatBox(message,231,106,12) end end addEventHandler( "onPlayerChat", getRootElement(), setPlayerChatColor ) And now it writes the message in the outputChatBox, but my problem is, that this is not why i really want I only want that members who have the Clan Tag in there name write in another color Maybe you can tell me how to do this?
  8. I replaced now the theplayer with source but some error. Maybe i understood something wrong? I'm new to coding, so please don't be angry about me Greetings
  9. Okay i added: local thePlayer = getPlayerName(thePlayer) But now it says: atempt to to index local 'theplayer' I really don't know what to do >.< Greetings
  10. Hey, I try to make a script which do, that users which nicks includes a special tag, write in another color as normal users Is this possible? I tried it with this script but i allways get errors: function setPlayerChatColor(message) thePlayer = getPlayerName(thePlayer) if thePlayer:find("TAG//") then outputChatBox(..message..,231,106,12) end cancelEvent() end addEventHandler( "onPlayerChat", getRootElement(), setPlayerChatColor() ) Greetings, Killerhamster
  11. Okay very nice It was on server side, so i changed it Okey, one other question: Is it possible to change the sky color in a loop? So that is like this: Blue Green Red Black Red --Start Again Blue Green Red Black Red --Start Again So that it allways change? Pls answer Greetings
  12. Okay thanks, but now it only sais: Failed to change the sky colour I type: /setsky 200 0 100 150 0 70 and again this error message But i think it'a allright? Greetings
  13. Hey, I try to make a script which can change the sky colour. That's my code: function changeSkyColor ( commandName, topred, topgreen, topblue, bottomred,bottomgreen,bottomblue ) topRed = tonumber ( topRed ) topGreen = tonumber ( topGreen ) topBlue = tonumber ( topBlue ) bottomRed = tonumber ( bottomRed ) bottomGreen = tonumber ( bottomGreen ) bottomBlue = tonumber ( bottomBlue ) if topRed and topGreen and topBlue and bottomRed and bottomGreen and bottomBlue then setSkyGradient( topRed, topGreen, topBlue, bottomRed, bottomGreen, bottomBlue ) else outputChatBox ( "Failed to change the sky colour!" ) end end addCommandHandler ( "setsky", changeSkyColor ) But it is not working Can someone help me? Greetings
×
×
  • Create New...