Lua
vehicles = {}
function vehicletest (playersource,command,vehicleID)
local account = getPlayerAccount(playersource)
local vehiclestate = getAccountData(account,vehicleID.."_vehicle")
if vehiclestate == true then
if vehicles[playersource] then
destroyElement(vehicles[playersource])
end
local x,y,z = getElementPosition(playersource)
vehicles[playersource] = createVehicle(vehicleID,x,y,z)
warpPedIntoVehicle (playersource, vehicles[playersource] )
else
outputInfoLabel("You dont bought this Vehicle!",255,50,50)
end
end
addCommandHandler("sv",vehicletest)
Alles anzeigen
Text wird an die function geleitet... (Klappt bei allen anderen komischerweise)
Lua
function outputInfoLabel(text,red,green,blue)
--if type(text) ~= "string" then
text = string.gsub(text, '#%x%x%x%x%x%x', '')
r = tonumber(red)
g = tonumber(green)
b = tonumber(blue)
triggerClientEvent("drawInfoText",source,text,r,g,b)
--end
end
function ...
Lua
function drawInfoText(text,red,green,blue)
guiSetText(infotextlabel,text)
guiLabelSetColor (infotextlabel,red,green,blue)
if isTimer(infotextslowoutdadetimer) then
killTimer(infotextslowoutdadetimer)
infotextslowoutdadetimer = setTimer(function() guiSetVisible(infotextlabel,false) end,6000,1)
guiSetAlpha(infotextlabel,255)
else
infotextslowoutdadetimer = setTimer(function() guiSetVisible(infotextlabel,false) end,6000,1)
guiSetAlpha(infotextlabel,255)
end
if (guiGetVisible(infotextlabel) == false) then
guiSetVisible(infotextlabel, true)
end
end
addEvent("drawInfoText",true)
addEventHandler("drawInfoText", getLocalPlayer(), drawInfoText)
Alles anzeigen
Clientsidefunctions mit eingebauter debug function.
Problem : Es klappt in diesm Fall irgendwie nicht.