-
Posts
210 -
Joined
-
Last visited
Everything posted by Fabio(GNR)
-
I will try that, but it is a variable i want to change, like A = getPlayerName and then -remove something from A- were A is a variable ofcourse. EDIT: It gives a unexpected symbol near return, my code: B = getElementPosition ( player ) A = return string.gsub ( "B", "GNR", "" ) This is just an example because there is no GNR in a position
-
Let's say someone enters "GNR45" in a chatbox or something ( not really chat, just example ) it should instead of giving GNR45 only give 45. So GNR cut off
-
Hello, i just started scripting again and i'm having a problem: Im passing a argument to a syntax, but the argument is i.e iwant2 . i want to remove the iwant before i pass it to the syntax, how? Thanks
-
all, but try to write something yourself
-
Thanks will try as soon as possible EDIT: it Worked Thanks, again ( blue smiley ftw )
-
hehe please re-read i kinda forgot the latest function
-
but i have that: --Client function showgui () weapwindow = guiCreateWindow(307,127,480,516,"Weapons Menu",false) BuyAK = guiCreateButton(95,76,117,59,"Ak47 - 500$",false,weapwindow) BuyM4 = guiCreateButton(96,154,116,57,"M4 - 600$",false,weapwindow) BuyMP5 = guiCreateButton(97,302,116,57,"MP5 - 400$",false,weapwindow) BuyUZI = guiCreateButton(96,227,116,57,"UZI - 350$",false,weapwindow) BuyShotgun = guiCreateButton(278,300,117,59,"Shotgun - 400$",false,weapwindow) BuyComShot = guiCreateButton(278,227,117,59,"Combat Shotgun - 450$",false,weapwindow) BuyDeagle = guiCreateButton(277,76,117,59,"Deagle - 200$",false,weapwindow) BuyPistol = guiCreateButton(277,152,117,59,"Pistol - 150$",false,weapwindow) CloseButton = guiCreateButton(180,375,108,41,"Close",false,weapwindow) Text_Memo = guiCreateMemo(97,435,260,45,"You can buy weapons here for in DM.",false,weapwindow) guiMemoSetReadOnly(Text_Memo,true) guiSetVisible ( weapwindow, true ) showCursor(true) addEventHandler("onClientGUIClick", BuyAK, getAK, false) addEventHandler("onClientGUIClick", CloseButton, hidegui, false) end function hidegui() if guiGetVisible ( weapwindow ) then -- if it is, we hide it guiSetVisible ( weapwindow, false ) showCursor( false ) end end addCommandHandler ( "weapons", showgui ) function getAK ( playerSource ) local money = getPlayerMoney ( client ) if (money > 500) then triggerServerEvent( "playerwantsAK", getLocalPlayer(), client) else outputChatBox("You don't have enough cash.", client,230,0,0) end end --Server addEvent("playerwantsAK",true) addEventHandler("playerwantsAK",getRootElement(), function (client) if getElementData( client, "hasAK") == true then giveWeaponAmmo(client, 30, 450) outputChatBox("You got ammo for: AK",source,0,230,0) else givetheAK = giveWeapon(client, 30, 400, true) if givetheAk == true then setElementData( client, "hasAK", true) outputChatBox("You now have a: AK",source,0,230,0) else outputChatBox("failed to give AK",source,0,230,0) end end end )
-
I actually already tried this multiple times but i cant get it to work, how to "use" the element serverside after? EDIT: btw, a player element
-
but this doesnt fix anything for passing the element right?? Thanks tough
-
why do you use tostring and stuff try the exact same i did EDIT: im sorry but i don't think i can help you
-
Show me the eventHandlers or what you use I solved that, I had to put false at the end Still having getPlayerMoney bug.. Is there any other way on getting a player's money? Oh ok theres the "strike" for It should just work, really weird i'll try something and see if i get problems EDIT: Works for me, i did ( at result of clicking GUI button, to test: ) outputChatBox("you cash is: "..getPlayerMoney(client),client) and it resulted in giving me my cash number, so it must be the element...
-
So i created a GUI, script and everything that i think will work but i can't find a good way to pass the "client" element Client: function showgui () weapwindow = guiCreateWindow(307,127,480,516,"Weapons Menu",false) BuyAK = guiCreateButton(95,76,117,59,"Ak47 - 500$",false,weapwindow) BuyM4 = guiCreateButton(96,154,116,57,"M4 - 600$",false,weapwindow) BuyMP5 = guiCreateButton(97,302,116,57,"MP5 - 400$",false,weapwindow) BuyUZI = guiCreateButton(96,227,116,57,"UZI - 350$",false,weapwindow) BuyShotgun = guiCreateButton(278,300,117,59,"Shotgun - 400$",false,weapwindow) BuyComShot = guiCreateButton(278,227,117,59,"Combat Shotgun - 450$",false,weapwindow) BuyDeagle = guiCreateButton(277,76,117,59,"Deagle - 200$",false,weapwindow) BuyPistol = guiCreateButton(277,152,117,59,"Pistol - 150$",false,weapwindow) CloseButton = guiCreateButton(180,375,108,41,"Close",false,weapwindow) Text_Memo = guiCreateMemo(97,435,260,45,"You can buy weapons here for in DM.",false,weapwindow) guiMemoSetReadOnly(Text_Memo,true) guiSetVisible ( weapwindow, true ) showCursor(true) addEventHandler("onClientGUIClick", BuyAK, getAK, false) addEventHandler("onClientGUIClick", CloseButton, hidegui, false) end function hidegui() if guiGetVisible ( weapwindow ) then guiSetVisible ( weapwindow, false ) showCursor( false ) end end addCommandHandler ( "weapons", showgui ) function getAK ( playerSource ) local money = getPlayerMoney ( client ) if (money > 500) then outputChatBox("You don't have enough cash", client,230,0,0) triggerServerEvent( "playerwantsAK", getLocalPlayer(), client) else outputChatBox("You don't have enough cash.", client,230,0,0) end end Server: addEvent("playerwantsAK",true) addEventHandler("playerwantsAK",getRootElement(), function (client) if getElementData( client, "hasAK") == true then giveWeaponAmmo(client, 30, 450) outputChatBox("You got ammo for: AK",source,0,230,0) else givetheAK = giveWeapon(client, 30, 400, true) if givetheAk == true then setElementData( client, "hasAK", true) outputChatBox("You now have a: AK",source,0,230,0) else outputChatBox("failed to give AK",source,0,230,0) end end end )
-
lol bumping a 3 year old script, anyway i dont think the script works
-
Show me the eventHandlers or what you use
-
PLEASE NOTE This is not a thread for REQUESTING scripters. This is a thread to avoid people requesting scripters, because there used to be dozens of those threads and almost NONE of them actually got what they asked for
-
Thanks will try that order EDIT: Worked thanks Scooby and JesseUnit
-
Don't you need it for buttons? but i also set it to false so....
-
You Are My Hero!!!!!! It worked Thanks YES
-
Tried, but thanks
-
well title describes, ( part of ) script: function hidegui() if guiGetVisible ( weapwindow ) then guiSetInputEnabled ( false ) guiSetVisible ( weapwindow, false ) showCursor( false, false ) end end function showgui () weapwindow = guiCreateWindow(307,127,480,516,"Weapons Menu",false) CloseButton = guiCreateButton(180,375,108,41,"Close",false,weapwindow) guiSetVisible ( weapwindow, true ) showCursor(true) addEventHandler("onClientGUIClick", CloseButton, hidegui, false) guiSetInputEnabled(true) --end end The window goes away but im not able to use chatbox, keys ( walking etc. ) or the mouse ( well except the cursor )
-
Thanks but, i get the same error as before, at setElementID well that's strange, cause i had a server running and even have tested the code i posted above, it worked. Then it really strange, do you use nightly? me is nothing at your code, so i worked that in but then it gave setElementID before it gave attempt to perfom arithmetic on local "y"(a nil value) EDIT; oh you edited and the answer is uh No.... i like copied a other meta but that was wrong hehe BUT Thanks alot!! Works great now thanks Aiboforcen and Doomed_Space_Marine Really appreciated
-
Thanks but, i get the same error as before, at setElementID
-
yes i was in the server but it wont even get further then setElementID beceause its an ERROR, thanks for reply but do you know a other way to pass the drv element? ( one of the ways in vid )
-
beceause i tried in a function but it gives alots of errors beceause it is being run before the serverside stuff is done EDIT: this is what i got now: -- server me=getPlayerFromNick("Fabio(GNR)") x,y,z = getElementPosition(me) car=createVehicle(411,x,y+3,z) drv=createPed(104,x,y+2,z) setElementID(drv,"drv") warpPedIntoVehicle(drv,car) setTimer(startclient, 3000, 1) function startclient() triggerClientEvent("start",me) end Already gives me error: attempt to call global setElementID(a nil value) and if i put setElementID into startclient function, it gives bad argument at setTimer well: -- client addEvent("start",true) addEventHandler("start",me, function () drv = getElementByID("drv") drvctrls = {accelerate="u",brake_reverse="j",vehicle_left="h",vehicle_right="k",steer_forward="x",steer_back="c",vehicle_look_left="e",vehicle_look_right="r"} setTimer(addevent, 2000, 1) end) function ctrldrv() for ctrl,key in pairs(drvctrls) do setPedControlState(drv,ctrl,getKeyState(key)) end end function addevent() addEventHandler("onClientPreRender", getRootElement(), ctrldrv) end
-
No way to dont let this happen? why i do it this way is beceause im trying to control a driving ped ( doomedspacemarines vid on youtube ) and it worked but i want to experiment but typing all those command's gets annoying so i created the function that execute it after the timer i set in previous function EDIT: btw , the first function works, but the following give the bad argument