Nicorotom Posted April 14, 2010 Share Posted April 14, 2010 (edited) Hello, today i have created a client-side-script. Now i have transfered the Commands from the server-side-script to the client-side-script. But now i have a Problem with one of the Commands. Here is the Command: function alogin(passwort) if(passwort=="haha") then admin_eingeloggt=true outputChatBox("#00FF00Erfolgreich eingeloggt!",255,255,255,true) else outputChatBox("#FF0000Falsches Passwort!",255,255,255,true) end end Command Handler: addCommandHandler("alogin",alogin) But when i enter the Command /alogin haha the server says: "Falsches Passwort!" Why is this so? Where is the Wrong Code? Thanks Greetings, Nicorotom Edited April 14, 2010 by Guest Link to comment
dzek (varez) Posted April 14, 2010 Share Posted April 14, 2010 1st thing: why you are doing something like admin if theres already ACL etc? Link to comment
Nicorotom Posted April 14, 2010 Author Share Posted April 14, 2010 Because i am a beginner in LUA Scripting, so i make the Command first and then i look at other methodes. Link to comment
Nicorotom Posted April 14, 2010 Author Share Posted April 14, 2010 So, the login is fixed. Now i have another problem: function avehicle(avehicle,model) if(admin_eingeloggt==true) then local x,y,z=getElementPosition(getLocalPlayer()) local r=getPedRotation(getLocalPlayer()) y=y+5 local vehiclename=getVehicleModelFromName(model) local vehicle=createVehicle(vehiclename,x,y,z) setVehicleRotation(vehicle,0,0,r) outputChatBox("#00FF00Vehicle mit dem Namen "..model.." gespawnt!",255,255,255,true) else outputChatBox("#FF0000Du bist nicht als Admin eingeloggt!",255,255,255,true) end end Handler: addCommandHandler("avehicle",avehicle) The Vehicle spawns, but i can't enter them Also when i use setVehicleLocked(vehicle,false) i can't enter the Vehicle! Link to comment
driver2 Posted April 14, 2010 Share Posted April 14, 2010 Just one thing about that admin login. Maybe it was just an excercise to learn scripting, but you should be aware that clientside scripts are not safe for that kind of things. That password could simply be read by looking at the script, since it is downloaded to each player. They are stored in MTA\mods\deathmatch\resources. Clientside scripts should never be used to do anything security related. Link to comment
MCvarial Posted April 14, 2010 Share Posted April 14, 2010 Also clientside vehicles aren't synced with the server so you can't enter them, both scripts should be done serverside... Link to comment
eAi Posted April 14, 2010 Share Posted April 14, 2010 Also clientside vehicles aren't synced with the server so you can't enter them, both scripts should be done serverside... As the wiki says, if you'd bother to read it. Link to comment
Nicorotom Posted April 14, 2010 Author Share Posted April 14, 2010 So, which Commands must be in a Server-Script an which in a Client-Script? Link to comment
dzek (varez) Posted April 14, 2010 Share Posted April 14, 2010 So, which Commands must be in a Server-Script an which in a Client-Script? all things that need to be synced should be done server side, and all things that no need to be synced - clientside. note that not all functions available client-side are avaiable server-side and vice versa Link to comment
Nicorotom Posted April 15, 2010 Author Share Posted April 15, 2010 Thank you People Please Close Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now