-
Posts
1,803 -
Joined
-
Last visited
-
Days Won
8
Everything posted by Citizen
-
Sorry I made a big error addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function( ) if ( getElementData( getLocalPlayer(), "Joined" ) ) then return end local EXP1 = getElementData(gme,"Experience",tostring) local Level1 = getElementData(gme,"Level",tostring) local exptolevel1 = getElementData(gme,"NextLevel",tostring) outputChatBox ( "Player Resource start "..tostring(EXP1).." "..tostring(Level1).." "..tostring(exptolevel1).." "..tostring(gme)) LevelsLabel = guiCreateLabel(0.8578,0.6104,0.125,0.0244,"Level: "..Level1,true) EXPLabel = guiCreateLabel(0.8578,0.6387,0.125,0.0244,"EXP: "..EXP1.." / "..exptolevel1,true) setElementData( getLocalPlayer(), "Joined", true ) end )
-
Haha Yeah tigerman forgot you SolidSnake But he can't know every scripters who helping others
-
It's playerfile, not playerFile: function SavePLAYERNAME() local playerName = getPlayerName(source) local playerfile = fileCreate(playerName..".txt") if(playerfile) then fileWrite(playerFile,playerName) fileClose(playerFile) outputChatBox("OMG File Created Succesfully", source) else outputChatBox("Failed Again !", source) end end addEventHandler("onPlayerSpawn", getRootElement(), SavePLAYERNAME)
-
so if you use the onClientPlayerJoin, it doesn't work ? Other way: addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function( ) if ( not getElementData( getLocalPlayer(), "Joined" ) ) then return end local EXP1 = getElementData(gme,"Experience",tostring) local Level1 = getElementData(gme,"Level",tostring) local exptolevel1 = getElementData(gme,"NextLevel",tostring) outputChatBox ( "Player Resource start "..tostring(EXP1).." "..tostring(Level1).." "..tostring(exptolevel1).." "..tostring(gme)) LevelsLabel = guiCreateLabel(0.8578,0.6104,0.125,0.0244,"Level: "..Level1,true) EXPLabel = guiCreateLabel(0.8578,0.6387,0.125,0.0244,"EXP: "..EXP1.." / "..exptolevel1,true) setElementData( getLocalPlayer(), "Joined", true ) end ) All setElementData are destroyed when a player quit the server.
-
Hi, The problem was there: local pfile = fileCreate(pname..".txt")
-
When do you want that this labels appears ?
-
Oh sorry, my bad I already seen this last time but today, I forgot it
-
And what's the problem ? It doesn't work ?!
-
I already seen this problem with another scripter that I help him. The problem is in your ElementData's name because he don't support the : Replace for exemple this: getElementData(gme,"Experience:") by this: getElementData(gme,"Experience") ( so the setElementData too ) If you use Notepad++, you can replace it easily: Ctrl+H and the "Replace All" button
-
Why not some: setElementData(button1, "Group", "Group1" ) setElementData(button2, "Group", "Group1" ) Then you can make: addEventHandler("onClientGUIClick",getRootElement(), function () local group = getElementData( source, "Group" ) if ( group == "Group1") then for k,v in ipairs ( button ) do if source == button[k] then DoSomething ( buttonValue[k] ) end -- that's all to check as much buttons as I want. end end end )
-
I think too because he just have the client part of this script
-
You want to make an universal function ? ( I means one function for all bindKey ) ? Try this debug code: key1 = "a" key2 = "b" function whenResourceStarts ( ) bindKey ( key1, "down", onKey ) bindKey ( key2, "down", onKey ) end function onKey ( key, keyState ) outputChatBox( key.." "..getKeyState ( key1 ).." "..getKeyState ( key2 ) if key == key1 and getKeyState ( key2 ) ~= "down" then return elseif key == key2 and getKeyState ( key1 ) ~= "down" then return end -- If the above is passed, go on, but it won't for some reason end And are you sure: if key == key1 and getKeyState ( key2 ) ~= "down" then return I think it's: if key == key1 and getKeyState ( key1 ) ~= "down" then return no ?
-
Create a new meta.xml and put this in it ( It's my meta for this script ) <?xml version="1.0" encoding="utf-8"?> <meta> <info author="" type="" name="" description="" /> <script src="client.luac" type="client" /> <script src="interface_c.luac" type="client" /> <file src="images/weapons/AK-47.png" /> <file src="images/weapons/Bat.png" /> <file src="images/weapons/Bomb.png" /> <file src="images/weapons/Brassknuckle.png" /> <file src="images/weapons/Cane.png" /> <file src="images/weapons/Chainsaw.png" /> <file src="images/weapons/Colt 45.png" /> <file src="images/weapons/Combat Shotgun.png" /> <file src="images/weapons/Deagle.png" /> <file src="images/weapons/Death.png" /> <file src="images/weapons/Dildo.png" /> <file src="images/weapons/Drowned.png" /> <file src="images/weapons/Explosion.png" /> <file src="images/weapons/Fall.png" /> <file src="images/weapons/Fire Extinguisher.png" /> <file src="images/weapons/Flamethrower.png" /> <file src="images/weapons/Flower.png" /> <file src="images/weapons/Golfclub.png" /> <file src="images/weapons/Grenade.png" /> <file src="images/weapons/Katana.png" /> <file src="images/weapons/Knife.png" /> <file src="images/weapons/M4.png" /> <file src="images/weapons/Melee.png" /> <file src="images/weapons/Minigun.png" /> <file src="images/weapons/MP5.png" /> <file src="images/weapons/Nightstick.png" /> <file src="images/weapons/Poolstick.png" /> <file src="images/weapons/Rammed.png" /> <file src="images/weapons/Ranover.png" /> <file src="images/weapons/Rifle.png" /> <file src="images/weapons/Rocket Launcher HS.png" /> <file src="images/weapons/Rocket Launcher.png" /> <file src="images/weapons/Rocket.png" /> <file src="images/weapons/Satchel.png" /> <file src="images/weapons/Sawed-off.png" /> <file src="images/weapons/Shotgun.png" /> <file src="images/weapons/Shovel.png" /> <file src="images/weapons/Silenced.png" /> <file src="images/weapons/Sniper.png" /> <file src="images/weapons/Spraycan.png" /> <file src="images/weapons/Teargas.png" /> <file src="images/weapons/Tec-9.png" /> <file src="images/weapons/UZI.png" /> <file src="images/weapons/Vibrator.png" /> <file src="sounds/ding_a_ling.wav" /> </meta> Enjoy
-
Is it in client or server-side ?
-
When you create a guiElement, you have to hide it after: open = 0 function box() if open==0 then open = 1 showCursor(true) myWindow = guiCreateWindow(0.375, 0.375, 0.500, 0.500, "Map Test Help Commands - GUI Version", true) but1 = guiCreateButton(0.0, 0.1, 0.19, 0.1, "Fix", true, myWindow) but2 = guiCreateButton(0.0, 0.23, 0.19, 0.1, "Blow up", true, myWindow) but3 = guiCreateButton(0.0, 0.36, 0.19, 0.1, "Water Color", true, myWindow) elseif open==1 then open = 0 destroyElement(myWindow) end end open = 0 bindKey("l", "up", box) w1 = guiCreateWindow(0.50, 0.50, 0.50, 0.500, "Map Test Help Commands - GUI Version", true) w2 = guiCreateWindow(0.50, 0.50, 0.50, 0.500, "Map Test Help Commands - GUI Version", true) w3 = guiCreateWindow(0.50, 0.50, 0.50, 0.50, "Map Test Help Commands - GUI Version", true) guiSetVisible(w1,false) guiSetVisible(w2,false) guiSetVisible(w3,false) addEventHandler("onClientGUIClick",getRootElement(), function () if (source == but1) then guiSetVisible(w1,true) elseif (source == but2) then guiSetVisible(w2,true) elseif (source == but3) then guiSetVisible(w3,true) end end)
-
ok try this but what do you want to do exactly ? function foundMap( thePlayer, commandName, map ) if map then local mapName = tostring( map ) for k,i in ipairs ( mapTable ) do outputChatBox( "if "..i[1].." == "..mapName, thePlayer ) if ( tostring(i[1]) == tostring(mapName) ) then outputChatBox( "I found ! It's "..tostring(i[1]), thePlayer, 180, 0, 0 ) break end end else outputChatBox("/test2 [mapName]" ) end end addCommandHandler("test2",foundMap)
-
Try this ( you forgot a "end" to close the startup function): GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Label = {} GUIEditor_Image = {} function startup() GUIEditor_Window[1] = guiCreateWindow(0,0,0.99,1,"...SCEGLI UNA FAZIONE...",true) guiSetVisible(GUIEditor_Window[1],false) GUIEditor_Memo[1] = guiCreateMemo(0.0164,0.0517,0.5404,0.56,"21 dicembre 2012...\nLa data piu' conosciuta sulla faccia di\nquesto misero pianeta.\nFino ad un anno prima andava tutto bene,\nfino a quando, per i classici motivi\ndi soldi, non scoppio' l' ennesima,\ndisastrosa, guerra mondiale.\nFurono usate armi biologiche e nucleari,\nfino ad ottenere questo cazzo di risultato...\nUn mondo di merda ricoperto da zombies di merda\ntenuti in vita da quelle radiazioni e da quei composti \nchimici DI MERDA.\nNegli anni seguenti si sono formate diverse comunita':\ngli HUNTERS, i Reaper e gli Stalkers.\nIl tuo compito e' quello di entrare a fare parte di uno di questi\ngruppi e di ammazzare quei fottuti zombies.\nChe cosa stai aspettando ancora? e' il tuo momento.\n",true,GUIEditor_Window[1]) GUIEditor_Image[1] = guiCreateStaticImage(0.5101,0.1017,0.4836,0.4767,"images/mtalogo.png",true,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(0.0278,0.8267,0.2374,0.1217,"HUNTERS",true,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(0.3851,0.8267,0.2374,0.1217,"REAPER",true,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(0.7172,0.8267,0.2374,0.1217,"STALKERS",true,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(0.2841,0.6783,0.4306,0.0717,"VOGLIO FARE PARTE DEI:",true,GUIEditor_Window[1]) guiLabelSetColor(GUIEditor_Label[1],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[1],"center") guiLabelSetHorizontalAlign(GUIEditor_Label[1],"center",false) end addEventHandler("onClientResourceStart",getResourceRootElement(),startup) function visibile() if (guiGetVisible(GUIEditor_Window[1])) then showCursor(false) guiSetVisible(GUIEditor_Window[1],false) else showCursor(true) guiSetVisible(GUIEditor_Window[1],true) end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), visibile) function warpbasehunters () setElementPosition ( getLocalPlayer(), 40, 40, 40 ) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], warpbasehunters, false ) function warpbasereaper () setElementPosition ( getLocalPlayer(), 10, 10, 20 ) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], warpbasereaper, false ) function warpbasestalkers () setElementPosition ( getLocalPlayer(), 0, 0, 0 ) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], warpbasestalkers, false ) function CreateSelectorWindow() wdwselector = guiCreateWindow(0.438,0.880,0.15,0.10,"",true) guiWindowSetMovable(wdwselector,false) btnLeft = guiCreateButton(0.0,0.4,0.200,0.350,"<-",true,wdwselector) btnRight = guiCreateButton(0.76,0.4,0.200,0.350,"->",true,wdwselector) btnSelect = guiCreateButton(0.30,0.4,0.400,0.350,"Seleziona",true,wdwselector) guiSetVisible(wdwselector, false) end function selezionaskin () CreateSelectorWindow() addEventHandler("onClientGUIClick", btnLeft, clientSkinLeft, false) addEventHandler("onClientGUIClick", btnSelect, clientSkinSelect, false) addEventHandler("onClientGUIClick", btnRight, clientSkinRight, false) if (wdwselector ~= nil) then guiSetVisible(wdwselector, true) triggerServerEvent("FrontCamera", getLocalPlayer()) end showCursor(true) end function clientSkinSelect(button) guiSetVisible(wdwselector, false) guiSetVisible(memo, false) showCursor(false) triggerServerEvent("SkinSelected", getLocalPlayer()) end function clientSkinRight(button) triggerServerEvent("SkinRight", getLocalPlayer()) end function clientSkinLeft(button) triggerServerEvent("SkinLeft", getLocalPlayer()) end addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], selezionaskin, false ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], selezionaskin, false ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], selezionaskin, false )
-
You want to get the resource to start ? whith his name ?
-
So only 1 solution: 1 addEventHandler( "onClientGUIClick", ... ) for each button
-
Hi, parent1 and parent2 are not a GUIElement so onClientGUIClick doesn't work. Maybe replace it by onClientClick ? Also you can "say" to the server that is a GUIElement like (I'm not sure) parent1 = createElement ( "gui", "parent1" ) -- or parent1 = createElement ( "GUI", "parent1" ) -- or parent1 = createElement ( "guiElement", "parent1" ) -- etc
-
Because... You'r welcome
-
No problem See you soon for another problem I'm kidding
-
Hi, There are no function for that ( except the string.find like you said ) You have to create a loop in which the server get 1 by 1 a word from the table then make a string.find if in a loop it return true, you can break the loop and make your instructions. Put here your table ( all we need for understand the table )
-
"attempt to preform arithmetic on a boolean value"?!? help!!
Citizen replied to blurryshadow1's topic in Scripting
Sorry my bad ( I don't know why but I didn't see the script ) so it's not setElementData but setAccountData: function resetKills() local theAccount = getPlayerAccount(source) setAccountData(theAccount, "Kills", 0 ) end addEventHandler( "onPlayerJoin", getRootElement(), resetKills ) -
I'm not a superHero so I can't find the problem in the client-side if you put only the server-side Ok so try this: ( All the onClientGUIClick after the creation. And their functions before ): GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), function() bindKey ( "F6", "down", showMoneySend) end ) function showMoneySend () if ( guiGetVisible ( GUIEditor_Window[111] ) == false ) then showMoneySendStart() elseif ( guiGetVisible ( GUIEditor_Window[111]) == true ) then guiSetVisible( GUIEditor_Window[111], false ) showCursor(false) end end function onClickPlayerList() if source == playersList then local playergrd = guiGridListGetItemText(playersList,guiGridListGetSelectedItem(playersList),1) guiSetText(GUIEditor_Edit[111],tostring(playergrd)) end end function onUpdateMoneyplayersList() guiGridListClear(playersList) for id, playeritem in ipairs (getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, 1, getPlayerName(playeritem), false, false) end end addEventHandler("onClientPlayerJoin", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerQuit", getRootElement(), onUpdateMoneyplayersList) addEventHandler("onClientPlayerChangeNick", getRootElement(), onUpdateMoneyplayersList) function giveMoneySend ( ) outputChatBox("1") edit1 = guiGetText ( GUIEditor_Edit[111] ) edit2 = guiGetText ( GUIEditor_Edit[112] ) triggerServerEvent ( "theMoney", getLocalPlayer(),edit1,edit2) end function showMoneySendStart() showCursor(true) GUIEditor_Window[111] = guiCreateWindow(0.2609,0.3203,0.5219,0.5518,"Send Money Panel (F6 close/open )",true) GUIEditor_Edit[111] = guiCreateEdit(0.5808,0.1805,0.3743,0.0850,"",true,GUIEditor_Window[111]) GUIEditor_Label[111] = guiCreateLabel(0.4566,0.1929,0.1078,0.0637,"Player:",true,GUIEditor_Window[111]) guiLabelSetColor(GUIEditor_Label[111],255,255,255) guiLabelSetVerticalAlign(GUIEditor_Label[111],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[111],"left",false) GUIEditor_Edit[112] = guiCreateEdit(0.5823,0.3274,0.3713,0.0885,"",true,GUIEditor_Window[111]) GUIEditor_Label[112] = guiCreateLabel(0.4506,0.3434,0.1063,0.0602,"Money:",true,GUIEditor_Window[111]) guiLabelSetVerticalAlign(GUIEditor_Label[112],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[112],"left",false) GUIEditor_Image[111] = guiCreateStaticImage(0.5823,0.7009,0.3683,0.2832,"login/logo.png",true,GUIEditor_Window[111]) GUIEditor_Label[113] = guiCreateLabel(0.4401,0.4938,0.2575,0.2283,"Your mone: $",true,GUIEditor_Window[111]) guiSetText(GUIEditor_Label[113],"Your money: $ "..getPlayerMoney (getLocalPlayer())) guiLabelSetColor(GUIEditor_Label[113],51,255,0) guiLabelSetVerticalAlign(GUIEditor_Label[113],"top") guiLabelSetHorizontalAlign(GUIEditor_Label[113],"left",false) GUIEditor_Button[111] = guiCreateButton(0.4147,0.8673,0.1407,0.0549,"Give!",true,GUIEditor_Window[111]) playersList = guiCreateGridList(0.0524,0.1310,0.3323,0.7841,true,GUIEditor_Window[111]) local columnplayersList = guiGridListAddColumn(playersList, "Players", 0.85) if (columnplayersList) then for id, playeritem in ipairs(getElementsByType("player")) do local rowplayersList = guiGridListAddRow(playersList) guiGridListSetItemText(playersList, rowplayersList, columnplayersList, getPlayerName(playeritem), false, false) end end addEventHandler ( "onClientGUIClick",GUIEditor_Button[111], giveMoneySend) addEventHandler ( "onClientGUIClick", playersList, onClickPlayerList, false ) end