Jump to content

WhoAmI

Members
  • Posts

    1,248
  • Joined

  • Last visited

Everything posted by WhoAmI

  1. Client local posX, posY, posZ = 2584.9523925781, -2209.318359375, 1.9927320480347 function loginHandler(username, password) outputChatBox ( username .. ":" .. password ) local account = getAccount(username, password) if (account ~= false) then local loggin = logIn(source, username, password) if ( loggin ) then spawnPlayer(source, posX, posY, posZ) fadeCamera(source, true) setCameraTarget(source, source) setPedArmor(source, 100) setElementModel(source, 287) outputChatBox("Wow, you actually made it on", source) triggerClientEvent(source, "hideLoginWindow", source) end else outputChatBox("Invalid username or password!",source) end end addEvent("submitLogin", true) addEventHandler("submitLogin", getRootElement(), loginHandler) Server local playerName = getPlayerName(localPlayer) local guiElements = { } function clientSubmitLogin() local username = guiGetText(guiElements["edit_user"]) local password = guiGetText(guiElements["edit_pass"]) if ( username ~= "" and password ~= "" ) then triggerServerEvent("submitLogin", localPlayer, username, password) outputChatBox ( username .. ":" .. password ) else outputChatBox("Please enter a username and password.") end end end function createLoginWindow() guiElements["login_window"] = guiCreateWindow(0.375, 0.375, 0.25, 0.25, "Please Log In", true) guiCreateLabel(0.0825, 0.375, 0.25, 0.25, "Username", true, guiElements["login_window"]) guiCreateLabel(0.0825, 0.5, 0.25, 0.25, "Password", true, guiElements["login_window"]) guiElements["edit_user"] = guiCreateEdit(0.415, 0.25, 0.5, 0.15, "", true, guiElements["login_window"]) guiElements["edit_pass"] = guiCreateEdit(0.415, 0.5, 0.5, 0.15, "", true, guiElements["login_window"]) guiEditSetMaxLength(guiElements["edit_user"], 20) guiEditSetMaxLength(guiElements["edit_pass"], 20) guiElements["login_button"] = guiCreateButton(0.415, 0.7, 0.25, 0.20, "Log In", true, guiElements["login_window"]) addEventHandler("onClientGUIClick", guiElements["login_button"], clientSubmitLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(), function () createLoginWindow() outputChatBox("Welcome to My MTA:SA Server, please log in.") showCursor(true) guiSetInputEnabled(true) end ) function hideLoginWindow() guiSetInputEnabled(false) showCursor(false) if ( isElement ( guiElements["login_window"] ) ) then destroyElement ( guiElements["login_window"] ) end end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow) Tell me if in chat it shows "login:password" two times.
  2. Can I do this my way?
  3. Sorry again function clientSubmitLogin() local username = guiGetText(edtUser) local password = guiGetText(edtPass) if ( username ~= "" and password ~= "" ) then triggerServerEvent("submitLogin", localPlayer, username, password) else outputChatBox("Please enter a username and password.") end end
  4. Oh, damn. Sorry, my bad local posX, posY, posZ = 2584.9523925781, -2209.318359375, 1.9927320480347 function loginHandler(username, password) local account = getAccount(username, password) if (account ~= false) then if (logIn(source, username, password) == true) then spawnPlayer(source, posX, posY, posZ) fadeCamera(source, true) setCameraTarget(source, source) setPedArmor(source, 100) setElementModel(source, 287) outputChatBox("Wow, you actually made it on", source) triggerClientEvent(source, "hideLoginWindow", source) end else outputChatBox("Invalid username or password!",source) end end addEvent("submitLogin", true) addEventHandler("submitLogin", getRootElement(), loginHandler)
  5. Server local posX, posY, posZ = 2584.9523925781, -2209.318359375, 1.9927320480347 function loginHandler(username, password) local account = getAccount(username, password) if (account ~= false) then if (logIn(source, username, password) == true) then spawnPlayer(source, posX, posY, posZ) fadeCamera(source, true) setCameraTarget(source, source) setPedArmor(source, 100) setElementModel(source, 287) outputChatBox("Wow, you actually made it on", source) triggerClientEvent(source, "hideLoginWindow", source) end else outputChatBox("Invalid username or password!",source) end end end addEvent("submitLogin", true) addEventHandler("submitLogin", getRootElement(), loginHandler) function dieInServer() spawnPlayer(source, posX, posY, posZ) fadeCamera(source, true) setCameraTarget(source, source) setPedArmor(source, 100) setElementModel(source, 287) outputChatBox("And.... BAM! You're back!", source) end addEventHandler("onPlayerWasted",getRootElement(),dieInServer) By they way, localPlayer is predefinied variable in MTA, so you don't have to add this in the top of code. Personnaly I would do something like that: local playerName = getPlayerName(localPlayer) function clientSubmitLogin() local username = guiGetText(edtUser) local password = guiGetText(edtPass) if ( username ~= "" and password ~= "" ) then triggerServerEvent("submitLogin", localPlayer, username, password) else outputChatBox("Please enter a username and password.") end end end function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) X = 0.0825 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.25 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLength(edtUser, 20) guiEditSetMaxLength(edtpass, 20) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.20 bntLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin, false) end addEventHandler("onClientResourceStart", getResourceRootElement(), function () createLoginWindow() outputChatBox("Welcome to My MTA:SA Server, please log in.") showCursor(true) guiSetInputEnabled(true) end ) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) destroyElement ( wdwLogin ) showCursor(false) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
  6. What is the error now?
  7. local localPlayer = getLocalPlayer() local playerName = getPlayerName(localPlayer) function clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtUser) local password = guiGetText(edtPass) if username and password then triggerServerEvent("submitLogin", getRootElement(), localPlayer, username, password) else outputChatBox("Please enter a username and password.") end end end function createLoginWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 wdwLogin = guiCreateWindow(X, Y, Width, Height, "Please Log In", true) X = 0.0825 Width = 0.25 Height = 0.25 guiCreateLabel(X, Y, Width, Height, "Username", true, wdwLogin) Y = 0.5 guiCreateLabel(X, Y, Width, Height, "Password", true, wdwLogin) X = 0.415 Y = 0.25 Width = 0.5 Height = 0.15 edtUser = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) Y = 0.5 edtPass = guiCreateEdit(X, Y, Width, Height, "", true, wdwLogin) guiEditSetMaxLength(edtUser, 20) guiEditSetMaxLength(edtpass, 20) X = 0.415 Y = 0.7 Width = 0.25 Height = 0.20 bntLogin = guiCreateButton(X, Y, Width, Height, "Log In", true, wdwLogin) addEventHandler("onClientGUIClick", btnLogin, clientSubmitLogin) end addEventHandler("onClientResourceStart", getResourceRootElement(), function () createLoginWindow() outputChatBox("Welcome to My MTA:SA Server, please log in.") showCursor(true) guiSetInputEnabled(true) end ) function hideLoginWindow() guiSetInputEnabled(false) guiSetVisible(wdwLogin, false) showCursor(false) end addEvent("hideLoginWindow", true) addEventHandler("hideLoginWindow", getRootElement(), hideLoginWindow)
  8. local pos = getElementPosition(thePlayer) local x,y,z = -2337.544921875, -1618.7431640625, 483.71304321289 function toxic (thePlayer) if x,y,z == "pos" then outputChatBox("Bạn bị nhiễm phóng xạ từ boss") setElementData(player,"blood",-1000) end end setTimer(toxic,10000,0)
  9. local x,y,z = getElementPosition(thePlayer) local x1,y1,z1 = -2337.544921875, -1618.7431640625, 483.71304321289 function toxic (thePlayer) if x == x1 and y == y1 and z == z1 then outputChatBox("Bạn bị nhiễm phóng xạ từ boss") setElementData(player,"blood",-1000) end end setTimer(toxic,10000,0)
  10. WhoAmI

    Dx Text

    So somewhere in your function after adding pizza to player change the value of this variable.
  11. WhoAmI

    Dx Text

    Attach this text to variable, and just change it value. local text = 3 addEventHandler ( "onClientRender", root, function ( ) dxDrawText ( text, ... ) end ) addCommandHandler ( "change", function ( player, cmd, n ) if ( n ) then text = text + tonumber ( n ) end end ) Then if you type /change 3 it will add this number to your variable, so it will display "6".
  12. local marker = createMarker(-1556.1298828125,-530.66552734375,13.1484375,"cylinder",1.5,230,0,85,225) -- это будет маркер в обычном мире, т.е. в нулевом измерении addEventHandler("onMarkerHit",marker, function (hitElement, matchingDimension) if getElementType (hitElement) == 'player' and matchingDimension then if ( isPedInVehicle ( hitElement ) ) then return end setElementPosition (hitElement,-3037.6647949219,1605.0709228516,39.676563262939) setElementDimension (hitElement, 500) end end) local markerD = createMarker(-3028.0424804688,1649.7550048828,38.817188262939,"cylinder",1.5,230,0,85,225) -- это уже будет маркер в другом измерении setElementDimension (markerD, 500) -- 5 - ид измерения addEventHandler("onMarkerHit",markerD, function (hitElement, matchingDimension) if getElementType (hitElement) == 'player' and matchingDimension then if ( isPedInVehicle ( hitElement ) ) then return end setElementPosition (hitElement,-1512.4594726563,-517.94372558594,14.1484375) setElementDimension (hitElement, 0) end end)
  13. It will. IPB uses this kind of encryption: md5 ( md5 ( token ) .. md5 ( password ) ) Token is stored in database, too. So in script you shall use only query.
  14. WhoAmI

    Tyres

    local x, y, z = getElementPosition ( player ) local _, _, rz = getElementRotation ( player ) outputChatBox ( rz ) local x, y = x, y+2.5 kolczatka [ player ] = createObject ( 2899, x, y, z-0.8, 0, 0, rz ) kCol [ player ] = createColCuboid ( x-1, y-2.5, z-0.8, 2, 5, 1 ) It creates well only if my "z" rotation is 90. Then it creates object in front of me, in other angles it doesn't work well.
  15. WhoAmI

    Tyres

    The 2892 is bigger one. I'm using right now createColCuboid. I just want to know how I can rotate it/create it on different angle.
  16. WhoAmI

    Tyres

    I want to place this object in front of me, that's all. Not in middle of me or other. Another question. It looks now like this http://scr.hu/4lpu/sbkq7 But how i can rotate a colshape, because colshape is still the same when I'm trying to put the object on differen angle. http://scr.hu/4lpu/8r4th setElementRotation doesn't work for me.
  17. WhoAmI

    Tyres

    Like this http://scr.hu/4lpu/lk1hr
  18. WhoAmI

    Tyres

    Hello. I thought that object 2899 destroys tyres by itself, but as I can see it doesn't. Is there any function to destroy them? And shall I use colision for it or is there any other way to do that? Also, How i can do that I'm putting this object on front of me? Not like this: http://scr.hu/4lpu/7x9fs
  19. Looks very fresh and everything looks clearly. GJ.
  20. Spróbuj też zaktualizować sterowniki do karty graficznej oraz zainstaluj najnowszego DirectX'a.
×
×
  • Create New...