Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2014-12-16, 16:30


flimbo123







Wiek: 33
Na forum: 5776 dni
Posty: 93
Nick w MP: Flimbo

Piwa: 190

Respekt: 60

Skrypt nie daje graczom auta, za pewien czas wrzuce log z /debugscript3

server:

Kod:

rentCar = {}

function rentCarFuntion ( player )
if getDistanceBetweenPoints3D ( -2483.9, 775.7, 35.2, getElementPosition(player) ) <2 then
rentCar[player] = createVehicle( 514, -1499.6687011719, 961.82623291016, 8.5192012786865, 0, 0, 0, "Rent" )
warpPedIntoVehicle( player, rentCar[player] )
takePlayerMoney(player, 75)
setTimer(
function ()
destroyElement(rentCar[player])
end
,1800000,1
)
end
end
addEvent( "rentroller", true )
addEventHandler( "rentroller", getRootElement(),rentCarFuntion )
addCommandHandler("rentroller",rentCarFuntion )

rentCar2 = {}

function rentCar2Funtion ( player )
if getDistanceBetweenPoints3D ( -2483.9, 775.7, 35.2, getElementPosition(player) ) <2 then
rentCar2[player] = createVehicle( 403, -1499.6687011719, 961.82623291016, 8.5192012786865, 0, 0, 0, "Rent" )
warpPedIntoVehicle( player, rentCar2[player] )
takePlayerMoney(player, 110)
setTimer(
function ()
destroyElement(rentCar2[player])
end
,1800000,1
)
end
end
addEvent( "rentroller1", true )
addEventHandler( "rentroller1", getRootElement(),rentCar2Funtion )
addCommandHandler("rentroller1",rentCar2Funtion )

rentCar3 = {}

function rentCar3Funtion ( player )
if getDistanceBetweenPoints3D ( -2483.9, 775.7, 35.2, getElementPosition(player) ) <2 then
rentCar3[player] = createVehicle( 515, -1499.6687011719, 961.82623291016, 8.5192012786865, 0, 0, 0, "Rent" )
warpPedIntoVehicle( player, rentCar3[player] )
takePlayerMoney(player, 220)
setTimer(
function ()
destroyElement(rentCar3[player])
end
,1800000,1
)
end
end
addEvent( "rentroller2", true )
addEventHandler( "rentroller2", getRootElement(),rentCar3Funtion )
addCommandHandler("rentroller2",rentCar3Funtion )

rentCar4 = {}

function rentCar4Funtion ( player )
if getDistanceBetweenPoints3D ( -2483.9, 775.7, 35.2, getElementPosition(player) ) <2 then
rentCar4[player] = createVehicle( 499, -1499.6687011719, 961.82623291016, 8.5192012786865, 0, 0, 0, "Rent" )
warpPedIntoVehicle( player, rentCar4[player] )
takePlayerMoney(player, 525)
setTimer(
function ()
destroyElement(rentCar4[player])
end
,1800000,1
)
end
end
addEvent( "rentroller3", true )
addEventHandler( "rentroller3", getRootElement(),rentCar4Funtion )
addCommandHandler("rentroller3",rentCar4Funtion )

rentCar5 = {}

function rentCar5Funtion ( player )
if getDistanceBetweenPoints3D ( -2483.9, 775.7, 35.2, getElementPosition(player) ) <2 then
rentCar5[player] = createVehicle( 413, -1499.6687011719, 961.82623291016, 8.5192012786865, 0, 0, 0, "AVIS" )
warpPedIntoVehicle( player, rentCar5[player] )
takePlayerMoney(player, 725)
setTimer(
function ()
destroyElement(rentCar5[player])
end
,1800000,1
)
end
end
addEvent( "rentroller4", true )
addEventHandler( "rentroller4", getRootElement(),rentCar5Funtion )
addCommandHandler("rentroller4",rentCar5Funtion )


Client:
Kod:

local screenwidth, screenheight = guiGetScreenSize ()
local posw, posh = 352,183

