Guten Tag,
Mein Problem ist jetzt das sich das VIP Panel öffnet,
Man kann auch die VIP-Autos kaufen, nur die "coins" werden nicht
abgezogen.
-clientside
addEventHandler("onClientGUIClick", VIPBuyCarButton, function()
local id = guiGridListGetItemText(VIPCarGridlist, guiGridListGetSelectedItem(VIPCarGridlist), 1);
if id and tonumber(id) ~= -1 and tonumber(id) > 0 then
local price = guiGridListGetItemText(VIPCarGridlist, guiGridListGetSelectedItem(VIPCarGridlist), 3);
local coins = tonumber(getElementData(localPlayer, "m_coins"))
if(coins >= tonumber(price))then
triggerServerEvent("BuyCar", localPlayer, tonumber(id), tonumber(price));
else
outputChatBox("Du hast nicht genug Coins!", 125, 0, 0);
end
else
outputChatBox("Wähle bitte ein Auto aus!", 125, 0, 0);
end
end, false)
function VIPPanel()
if not guiGetVisible(VIPWindow) then
guiGridListClear(VIPCarGridlist)
showCursor(true)
guiSetVisible(VIPWindow, true)
local coins = getElementData(localPlayer, "m_coins")
guiSetText(VIPCoinsLabel, "Deine Coins: "..coins);
for _, data in pairs(VIPCars) do
local r = guiGridListAddRow(VIPCarGridlist);
guiGridListSetItemText(VIPCarGridlist, r, VIPColumnID, data.carid, false, false)
guiGridListSetItemText(VIPCarGridlist, r, VIPColumnName, getVehicleNameFromModel(data.carid), false, false)
guiGridListSetItemText(VIPCarGridlist, r, VIPColumnPrice, data.carprice, false, false)
end
else
showCursor(false)
guiSetVisible(VIPWindow, false)
end
end
addEvent("doOpenVipPanel", true)
addEventHandler("doOpenVipPanel", localPlayer, VIPPanel)
Alles anzeigen
--serverside
addEvent("BuyCar", true)
addEventHandler("BuyCar", root, function(id, price)
local x, y, z = getElementPosition(client)
carbuy ( client, price, id, x, y, z, 0, 0, 0, nil, nil, nil, nil, nil, nil, nil, true )
end)
addEventHandler("onPlayerQuit", root, function()
if m_isPlayerVip(source) then
MySQL_SetString("userdata", "coins", MySQL_Save ( MySQL_Save ( getElementData ( player, "m_coins" ))) , "Name LIKE '"..getPlayerName(source).."'")
end
end)
function m_setPlayerVip(player)
local result = mysql_query(handler, "SELECT * from userdata WHERE Name LIKE '"..getPlayerName(player).."'");
if result then
if mysql_num_rows(result) > 0 then
local assoc = mysql_fetch_assoc(result);
if tonumber(assoc["vip"]) == 1 then
setElementData(player, "m_vip", true)
setElementData(player, "m_coins", tonumber(assoc["coins"]))
else
setElementData(player, "m_vip", false)
setElementData(player, "m_coins", 0)
end
mysql_free_result(result);
end
end
end
Alles anzeigen
Ich hab dann auch alles in Datenbank eingestellt mit den Coins, das ging auch alles richtig.
Jetzt hab ich mir halt per DB die Coins gegeben die auch Ingame erscheinen also halt im GUI- by LowPricesApp" in_hover="" in_hdr="1" style="border: none !important; display: inline-block !important; text-indent: 0px !important; float: none !important; font-weight: bold !important; height: auto !important; margin: 0px !important; min-height: 0px !important; min-width: 0px !important; padding: 0px !important; text-transform: uppercase !important; text-decoration: underline !important; vertical-align: baseline !important; width: auto !important; background: transparent !important;">Fenster
nur wenn ich das Autokaufe werden die Coins nicht abgezogen..
Ich hab ein mieses Gefühl das ich was übersehen hab,
hoffe ihr könnt mir weiterhelfen!
DeanX