-
Posts
1,060 -
Joined
-
Last visited
-
Days Won
9
Everything posted by Addlibs
-
Are you sure that there are definitely no syntax errors or whatever in that file? The compiler will return an error if the code isn't correct, maybe you're missing an 'end' or something. Try loading the uncompiled file and see if it executes. I'm pretty sure the compiler can process a lot larger files, larger than 5 MB.
-
The code is very messy, indentation isn't consistent, etc.
-
The main problem with your code, why the length is smaller than the length of the text, is because the bar is relative on both axis, and 1440x900 is a different aspect ratio to 800x600. What you'd want to do is just look at, for example, the width of the screen. local screenW, screenH = guiGetScreenSize() local scaleFactor = screenW / 1440 -- higher resoultion than 1440 means scaleFactor > 1, lower means scaleFactor < 1. dxDrawRectangle(0, 0, 50*scaleFactor, 200*scaleFactor) --This will draw a bar on the top left corner, on your native resoultion, 50 x 200 px, but on a 720x450 (half of your resolution), it would be 25 x 100 px, and on a 800x600 it would be 27.77 x 11.11 px
-
onClientPlayerChangeNick is a client-side event, why are you attaching a handler to it on the server side? Also, I'm assuming you do have some sort of rendering done for the notifications table, not just hoping that is displays itself somehow.
- 5 replies
-
- notification
- working
- (and 5 more)
-
He already figured it out over 8 hours ago (last update of post)
-
Maybe, but its better not to take chances, imo.
-
If you want to disable this security feature, go into the admin panel, resources tab, double click "adminp" in the list, then set the "securitylevel" settings to 1, or maybe even 0 - as long as its lower than 2, then restart adminp. However, this can expose you to the risk of someone modifying other people's element data so I advise you not to do that.
-
-- at the top of the script, outside any function local playerVehicles = {} -- to destroy previous vehicle of this player (before spawning new vehicle, or when player disconnects, etc) if isElement(playerVehicles[player]) then destroyElement(playerVehicles[player]) end -- when spawning, store the vehicle as (don't forget to attempt to destroy BEFORE spawning a new one) playerVehicles[player] = createVehicle(...)
-
Well, then at least make sure that the plate is truly unique, otherwise the script will get confused and you'll end up spawning the first vehicle which has the plate, regardless of the actual intended vehicle.
-
If this is SQLite, I believe all tables have by default a column "rowid" which is kinda hidden by default, and not selected when selecting *, so just try to SELECT rowid, * FROM that table and then use the rowid column for identification - for example, in a GUI with a gridlist, you'd want to guiGridListGetItemData to store the rowid there, and send the server a spawn request along with that rowid so the server can just select WHERE rowid = ?. This is the rowid column ^
-
The code above should work. The problem was I didn't convert the JSON back to Lua (the SDK sends arrays as JSON). (too much time passed for me to edit and append this message to the post above -.-) Also, you may wish to check response.connect_status when deciding whether to grant permission to log in. This value will be either "SUCCESS" or "VALIDATING", so you may block logins from accounts which haven't confirmed their email yet.
-
function UserLogin(userName,Password,Checksave) if not (userName == "") then if not (Password == "") then fetchRemote("http://forums.link.com/login.php", function(response,errno,player) local response = fromJSON(response) if type(response) == "table" then if response.status == "SUCCESS" then triggerClientEvent(player,"loginHide",getRootElement()) triggerClientEvent(player,"showNotification",player, "Successfully logged in!", "success") UserData("success", data["member_id"], data["name"], player, userName, Password, Checksave) else if response.msg == "ACCOUNT_NOT_FOUND" then triggerClientEvent(player,"showNotification",player, "Account doesn't exist!", "error") elseif response.msg == "ACCOUNT_INVALID_PASSWORD" then triggerClientEvent(player,"showNotification",player, "Password doesn't match!", "error") else outputDebugString("UNRECOGNISED RESPONSE @ "..getPlayerName(player)"'s login attempt.") end end elseif response == "ERROR" then triggerClientEvent(player,"showNotification",player, "Internal error. Please try again later. (Code "..errno..")", "error") outputDebugString("INTERNAL ERROR "..errno.." @ "..getPlayerName(player)"'s login attempt.") else outputDebugString("PARSING ERROR @ "..getPlayerName(player)"'s login attempt.") -- maybe the response was sent in a way other than a table, but its not an error either end end , toJSON({user=userName, pass=Password}), false, source) else triggerClientEvent(source,"showNotification",source, "Please enter your password!", "error") end else triggerClientEvent(source,"showNotification",source, "Please enter your username!", "error") end end addEvent("UserWantToLogin",true) addEventHandler("UserWantToLogin",getRootElement(),UserLogin) function UserData(Status,UserID,uName,player,userName,Password,Checksave) if Status == "success" then if not getAccount (UserID) then acc = addAccount(tostring(UserID),tostring(Password)) end if not getAccount(UserID,Password) then setAccountPassword(getAccount(UserID),Password) end local acc = getAccount ( UserID,Password) if(not isGuestAccount(acc)) then logOut(player); end logIn (player, acc, Password) setElementData(player,"getForumID",UserID) setElementData(player,"getForumName",uName) end end
-
Place the following file in the root of your IPS installation, where "init.php" is located. 'You should move to internally verifying the accounts. <?php include 'mta_sdk.php'; $_SERVER['SCRIPT_FILENAME'] = __FILE__; $path = ''; require_once $path . 'init.php'; \IPS\Session\Front::i(); $input = mta::getInput(); $username = $input[0]['user']; $password = $input[0]['pass']; $member = \IPS\Member::load($username, 'name'); if( !$member->member_id ) { mta::doReturn( array( 'status' => 'FAILED', 'msg' => 'ACCOUNT_NOT_FOUND', ) ); exit; } $salt = $member->members_pass_salt; $hash = crypt($password, '$2a$13$' . $salt); if (\IPS\Login::compareHashes($member->members_pass_hash, $hash) === TRUE) { mta::doReturn( array( "status" => "SUCCESS", "connect_status" => ( $member->members_bitoptions['validating'] ) ? 'VALIDATING' : 'SUCCESS', "email" => $member->email, "name" => $member->name, "connect_id" => $member->member_id, ) ); } else { mta::doReturn( array( 'status' => 'FAILED', 'msg' => 'ACCOUNT_INVALID_PASSWORD', ) ); } ?> The following is a sample Lua code based on your previous code. function UserLogin(userName,Password,Checksave) if not (userName == "") then if not (Password == "") then fetchRemote("[LINK]", function(response,errno,player) if type(response) == "table" then if response.status == "SUCCESS" then triggerClientEvent(player,"loginHide",getRootElement()) triggerClientEvent(player,"showNotification",player, "Successfully logged in!", "success") triggerClientEvent(player, "triggerLobby", player) UserData("success", data["member_id"], data["name"], player, userName, Password, Checksave) else if response.msg == "ACCOUNT_NOT_FOUND" then triggerClientEvent(player,"showNotification",player, "Account doesn't exist!", "error") elseif response.msg == "ACCOUNT_INVALID_PASSWORD" then triggerClientEvent(player,"showNotification",player, "Password doesn't match!", "error") end end elseif response == "ERROR" then triggerClientEvent(player,"showNotification",player, "Internal error. Please try again later. (Code "..errno..")", "error") end end , toJSON({user=userName, pass=Password}), false, source) else triggerClientEvent(source,"showNotification",source, "Please enter your password!", "error") end else triggerClientEvent(source,"showNotification",source, "Please enter your username!", "error") end end addEvent("UserWantToLogin",true) addEventHandler("UserWantToLogin",getRootElement(),UserLogin) None of this is tested but I skimmed through this and I think it should work.
-
--client -- [...] function showAndCloseWindow(command, state) if not guiGetVisible(updatesPanel) then guiSetVisible(updatesPanel, true) showCursor(true) requestUpdates() else guiSetVisible(updatesPanel, false) showCursor(false) end end bindKey("F1", "down", showAndCloseWindow) function requestUpdates() -- inquire for the updates text from the server triggerServerEvent("requestUpdates", localPlayer) end function getUpdates(updates) guiSetText(updatesMemo, updates) end addEvent("getUpdates", true) addEventHandler("getUpdates", root, getUpdates) -- [...] --server -- [...] function getUpdates() local file = "UpdatesLog.txt" local openFile = fileOpen(file) if not openFile then outputChatBox("Error loading file") return false end local size = fileGetSize(openFile) local updates = fileRead(openFile, size+500) fileClose(openFile) triggerClientEvent(client, "getUpdates", client, updates) end addEvent("requestUpdates", true) addEventHandler("requestUpdates", root, getUpdates) -- [...]
-
Perhaps you set as text the 'key' variable instead of 'updates'
-
I've made a quick correction (checking whether the file is open before reading its size) by swapping line 4 and 5 on the original reply, so just check the code again.
-
function getUpdates() local file = "UpdatesLog.txt" local openFile = fileOpen(file) if not openFile then outputChatBox("Error loading file") return false end local size = fileGetSize(openFile) local updates = fileRead(openFile, size) fileClose(openFile) triggerClientEvent(client, "getUpdates", client, updates) end Perhaps the file he wants to read is stored on the server?
-
Seems like everything should work. On another note however, why are you removing the player's bomb when he leaves the colshape even if he doesn't use it? (Line 28)
-
I'm pretty sure all you need to do is assign a material of a specific name to the plate geometry. You should open up a standard GTASA model and check the license plate there. Its also worth mentioning that you need two faces - one for the background of the plate (like LS plate, SF plate, LV plate) and another face for the actual auto-generated number.
-
If you're using a login panel, prevent the players from logging in while isTransferBoxActive() returns true (i.e. while there is any download going on) Side note, use a more descriptive title so you get the people who know how to help you. Many people who would know how to help you would just skip over this thread if they don't know what its about (especially when there's a lot of new threads to read and one must pick something, they'd go for the one they know what it is about)
-
--client function playsound() local x,y,z = getElementPosition(localPlayer) ... end --server triggerClientEvent("playsound",root,x,y,z) You're sending the XYZ coordinates but then ignoring them completely on the client and instead using the local player's position to spawn sound? This means sound will spawn in a different place for every player, more specifically - every player will get sound played at the position they're in, not where the speaker is. Change this to the following --client function playsound(x,y,z) ... end --server triggerClientEvent("playsound",root,x,y,z)
-
I'm fairly confident it should be possible using a displacement map as if it were a mask for morph or somehow, but I don't know how to write any sort of advanced shader.
-
Can you show us the part of the code where you call spawnNewZombie?