-
Posts
85 -
Joined
-
Last visited
Posts posted by Stylez
-
-
i tried to trigger bindKey function to client side. Maybe, u can fix my code so it triggers bindKey function to clientside?
-
Good Evening everybody
i have this small script. You should understand what i am trying to do.. i know where i have problem. But i cant solve it
the problem is in local vehicle = getPedOccupiedVehicle(source) - source argument.. but as i said, i cant solve this problem
Here is the code
function bind() local vehicle = getPedOccupiedVehicle(source) if vehicle then local driver = getVehicleOccupant(vehicle) if driver then bindKey(source, "m", "down", bind) triggerClientEvent(source, "bindKey", getRootElement(), "trigger") end else outputChatBox("u need to be in a car",source) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), bind)
-
no need anymore, i just tested everything. and it works now im gonna try to make it with SQL
-
ehm,
local account = getAccount(user, pass) if account then elseif account then addAccount(user, pass)
that's the same
and I don't see the event's of triggering the event; 'login'
you should recode the server side code.
hmm.. i edited serverside code. And now it works just like it should
Here's my full code, can u look if there is any problems/fails in it?
C
function loginas() local sWidth, sHeight = guiGetScreenSize() local width, height = 400, 400 local x = (sWidth/2) - (width/2) local y = (sHeight/2) - (height/2) mainWin = guiCreateWindow (x,y, width, height, "Hello, Please Log-In", false) guiWindowSetMovable(mainWin, false) guiWindowSetSizable(mainWin, false) user_Label = guiCreateLabel (150, 100, 100, 50, "Username:", false, mainWin) pass_Label = guiCreateLabel (150, 150, 100, 50, "Password:", false, mainWin) editUser = guiCreateEdit (150, 120, 150, 25, "", false, mainWin) editPass = guiCreateEdit (150, 170, 150, 25, "", false, mainWin) guiEditSetMasked(editPass, true) loginBtn = guiCreateButton (150, 215, 100, 30, "Login", false, mainWin) regBtn = guiCreateButton (150, 270, 100, 30, "Register", false, mainWin) guestBtn = guiCreateButton (150, 305, 100, 30, "Guest", false, mainWin) showCursor(true) guiSetInputEnabled(true) end addEventHandler ( "onClientResourceStart", resourceRoot, loginas ) addEventHandler("onClientGUIClick",getRootElement(), function() local user = guiGetText(editUser) local pass = guiGetText(editPass) if source == guestBtn then triggerServerEvent("guest", getLocalPlayer(), user, pass) elseif source == loginBtn then triggerServerEvent("login", getLocalPlayer(), user, pass) elseif source == regBtn then triggerServerEvent("inUse", getLocalPlayer(), user, pass) end end ) addEvent("setcol",true) addEventHandler("setcol",getRootElement(), function() guiSetVisible(mainWin,false) showCursor(false) guiSetInputEnabled(false) end )
S
addEvent("login", true) addEventHandler("login", getRootElement(), function(user, pass) local account = getAccount(user, pass) if account then logIn(source, account, pass) triggerClientEvent(source,"setcol", source) spawnPlayer(source, 2496.97, -1659.15, 15.30) fadeCamera(source, false, 1.0, 0, 0, 0) -- setTimer( fadeCamera, 500, 1, source, true, 0.5 ) setCameraTarget(source)-- outputChatBox("Welocme To Cops & Robbers Server.", source, 55,150,0) else outputChatBox("#FFAE00Warning: Wrong username or password.", source) end end ) addEvent("inUse", true) addEventHandler("inUse", getRootElement(), function(user, pass) local isUsedAccount = getAccount(user, pass) if isUsedAccount then outputChatBox("#FFA600 Warning: This account is already in use.", source) elseif not isUsedAccount then addAccount(user, pass) outputChatBox("#00A627 Succes. #FFFFFF Note: Remmember your Username: "..user.." And Password: "..pass, source,0,0,0, true) end end ) function spawnG() triggerClientEvent(source,"setcol", source) spawnPlayer(source, 2496.97, -1659.15, 15.30) fadeCamera(source, false, 1.0, 0, 0, 0) -- setTimer( fadeCamera, 500, 1, source, true, 0.5 ) setCameraTarget(source)-- outputChatBox("Welocme To Cops & Robbers Server. Remember You are guest", source,55,150,0) end addEvent("guest", true) addEventHandler("guest", getRootElement(), spawnG)
-
Oh now it works.. made a stupid mistake . btw. it dosent outputs debugscript errors into server log file
-
there is few errors, in debugscript. Is there any way to copy the errors?
-
oh thanks. but now, i dont understand why it doesnt creates buttons and edit fields.. everything is seems to be okey.
-
Hi, again. So i have this login, register, guest, Gui window which should work properly but, i cant see the problem why window doesnt shows up. And there is no errors in debugscript 3 heres the code C
function loginas() local sWidth, sHeight = guiGetScreenSize() local width, height = 400, 400 local x = (sWidth/2) - (width/2) local y = (sHeight/2) - (height/2) mainWin = guiCreateWindow (x,y, width, height, "Hello, Please Log-In", false) guiWindowSetMovable(mainWin, false) guiWindowSetSizable(mainWin, false) user_Label = guiCreateLabel (175, 100, 100, 50, "Username:", false, mainWin) pass_Label = guiCreateLabel (175, 150, 100, 50, "Password:", false, mainWin) guiEditSetMasked(pass_Label, true) editUser = guiCreateEdit (175, 125, 150, 25, false, mainWin) editPass = guiCreateEdit (175, 175, 150, 25, false, mainWin) loginBtn = guiCreateButton (175, 200, 150, 50, false, mainWin) regBtn = guiCreateButton (175, 225, 150, 50, false, mainWin) guestBtn = guiCreateButton (175, 250, 150, 50, false, mainWin) showCursor(true) guiSetInputEnabled(mainWin, true) end addEventHandler("onClientGUIClick",getRootElement(), function() local user = guiGetText(editUser) local pass = guiGetText(editPass) if source == guestBtn then guiSetVisible(loginas, false) showCursor(false) guiSetInputEnabled(false) elseif source == loginBtn then triggerServerEvent("login", getLocalPlayer(), user, pass) elseif source == regBtn then triggerServerEvent("inUse", getLocalPlayer(), user, pass) end end ) addEvent("setcol",true) addEventHandler("setcol",getRootElement(), function() guiSetVisible(loginas,false) showCursor(false) guiSetInputEnabled(false) end )
S
addEvent("login", true) addEventHandler("login", getRootElement(), function(user, pass) local account = getAccount(user, pass) if account then logIn(source, account, pass) triggerClientEvent(source,"setcol", source) else outputChatBox("#FFAE00Warning: Wrong username or password.", source) end end ) addEvent("inUse", true) addEventHandler("inUse", getRootElement(), function(user, pass) local account = getAccount(user, pass) if account then outputChatBox("#FFAE00Warning: This account is already in use.", source) elseif account then addAccount(user, pass) outputChatBox("#00A627Succes. #FFFFFFNote: Remmember your Username: "..user.." And Password: "..pass, source,0,0,0, true) end end )
-
I dont know.. it spawns me somwhere in mountains, and shows blue sky.. It should spawn me in Grove Street and should be able to move,
-
nothing ;o
-
i removed all resources.
-
it works now, but it doesnt spawns me, just shows blue sky.
-
same problem
-
ERROR: Client triggered serverside event guestLogin, but event is not added serverside.. wut? addEvent("guestLogin", true)
-
Hello. Im trying to make guest button. but im keep getting this error : WARNING: guset/testC.lua36: Bad argument @ AddEventHandler [Expected element a argument 2, got nil]
Here is the code
function myfirstwindow() local swidth, sheight = guiGetScreenSize() local width, height = 400, 400 local x = (swidth/2) - (width/2) local y = (sheight/2) - (height/2) window1 = guiCreateWindow(x, y, width, height, "Title", false) -- MAIN WINDOW guiWindowSetMovable(window1, false) guiWindowSetSizable(window1, false) --Button guestBtn = guiCreateButton(160,370,70,30, "Play as Guest", false, window1) addEventHandler("onClientGUIClick", guestBtn, window1buttonresponse, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() myfirstwindow() outputChatBox("Wlcome to MTA:SA Cops & Robbers Server. Please Log-In") if window1 ~= nil then guiSetVisible(window1, true) else outputChatBox("An error has occured") end showCursor(true) guiSetInputEnabled(true) end ) function window1buttonresponse(button, state) if button == 'left' and state == 'up' then guiSetVisible(window1, false) showCursor(false, false) end end addEventHandler("onClientGUIClick", guestBtn, function() -- local source = guest if (source == guest)then -- triggerServerEvent("guestLogin", getRootElement()) guiSetVisible(loginWindow, false) showCursor(false) end end)
SERVER
client = source -- addEvent("guestLogin", true) addEventHandler("guestLogin", root, function () spawnPlayer(client, 2505.52, -1741.73, 2072.98) fadeCamera(client, false, 1.0, 0, 0, 0) -- setTimer( fadeCamera, 500, 1, client, false, 0.5 ) -- outputChatBox("Welocme To Cops & Robbers Server. Remember You are guest", client) end )
-
but it doesnt creates button. why? i deleted 2 spaces between arguments.
-
oh, didint saw it. thankyou
-
hi, i made a gui script from intro. to gui scripting but i did it with absolute position and window doesnt shows up. heres the code
CLIENT
function createLoginWindow local sWidth, sHeight = guiGetScreenSize() local width, height = 450, 450 local x = (sWidth/2) - (width/2) local y = (sHeight/2) - (height/2) loginWindow = guiCreateWindow(x,y, width, height, "Please Log-In", false) guiWindowSetMovable (loginWindow, false) guiWindowSetSizable (loginWindow, false) guiCreateLabel(190,50,35, 25, "Username", false, loginWindow) guiCreateLabel(190,100, 35,25, "Password", false, loginWindow ) editUser = guiCreateEdit(190,75,100,40, "", false, loginWindow) editPass = guiCreateEdit(190, 125, 100, 40, "", false, loginWindow) guiEditSetMaxLength(editUser, 50) guiEditSetMaxLenght(editPass, 50) button = guiCreateButton (190, 250, 50, 50, "Submit", false, loginWindow) guiSetVisible(loginWindow, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createLoginWindow() outputChatBox("Wlcome to MTA:SA Cops & Robbers Server. Please Log-In") if loginWindow ~= nil then guiSetVisible(loginWindow, true) else outputChatBox("An error has occured") end end ) function submit (button, state) if button == "left" and state =="up" then local username = guiGetText(editUser) local password = guiGetText(editPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), username, password) guiSetInputEnabled(false) guiSetVisible(loginWindow, false) showCursor(false) else outputChatBox("Please Enter Username And Password") end end end addEventHandler("onClientGUIClick", button, submit, false)
SERVER
function loginHandler(username, password) if username == "user" and password =="apple" then if client then spawnPlayer(client, 2505.52, -1741.73, 2072.98) fadeCamera(client, true) setCameraTarget(client, client) outputChatBox("Welocme To Cops & Robbers Server", client) end else outputChatBox("Invalid username or Password. Please try again", client) return end end addEvent("submitLogin", true) addEventHandler("submitLogin", root, loginHandler)
-
I think i fixed the problem i don't know how, but i did it. Here is what i did :
1. Updated MTA 1.2 version to latest 1.2 version.
2. Started server.bat typed in "start editor".
3. Deleted editor_test and _dump folders.
4. Disabled auto-save function in editor.
5. Mapped all day long without any issues.
-
No, it doesn't. I have read about spaces in names too. The problem is that i can see all my objects in .map file but not in map editor...
-
Hello. Few days ago i begun to map race map, i had over 2k lines of objects in my .map file when i saved the map.
But next day i opened my saved map with map editor,and i saw that half of my map work was disappeared. Then i immediately opened my .map file with notepad++ to check if it contains same amount of objects. Yes, there still was 2k lines of objects. But those 2k of objects didn't appeared in map editor and map editor test mode. i was using MTA. 1.3.1 version.
Then to solve this problem i searched on different forums, and i found the solution for this problem in this topic Fixing Bugged editor(Shits) in ffsgaming forum, tutorials section.(i don't know why i cant put full url link?)
But it didn't helped me with my problem... I also tried to delete editor_dump and editor_test folders, but still objects don't show up in map editor.
Later i saw a map video on https://www.youtube.com/user/nitrontv?feature=results_main channel, and i noticed that most of maps where he films, version of MTA is 1.2
so i decided to install MTA 1.2 to check if it solves my problems.. i also deleted editor_dump and editor_test folders and turned off auto-save function as it shows on ffsgaming topic. But problem is still there, and i cant figure out why my map editor cant open maps fully loaded?!!?
Please anyone help to solve this problem
BTW. i cant understand how professional mappers manage to save their maps correctly. Without having any problems like mine.
P.s my English is poor :]
-
liar, liar u'r pants on fire!
-
-
hmm, i've got another problem now i created allmost the same script ass the 1st one, but this one shows Err. message; attempt to call global 'getPedOccupedVehicle' (a nil value)
function uzkurti (thePed) local theVehicle = getPedOccupedVehicle(source) if theVehicle then if getVehicleEngineState(theVehicle, false) then setVehicleEngineState(theVehicle, true) end end end function kurti () bindKey(source,"lalt", "down", uzkurti) end addEventHandler("onPlayerVehicleEnter", getRootElement(), kurti)
script help
in Scripting
Posted
Nonono. i want to trigger bindKey function to client side. i tried to bind M key with "onClientPlayerVehicleEnter" but it didint worked for me, so i tried another way.