aski Posted March 29, 2014 Share Posted March 29, 2014 nie potrafie wykonać takiego czegoś że jak ktoś wsiada do pojazdu Taxi, Cabbie, to kierowcy daje np 5 dolarów co 5 sekund a klientowi zabiera 5 $ co 5 sekund, gdy jest dwóch klientów to zabiera wszystkim a daje kierowcy za dwie osoby, Gdy kierowca jedzie sam żadna akcja się nie dzieje. Jak takie coś wykonać od czego zacząć czy to mi pomoże?: przykładowy skrypt pracy prostytutki, da się coś z tym zrobić? Server: function hookersightscheck (source) local element = getPlayerTarget ( source ) if (element) then if ( getElementType ( element ) == "player" ) then if (getElementData ( source , "horny" ) ~= "hellno") and (getElementData ( element , "currentstatus" ) ~= "gettingblown") then if ( isPlayerDucked ( source ) ) then local currentgun = getPlayerWeapon ( source ) if ( currentgun == 0 ) and ( isPlayerInVehicle( element ) == false ) then local kskin = getPlayerSkin ( source ) if kskin == 10 or kskin == 214 or kskin == 190 then local hooker = source local john = element local cx, cy, cz = getElementPosition ( source ) local px, py, pz = getElementPosition ( element ) if ( getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) < 3 ) then playSoundFrontEnd ( hooker, 40 ) triggerClientEvent ( john, "hooker_showblowjobMessage", getRootElement(), hooker) setElementData ( john, "currentstatus", "gettingblown", false ) setElementData ( hooker, "currentstatus", "blowingaplayer", false ) end end end end end end end end function askOnEnter ( theVehicle, seat, jacked ) if (getVehicleType(theVehicle) == "Automobile") or (getVehicleType(theVehicle) == "Helicopter") or (getVehicleType(theVehicle) == "Monster Truck") then local kskin = getPlayerSkin ( source ) if kskin == 10 or kskin == 214 then if seat == 1 then local john = getVehicleOccupant ( theVehicle, 0 ) if isElement(john) then local hooker = source playSoundFrontEnd ( hooker, 40 ) triggerClientEvent ( john, "hooker_showblowjobMessage", getRootElement(), hooker) setElementData ( john, "currentstatus", "gettingblown", false ) setElementData ( hooker, "currentstatus", "blowingaplayer", false ) end elseif seat == 3 then local john = getVehicleOccupant ( theVehicle, 2 ) if isElement(john) then local hooker = source playSoundFrontEnd ( hooker, 40 ) triggerClientEvent ( john, "hooker_showblowjobMessage", getRootElement(), hooker) setElementData ( john, "currentstatus", "gettingblown", false ) setElementData ( hooker, "currentstatus", "blowingaplayer", false ) end end end end end addEventHandler ( "onPlayerVehicleEnter", getRootElement(), askOnEnter ) function hookerspawn ( posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension ) local kskin = theSkin if kskin == 85 or kskin == 87 or kskin == 90 or kskin == 152 or kskin == 169 or kskin == 178 or kskin == 238 or kskin == 244 or kskin == 256 or kskin == 257 or kskin == 264 or kskin == 68 then addEventHandler( "onPlayerWasted", source, hookerdied ) bindKey ( source, "aim_weapon", "down", hookersightscheck ) end end addEventHandler ( "onPlayerSpawn", getRootElement(), hookerspawn ) function hookerdied () unbindKey ( source, "aim_weapon", "down", hookersightscheck ) end --THIS IS AFTER A PLAYER AGREES addEvent ("hooker_suckingstarted", true ) function gettoit(hooker, john) if isPlayerInVehicle(hooker) == false then setElementData ( john, "legalstatus", "illegal" ) setElementData ( hooker, "legalstatus", "illegal" ) local cx, cy, cz = getElementPosition ( john ) setPedAnimation ( hooker, "BLOWJOBZ", "BJ_Couch_Loop_W", -1, true, false, false) local takeanother = setTimer ( slurp, 3000, 1, hooker, john ) else setElementData ( john, "legalstatus", "illegal" ) setElementData ( hooker, "legalstatus", "illegal" ) setPedAnimation ( hooker, "BLOWJOBZ", "BJ_Car_Start_W", -1, false, false, true) setTimer ( setPedAnimation, 2000, 1, hooker, "BLOWJOBZ", "BJ_Car_Loop_W", -1, true, false, false) local takeanother = setTimer ( carslurp, 3000, 1, hooker, john ) end end addEventHandler ( "hooker_suckingstarted", getRootElement(), gettoit ) --THIS IS WHEN THE PLAYER SAYS NO addEvent ("hooker_suckingdenied", true ) function hookrejection(hooker, john) setElementData ( john, "horny", "hellno", false ) setElementData ( john, "currentstatus", nil, false ) setElementData ( hooker, "currentstatus", nil, false ) local resetanswer = setTimer ( reconsider, 30000, 1, john ) end addEventHandler ( "hooker_suckingdenied", getRootElement(), hookrejection ) function reconsider(john) setElementData ( john, "horny", nill, false ) end function slurp(hooker, john) local cx, cy, cz = getElementPosition ( john ) local px, py, pz = getElementPosition ( hooker ) local johnmoney = getPlayerMoney(john) local currentgun = getPlayerWeapon ( hooker ) if ( currentgun == 0 ) then if ( getDistanceBetweenPoints3D ( cx, cy, cz, px, py, pz ) < 3 ) and ( johnmoney > 4 ) then takeanother = setTimer ( slurp, 3000, 1, hooker, john ) playSoundFrontEnd ( hooker, 10 ) playSoundFrontEnd ( john, 10 ) takePlayerMoney ( john, 5 ) givePlayerMoney ( hooker, 5 ) local tx,ty,tz = getElementPosition( john ) local px,py,pz = getElementPosition( hooker ) local angle = ( 360 - math.deg ( math.atan2 ( ( tx - px ), ( ty - py ) ) ) ) % 360 setPedRotation( hooker, angle ) local johnhealth = getElementHealth ( john ) if johnhealth < 98 then setElementHealth ( john, johnhealth+3 ) end else setElementData ( john, "currentstatus", nil, false ) setElementData ( hooker, "currentstatus", nil, false ) setElementData ( john, "legalstatus", "legal" ) setElementData ( hooker, "legalstatus", "legal" ) setPedAnimation ( hooker ) end else setElementData ( john, "currentstatus", nil, false ) setElementData ( hooker, "currentstatus", nil, false ) setElementData ( john, "legalstatus", "legal" ) setElementData ( hooker, "legalstatus", "legal" ) setPedAnimation ( hooker ) end end function carslurp(hooker, john) local johnmoney = getPlayerMoney(john) local currentgun = getPlayerWeapon ( hooker ) if (isPlayerInVehicle(hooker) == true) and (isPedDoingGangDriveby (hooker) == false) then if (isPlayerInVehicle(john) == true) and ( johnmoney > 4 ) and (isPedDoingGangDriveby (john) == false) then takeanother = setTimer ( carslurp, 3000, 1, hooker, john ) playSoundFrontEnd ( hooker, 10 ) playSoundFrontEnd ( john, 10 ) takePlayerMoney ( john, 5 ) givePlayerMoney ( hooker, 5 ) local johnhealth = getElementHealth ( john ) if johnhealth < 98 then setElementHealth ( john, johnhealth+3 ) end else setElementData ( john, "currentstatus", nil, false ) setElementData ( hooker, "currentstatus", nil, false ) setElementData ( john, "legalstatus", "legal" ) setElementData ( hooker, "legalstatus", "legal" ) setPedAnimation ( hooker, "BLOWJOBZ", "BJ_Car_Stop_W", -1, false, false, true) end else setElementData ( john, "currentstatus", nil, false ) setElementData ( hooker, "currentstatus", nil, false ) setElementData ( john, "legalstatus", "legal" ) setElementData ( hooker, "legalstatus", "legal" ) end end Client: function showblowjobMessage(hooker) myhooker = hooker showCursor ( true ) local x, y = guiGetScreenSize() if not blowjobBox then blowjobBox = guiCreateWindow( x*.5-150, y*.5-65, 300, 120, "PRACA PROSTYTUTKI", false ) guiWindowSetSizable( blowjobBox, false ) blowjobMessage = guiCreateLabel( 100, 40, 180, 60, "", false, blowjobBox ) blowjobOk = guiCreateButton( 90, 90, 70, 20, "TAK!", false, blowjobBox ) blowjobNo = guiCreateButton( 170, 90, 70, 20, "NIE!", false, blowjobBox ) addEventHandler( "onClientGUIClick", blowjobNo, nothanks ) addEventHandler( "onClientGUIClick", blowjobOk, startsucking ) else guiSetPosition( blowjobBox, x*.5-150, y*.5-65, false ) guiSetVisible( blowjobBox, true ) end guiSetText( blowjobMessage, "HEJ SŁODZIAKU ZABAWIMY SIE?" ) guiBringToFront( blowjobBox ) end addEvent( "hooker_showblowjobMessage", true ) addEventHandler( "hooker_showblowjobMessage", getLocalPlayer(), showblowjobMessage ) function nothanks() john = getLocalPlayer() guiSetVisible( blowjobBox, false ) showCursor ( false ) triggerServerEvent ( "hooker_suckingdenied", getLocalPlayer(), myhooker, john ) end function startsucking() john = getLocalPlayer() triggerServerEvent ( "hooker_suckingstarted", getLocalPlayer(), myhooker, john ) showCursor ( false ) guiSetVisible( blowjobBox, false ) end Link to comment
WhoAmI Posted March 30, 2014 Share Posted March 30, 2014 Nie jestem pewien czy to ma tak wyglądać, ale masz taxi_ids = { [420] = true, [438] = true } local sekundy = 5 --co ile sekund local kasa = 5 --ile kasy ma zabierać addEventHandler ( "onVehicleEnter", root, function ( player, seat ) if ( taxi_ids [ getElementModel ( source ) ] ) then if ( seat ~= 0 ) then local kierowca = getVehicleController ( source ) if ( kierowca ) then local timer = setTimer ( function ( ) takePlayerMoney ( player, kasa ) givePlayerMoney ( kierowca, kasa ) end, sekundy * 1000, 0 ) setElementData ( player, "timer:taxi", timer ) end end end end ) addEventHandler ( "onVehicleExit", root, function ( player, seat ) if ( taxi_ids [ getElementModel ( source ) ] ) then if ( seat ~= 0 ) then local timer = getElementData ( player, "timer:taxi" ) if ( isTimer ( timer ) ) then killTimer ( timer ) end end end end ) Link to comment
aski Posted March 30, 2014 Author Share Posted March 30, 2014 dziękuję to jest plik .lua? function moneyToDriver(thePlayer) local model = getElementModel(thePlayer) local vehicle = getVehicleOccupants(thePlayer) if model == 438 or 420 and vehicle >1 then local timer = setTimer(givePlayerMoney,5000,0,thePlayer,5) local timer2 = setTimer(takePlayerMoney,5000,0,vehicle,5) end end function insertTaxdi( thePlayer, seat, jacked) local model = getElementModel(thePlayer) local vehicle = getVehicleOccupants(thePlayer) if model == 438 or 420 and seat == 0 and jacked or not jacked then killTimer(timer) killTimer(timer2) elseif model == 438 or 420 and seat >1 then killTimer(timer) killTimer(timer2) end end addEventHandler ( "onVehicleExit", getRootElement(), insertTaxdi) Link to comment
WhoAmI Posted March 30, 2014 Share Posted March 30, 2014 Użyj mojego kodu, bo wątpię, że ten Twój będzie działał. Tak to jest plik LUA, stron server. Link to comment
aski Posted March 30, 2014 Author Share Posted March 30, 2014 a jak jest local sekundy = 5 --co ile sekund to nie powinno być: local sekundy = 5000 Link to comment
WhoAmI Posted March 30, 2014 Share Posted March 30, 2014 W dalszym kodzie jest to zrobione, podaj zwykłe sekundy. W setTimer jest. sekundy * 1000 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