Jump to content

[HELP]triggerServerEvent


Recommended Posts

Не могу понять почему модель автомобиля не отправляется на сервер при покупке ее. 
[server где createvehicle] debug: imkB9HoFpMU.jpg
client:

	elseif source == carshopBuyVehicle then
		local r, g, b = getVehicleColor(veh)
		triggerServerEvent("onPlayerVehicleBuy", localPlayer, localPlayer, getElementModel(veh), getVehicleData(getElementModel(veh))[3], r, g, b, shop)
		fadeCamera(false)
		guiSetVisible(carShopWindow, false)
		guiSetVisible(infoCarShopWindow, false)
		showCursor(false)
		setTimer(function()
			fadeCamera(true)
			setCameraTarget(localPlayer)
			setElementDimension(localPlayer, 0)
			destroyElement(veh)
			veh = nil
			showChat(true)
			setElementFrozen(localPlayer, false)
		end, 1000, 1)
	elseif source == carshopNext then
		if index < #vehShopVehicles[1] then
           	index = index + 1;
       	else
            index = 1;
        end
        if ( isElement ( vehicle ) ) then destroyElement ( vehicle ) end
        if ( isElement ( veh ) ) then destroyElement ( veh ) end
        veh = createVehicle ( vehShopVehicles[currentShop][index][1], 554.9150390625,-1289.4499511719,16.657926559448 );
        setElementDimension(veh, 1)
    elseif source == carshopPrev then
    	if index > 1 then
           index = index - 1;
        else
       	 	index = #vehShopVehicles[1]
        end
        if ( isElement ( vehicle ) ) then destroyElement ( vehicle ) end
        if ( isElement ( veh ) ) then destroyElement ( veh ) end
        veh = createVehicle ( vehShopVehicles[currentShop][index][1], 554.9150390625,-1289.4499511719,16.657926559448 );
        setElementDimension(veh, 1)

 

server. 
 

function onPlayerVehicleBuy(player, model, price, r, g, b, shop)
fadeCamera(player, false)
setTimer( function()
local owner = getPlayerName(player)
local q = mysql:_Query("SELECT * FROM vehicles WHERE owner=?",owner) 
fadeCamera(player, true)
setCameraTarget(player, player)
setElementFrozen(player, false)
if tonumber(getPlayerMoney(player)) < tonumber(price) then
outputChatBox(nex.."[Ошибка]#ffffff Для покупки авто, вам недостаточно средств.", player, 255, 255, 255, true)
return
end
takePlayerMoney(player, tonumber(price))
-- createVehicle - debug [ERROR *170 строка]
veh = createVehicle(model, vehShopsTable[shop][4], vehShopsTable[shop][5], vehShopsTable[shop][6])
setElementRotation(veh, 0, 0, vehShopsTable[shop][7])
setVehicleColor(veh, r, g, b, 255, 255, 255)
warpPedIntoVehicle(player, veh)
~~
~~
~~

shared: 

vehShopsTable = {  -- 1, 2 , 3 - маркер; 4, 5, 6 - позиция автомобиля, 7 - ROT
	[1] = {539.70989990234, -1287.5334472656, 16.2421875, 544.77709960938,-1275.4229736328,17.248237609863, 180},
	[2] = {2131.8623046875, -1151.3229980469, 23.060688018799, 2122.1408691406, -1137.4603271484, 25.201257705688, 180},
	[3] = {1889.1101074219, -1317.2145996094, 49.408805847168, -1094.7878417969, 41.567222595215, 180}
}

 

Edited by Markn1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...