-
Posts
226 -
Joined
-
Last visited
Everything posted by Maurize
-
so im trying to create a script, that allows the players to move with mouseclick( with walking to the targetpoint animation ) & rotate camera with "a" and "d" ( ped & camera )... But now I'm unable to continue working on it, cause i don't know how to continue... Maybe some help, hints or something? Thanks.. multiData = getRootElement() singleData = getLocalPlayer() addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent( "onActorSpawn", singleData ) -- for spawning player! showCursor( true ) addEventHandler( "onClientRender", multiData, function() local px, py, pz = getElementPosition( singleData ) local rx, ry, rz = getElementRotation( singleData ) setCameraMatrix( px, py, pz + 35, px, py, pz, rz ) end ) bindKey( "a", "down", function() local rx, ry, rz = getElementRotation( singleData ) setElementRotation( singleData, rx - 90, ry, rz ) end ) bindKey( "d", "down", function() local rx, ry, rz = getElementRotation( singleData ) setElementRotation( singleData, rx, ry - 90, rz ) end ) bindKey( "mouse1", "down", function() local sx, sy, wx, wy, wz = getCursorPosition" class="kw4">getCursorPosition" class="kw4">getCursorPosition() setElementPosition( singleData, wx, wy, wz ) end ) end )
-
Solved, made simple mistake instead of guiElement4 i took guiElement3
-
on client side, getLocalPlayer is rootData, too, to prevent me for typing to much ;D // Still doens't say wrong password, on wrong password -.-
-
First sure this is for testing, to see if password get's saved and so on. Then, sry forgot : local rootMain = getRootElement() and then, solidsnake, if a player only enters numbers, the next time he trys to login fails, and says no password, but it is in database :oo this is weird, you know why?
-
So take a look at this, simply doenst make anything -.- Showing GUI & all, but I can insert every password like "nose" and login, even the true password is "uncle" -.- Can you see a mistake? addEvent( "onDataRegister", true ) addEventHandler( "onDataRegister", rootMain, function( code ) local weapon = { 2, 3, 5, 6, 7 } local user = getPlayerName( source ) local db = executeSQLSelect( "DatabaseValues", "*", "Name = '"..user.."'" ) local dbw = executeSQLSelect( "DatabaseWeapon", "*", "Name = '"..user.."'" ) if db and #db == 1 then if ( code == db[1]["Code"] ) then spawnPlayer( source, 2311.2, -9.4, 26.4, 0, db[1]["Skin"] ) giveWeapon( source, math.random( weapon[1], weapon[5] ), 1 ) setPlayerMoney( source, db[1]["Geld"] ) setElementHealth( source, db[1]["HP"] ) setPedArmor( source, db[1]["AP"] ) setCameraTarget( source, source ) fadeCamera( source, true, 3.0 ) else outputChatBox( "Falsches Passwort", source ) end else executeSQLInsert( "DatabaseValues", "'"..user.."', '"..code.."', '100', '0', '0', '78', '0', '0'" ) spawnPlayer( source, 2311.2, -9.4, 26.4, 0, 78 ) setCameraTarget( source, source ) fadeCamera( source, true, 3.0 ) end end ) and here clientside: local x, y = guiGetScreenSize() local guiElement1 = guiCreateWindow( x / 2 - 181, y / 2 - 43, 262, 86, "Identification Terminal ",false ) guiSetVisible( guiElement1, false ) local guiElement2 = guiCreateLabel( 8, 25, 248, 19, "User ID: "..getPlayerName( rootData ).."#"..math.random( 0, 10000 ), false, guiElement1 ) local guiElement3 = guiCreateLabel( 9, 53, 57, 17, "Code ID:", false, guiElement1 ) local guiElement4 = guiCreateEdit( 68, 48, 186, 30, "", false, guiElement1 ) guiSetFont( guiElement2, "clear-normal" ) guiSetFont( guiElement3, "clear-normal" ) addEventHandler("onClientResourceStart", resourceRoot, function() guiSetVisible( guiElement1, true ) showCursor( true ) fadeCamera( false, 0.5, 255, 255, 255 ) bindKey( "enter", "down", function() local data = guiGetText( guiElement3 ) if ( data ) then local code = tostring( data ) triggerServerEvent( "onDataRegister", rootData, code ) else outputChatBox( "No Inputdata found." ) end end ) end )
-
Nice, but I forgot, I've created a own aimcross .. A resident evil like one, now i have to know how i can use it to work with the world... EDIT: with guiCreateStaticImage... SOLVED: USE onClientPlayerTarget & disable default crosshair
-
Anyone an idea how to check this?
-
I don't know which function I should use & how to get, if the players x = 0 and y = 0 coordinates ( client, screen ) hits an certain object ( for example a trashbin ). I need this, to trigger an event for example. For example: The player stand near a trashbin and presses a button the function should check if he is "aiming" on this object. Thanks! Greetings, Maurize
-
uh ur right, i saw this several minutes ago, but was unable tofix thanks
-
anyone? someone?
-
benxamix2 this function is irritating me, could u give me more help about this? addEvent( "beiPower", true ) addEventHandler( "beiPower", getRootElement(), function() local px, py, pz = getElementPosition( source ) local rx, ry, rz = getElementRotation( source ) local veh = createVehicle( 542, px, py, pz ) attachElements( veh, source, 0, 0, 1.5, rx, ry, rz ) bindKey( source, "mouse1", "down", function( player ) local px, py, pz = getElementPosition( player ) local rx, ry, rz = getElementRotation( player ) local nx, ny = getPointFromDistanceRotation( px, py, 1, rz ) unbindKey( player, "mouse1", "down", source ) setPedAnimation( player, "RYDER", "Van_Throw", 2000, false, false, false, false ) detachElements( veh, player ) setElementRotation( veh, 0, 0, pz ) setElementVelocity( veh, nx, ny, 0 ) end ) end ) -- "RIOT", "RIOT_ANGRY" -- function getPointFromDistanceRotation( x, y, dist, angle ) local a = math.rad( 90 - angle ) local dx = math.cos( a ) * dist local dy = math.sin( a ) * dist return x + dx, y + dy end
-
yep exactly. it should fly in the direction, the player got. addEvent( "beiPower", true ) addEventHandler( "beiPower", getRootElement(), function() local px, py, pz = getElementPosition( source ) local rx, ry, rz = getElementRotation( source ) local veh = createVehicle( 542, px, py, pz ) attachElements( veh, source, 0, 0, 1.5, rx, ry, rz ) bindKey( source, "mouse1", "down", function( player ) local rx, ry, rz = getElementRotation( player ) unbindKey( player, "mouse1", "down", source ) setPedAnimation( player, "RYDER", "Van_Throw", 2000, false, false, false, false ) detachElements( veh, player ) setElementRotation( veh, 0, 0, pz ) setElementVelocity( veh, 0, math.random( 1, 2 ), 0 ) end ) end )
-
Hey, I´m creating a function that allows the player to get a car attached on his arms and able him to throw it. ONLY PROBLEM: I use setElementVelocity and now the car is only "flying" in one direction. Is there a way to calculate the direction in which the car must fly? Thanks, Hope u understood me
-
yeah, that was it thanks!!
-
Yeah its kinda nooby but i can't find any information to this... look: addEventHandler( "onClientResourceStart", getRootElement(), .. this eventHandler makes the resource where the handler is localized restarting every time an other starts or anything. How to fix that the resource doesnt restart if another does?
-
outputChatBox( " You Have Picked up a ".. [here your variable for type], thePlayer, getRootElement(), 255, 255, 0 )
-
alright thats it! perfect! Thanks alot mate, youre still the best
-
Can someone tell me to prevent the editfields in my gui window from for example hitting t that opens chat? I mean the client function to do this is already there... I only forgot which it was... Greetings, Maurize
-
Thanks alot!! Fixed!
-
Hey, However is use my SQLUpdate it seem to update the whole database in this column. That sucks!! Anybody know how to solve this problem?? function() local Name = getPlayerName( source ) local Table2 = executeSQLSelect ( "Datenbank2", "*", "Name = '"..Name.."'" ) executeSQLUpdate( "Datenbank2", "Geld = '"..getPlayerMoney( source ).."'" ) end ) Thanks.
-
LLOLWUT :DDD Take this: addCommandHandler( "toggleHud", function( thePlayer, cmd, status ) if ( status == "off" ) then setPlayerNametagShowing ( thePlayer, false ) -- this is for hiding the name of a player showPlayerHudComponent ( thePlayer, "health", false ) -- "health" can be set to for example ammo & more... elseif ( status == "on" ) then setPlayerNametagShowing ( thePlayer, true ) -- this is for hiding the name of a player showPlayerHudComponent ( thePlayer, "health", true ) -- "health" can be set to for example ammo & more... end end ) and THIS: addCommandHandler( "getBlipMan", function( thePlayer, cmd ) createBlipAttachedTo ( thePlayer, 52 ) end )
-
Use /debugscript 3 and tell me what is shown there & You knew? Syntax of setElementInterior: setElementInterior( Element, Interior, PositionX, PositionY, PositionZ )
-
Team = createTeam( "Police", 0, 0, 255 ) addCommandHandler( "duty", function( thePlayer, cmd ) setElementData( thePlayer, "Sheriff", true ) setPlayerTeam( thePlayer, Team ) end ) addCommandHandler( "check", function( thePlayer, cmd ) local SubTeam = getElementData( thePlayer, "Sheriff" ) local MainTeam = getTeamName( getPlayerTeam( thePlayer ) ) outputChatBox( "Your Mainteam is :"..MainTeam..", and your Subteam is :"..SubTeam..".", thePlayer, 0, 0, 255 ) end )
-
So. Get a Vehicle u want to have as main object. Now use attachElements to attach a certain object to the Vehicle. LOOK: local Main = createVehicle( id, x, y, z ) local Rocket = createElement( id, x, y, z ) attachElements( Main, Rocket ) and so on... And the Model Ids can u get ffrom Map editor. So Good Luck!
-
Benxamix helped me ~ Closed