Window = guiCreateWindow(527, 308, 352, 183, "Wypozyczalnia pojazdow", false)
button1 = guiCreateButton(10, 33, 334, 15, "Tanker - 30 min. (75 $)", false, Window)
button2 = guiCreateButton(10, 58, 333, 15, "Linerunner - 30 min. (110 $)", false, Window)
button3 = guiCreateButton(10, 83, 333, 15, "Roadtrain - 30 min. (220 $)", false, Window)
button4 = guiCreateButton(11, 108, 331, 15, "Benson - 30 min. (525 $)", false, Window)
button5 = guiCreateButton(10, 133, 331, 15, "Pony - 30 min. (725 $)", false, Window)
button6 = guiCreateButton(9, 157, 331, 15, "Rezygnuje", false, Window)

Marker = createPickup ( -1497.86328125, 951.67340087891, 7.1875, 3, 1277, 50 )


addEventHandler( "onClientResourceStart", getRootElement( ),
function ( )
guiSetVisible(Window, false)
end
)

function GuiOpen ( hitPlayer )
if ( hitPlayer == getLocalPlayer () ) then
if ( Window ~= nil ) then
guiSetVisible ( Window, true )
guiBringToFront ( Window )
guiSetInputEnabled ( true )
addEventHandler ( "onClientGUIClick", button1, button1Func, false )
addEventHandler ( "onClientGUIClick", button2, button2Func, false )
addEventHandler ( "onClientGUIClick", button3, button3Func, false )
addEventHandler ( "onClientGUIClick", button4, button4Func, false )
addEventHandler ( "onClientGUIClick", button5, button4Func, false )
addEventHandler ( "onClientGUIClick", button6, button6Func, false )
showCursor ( true )
end
end
end
addEventHandler ( "onClientPickupHit", Marker, GuiOpen )

function button6Func ( button, state )
if button == "left" and state == "up" then
guiSetInputEnabled ( false )
guiSetVisible ( Window, false )
showCursor ( false )
end
end

function button1Func ( button, state )
if button == "left" and state == "up" then
local kunde = getLocalPlayer()
triggerServerEvent ( "rentroller", getLocalPlayer(), kunde )
guiSetInputEnabled ( false )
guiSetVisible ( Window, false )
showCursor ( false )
end
end

function button2Func ( button, state )
if button == "left" and state == "up" then
local kunde = getLocalPlayer()
triggerServerEvent ( "rentroller1", getLocalPlayer(), kunde )
guiSetInputEnabled ( false )
guiSetVisible ( Window, false )
showCursor ( false )
end
end

function button3Func ( button, state )
if button == "left" and state == "up" then
local kunde = getLocalPlayer()
triggerServerEvent ( "rentroller2", getLocalPlayer(), kunde )
guiSetInputEnabled ( false )
guiSetVisible ( Window, false )
showCursor ( false )
end
end

function button4Func ( button, state )
if button == "left" and state == "up" then
local kunde = getLocalPlayer()
triggerServerEvent ( "rentroller3", getLocalPlayer(), kunde )
guiSetInputEnabled ( false )
guiSetVisible ( Window, false )
showCursor ( false )
end
end

function button5Func ( button, state )
if button == "left" and state == "up" then
local kunde = getLocalPlayer()
triggerServerEvent ( "rentroller4", getLocalPlayer(), kunde )
guiSetInputEnabled ( false )
guiSetVisible ( Window, false )
showCursor ( false )
end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-16, 17:51


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

1. Kody dajemy w [lua]
2. Podaj kawa?ek kodu kt?ry nie dzia??.

Podpis

https://shufflecode.pl
Static Codes and Graphics - Join our discord!
Postaw piwo autorowi tego posta
 

 
Wysłany: 2014-12-16, 18:11


flimbo123







Wiek: 33
Na forum: 5776 dni
Posty: 93
Nick w MP: Flimbo

Piwa: 190

Respekt: 60

Debugscipt:



Kod:

wynajemaut/client.lua: addEventHandler: 'onClientGUIClick' with this function is already handled


Postaw piwo autorowi tego posta
 

 
Tagi: skrypt :: nie :: daje :: pojazdu :: graczom.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku