Jump to content

Ice Cream Sell Little Problem


Leonard.DC

Recommended Posts

Hi, I have alredy maked a ice cream sell system, when a player enter in the car using the command /sell he can sell ice cream to other players who hits the marker and give the players health, now i want to make when a player buy a ice cream, the seller take the money that the players give to buy a ice cream, for example a player buy a vanilla ice cream for 800$, the seller earn 800$ and the costumer pay 800$

Client:

GUIEditor = { 
    button = {}, 
    window = {}, 
    staticimage = {}, 
    memo = {} 
} 
  
GUIEditor.window[1] = guiCreateWindow(374, 240, 440, 493, "Ice Creaaam", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
guiSetVisible (GUIEditor.window[1], false) 
  
GUIEditor.button[1] = guiCreateButton(10, 383, 126, 100, "CHOCO 3000$", false, GUIEditor.window[1]) 
local font_0 = guiCreateFont("EmblemaOne.ttf") 
guiSetFont(GUIEditor.button[1], font_0) 
GUIEditor.button[2] = guiCreateButton(156, 384, 126, 99, "VAINILLA 1500$", false, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[2], font_0) 
GUIEditor.button[3] = guiCreateButton(302, 384, 126, 99, "BERRY 2500$", false, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[3], font_0) 
GUIEditor.button[4] = guiCreateButton(10, 259, 126, 100, "MENT 2000$", false, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[4], font_0) 
GUIEditor.button[5] = guiCreateButton(156, 259, 126, 100, "POLO 1000$", false, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[5], font_0) 
GUIEditor.button[6] = guiCreateButton(302, 260, 128, 99, "SORBET 3500$", false, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[6], font_0) 
GUIEditor.memo[1] = guiCreateMemo(204, 32, 226, 218, "***************", false, GUIEditor.window[1]) 
GUIEditor.button[7] = guiCreateButton(10, 176, 184, 68, "I DONT WANT ANYTHING! THX", false, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[7], font_0) 
GUIEditor.staticimage[1] = guiCreateStaticImage(10, 29, 185, 137, "helado.png", false, GUIEditor.window[1]) 
  
function openTheIceGui () 
guiSetVisible (GUIEditor.window[1], true) 
showCursor (true) 
end 
addEvent ("openIceP", true) 
addEventHandler ("openIceP", getRootElement(), openTheIceGui) 
  
function vaini () 
triggerServerEvent ("vaini", localPlayer, localPlayer) 
end 
addEventHandler ("onClientGUIClick", GUIEditor.button[2], vaini, false) 
  
function choco () 
triggerServerEvent ("choco", localPlayer, localPlayer) 
end 
addEventHandler ("onClientGUIClick", GUIEditor.button[1], choco, false) 
  
function fresa () 
triggerServerEvent ("berry", localPlayer, localPlayer) 
end 
addEventHandler ("onClientGUIClick", GUIEditor.button[3], fresa, false) 
  
function menta () 
triggerServerEvent ("ment", localPlayer, localPlayer) 
end 
addEventHandler ("onClientGUIClick", GUIEditor.button[4], menta, false) 
  
function polo () 
triggerServerEvent ("polo", localPlayer, localPlayer) 
end 
addEventHandler ("onClientGUIClick", GUIEditor.button[5], polo, false) 
  
function sorbete () 
triggerServerEvent ("sorbet", localPlayer, localPlayer) 
end 
addEventHandler ("onClientGUIClick", GUIEditor.button[6], sorbete, false) 
  
function closeIce () 
guiSetVisible (GUIEditor.window[1], false) 
showCursor (false) 
end 
addEventHandler ("onClientGUIClick", GUIEditor.button[7], closeIce, false) 

Server:

function heladosVender (thePlayer) 
local vehocc = getPedOccupiedVehicleSeat (thePlayer) 
local playerveh = getPedOccupiedVehicle (thePlayer) 
local x, y, z = getElementPosition (thePlayer) 
if isPedInVehicle (thePlayer) then 
if (getElementModel ( playerveh ) == 423 and vehocc == 0) then 
markerIce = createMarker (x, y, z-1, "cylinder", 4, 0, 255, 0, 255) 
setElementFrozen (playerveh, true) 
addEventHandler ("onMarkerHit", markerIce, heladosMarker) 
else 
outputChatBox ("*****************************", thePlayer, 255, 0, 0) 
end 
end 
end 
addCommandHandler ("sell", heladosVender) 
  
function noVender (thePlayer) 
local playerveh = getPedOccupiedVehicle (thePlayer) 
if isElementFrozen (playerveh) then 
setElementFrozen (playerveh, false) 
if isElement (markerIce) then 
destroyElement (markerIce) 
end 
end 
end 
addCommandHandler ("nosell", noVender) 
  
function heladosMarker (hitElement) 
if getElementType(hitElement) == "player" and hitElement and not isPedInVehicle (hitElement) then 
triggerClientEvent (hitElement, "openIceP", hitElement) 
end 
end 
  
function onPlayerExitWhoper () 
if (getElementModel ( source ) == 423) then 
if isElement (markerIce) then 
destroyElement (markerIce) 
if isElementFrozen (source) then 
setElementFrozen (source, false) 
end 
end 
end 
end 
addEventHandler ("onVehicleExit", getRootElement(), onPlayerExitWhoper) 
  
function consvaini (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 1500) then 
if (consumerHealth <= 70) then 
setElementHealth (thePlayer, consumerHealth+30) 
takePlayerMoney (thePlayer, 1500) 
givePlayerMoney (thePlayer, 1500) 
outputChatBox (name.. " *****************", seller, 0, 255, 0) 
outputChatBox ("**********************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 1500) 
givePlayerMoney (seller, 1500) 
outputChatBox (name.. " *****************", seller, 0, 255, 0) 
outputChatBox ("********************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("*********************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("vaini", true) 
addEventHandler ("vaini", getRootElement(), consvaini) 
  
function conschoc (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 3000) then 
if (consumerHealth <= 10) then 
setElementHealth (thePlayer, consumerHealth+90) 
takePlayerMoney (thePlayer, 3000) 
givePlayerMoney (seller, 3000) 
outputChatBox (name.. " *************************", seller, 0, 255, 0) 
outputChatBox ("*************************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 3000) 
givePlayerMoney (thePlayer, 3000) 
outputChatBox (name.. " ****************", seller, 0, 255, 0) 
outputChatBox ("*********************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("********************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("choco", true) 
addEventHandler ("choco", getRootElement(), conschoc) 
  
function consfres (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 2500) then 
if (consumerHealth <= 20) then 
setElementHealth (thePlayer, consumerHealth+80) 
takePlayerMoney (thePlayer, 2500) 
givePlayerMoney (seller, 2500) 
outputChatBox (name.. " *******************", seller, 0, 255, 0) 
outputChatBox ("**********************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 2500) 
givePlayerMoney (seller, 2500) 
outputChatBox (name.. " ********************", seller, 0, 255, 0) 
outputChatBox ("***********************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("**********************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("berry", true) 
addEventHandler ("berry", getRootElement(), consfres) 
  
  
function consment (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local money = getPlayerMoney (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
if (money >= 2000) then 
if (consumerHealth <= 50) then 
setElementHealth (thePlayer, consumerHealth+50) 
takePlayerMoney (thePlayer, 2000) 
givePlayerMoney (seller, 2000) 
outputChatBox (name.. " ****************", seller, 0, 255, 0) 
outputChatBox ("**************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 2000) 
givePlayerMoney (seller, 2000) 
outputChatBox (name.. " ****************", seller, 0, 255, 0) 
outputChatBox ("***************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("*****************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("ment", true) 
addEventHandler ("ment", getRootElement(), consment) 
  
function conspolo (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 1000) then 
if (consumerHealth <= 80) then 
setElementHealth (thePlayer, consumerHealth+20) 
takePlayerMoney (thePlayer, 1000) 
givePlayerMoney (seller, 1000) 
outputChatBox (name.. " **************", seller, 0, 255, 0) 
outputChatBox ("****************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 1000) 
givePlayerMoney (seller, 1000) 
outputChatBox (name.. " ***************", seller, 0, 255, 0) 
outputChatBox ("************, thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("*******************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("polo", true) 
addEventHandler ("polo", getRootElement(), conspolo) 
  
function conssorbet (thePlayer, seller) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 3500) then 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 3500) 
givePlayerMoney (seller, 3500) 
outputChatBox (name.. " *****************", seller, 0, 255, 0) 
outputChatBox ("***************", thePlayer, 0, 255, 0) 
else 
outputChatBox ("**********", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("sorbet", true) 
addEventHandler ("sorbet", getRootElement(), conssorbet) 
  
  
  
 

There are many bugs in the server side script, the seller doesnt receive the money and the outputchatbox event doesnt execute for the seller, can anyone fix it please

Link to comment
  
function heladosVender (thePlayer) 
local vehocc = getPedOccupiedVehicleSeat (thePlayer) 
local playerveh = getPedOccupiedVehicle (thePlayer) 
local x, y, z = getElementPosition (thePlayer) 
if isPedInVehicle (thePlayer) then 
if (getElementModel ( playerveh ) == 423 and vehocc == 0) then 
markerIce = createMarker (x, y, z-1, "cylinder", 4, 0, 255, 0, 255) 
setElementFrozen (playerveh, true) 
addEventHandler ("onMarkerHit", markerIce, heladosMarker) 
else 
outputChatBox ("*****************************", thePlayer, 255, 0, 0) 
end 
end 
end 
addCommandHandler ("sell", heladosVender) 
  
function noVender (thePlayer) 
local playerveh = getPedOccupiedVehicle (thePlayer) 
if isElementFrozen (playerveh) then 
setElementFrozen (playerveh, false) 
if isElement (markerIce) then 
destroyElement (markerIce) 
end 
end 
end 
addCommandHandler ("nosell", noVender) 
  
function heladosMarker (hitElement) 
if getElementType(hitElement) == "player" and hitElement and not isPedInVehicle (hitElement) then 
triggerClientEvent (hitElement, "openIceP", hitElement) 
end 
end 
  
function onPlayerExitWhoper () 
if (getElementModel ( source ) == 423) then 
if isElement (markerIce) then 
destroyElement (markerIce) 
if isElementFrozen (source) then 
setElementFrozen (source, false) 
end 
end 
end 
end 
addEventHandler ("onVehicleExit", getRootElement(), onPlayerExitWhoper) 
  
function consvaini (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 1500) then 
if (consumerHealth <= 70) then 
setElementHealth (thePlayer, consumerHealth+30) 
takePlayerMoney (thePlayer, 1500) 
givePlayerMoney (thePlayer, 1500) 
outputChatBox (name.. " *****************", seller, 0, 255, 0) 
outputChatBox ("**********************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 1500) 
givePlayerMoney (seller, 1500) 
outputChatBox (name.. " *****************", seller, 0, 255, 0) 
outputChatBox ("********************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("*********************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("vaini", true) 
addEventHandler ("vaini", getRootElement(), consvaini) 
  
function conschoc (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 3000) then 
if (consumerHealth <= 10) then 
setElementHealth (thePlayer, consumerHealth+90) 
takePlayerMoney (thePlayer, 3000) 
givePlayerMoney (seller, 3000) 
outputChatBox (name.. " *************************", seller, 0, 255, 0) 
outputChatBox ("*************************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 3000) 
givePlayerMoney (thePlayer, 3000) 
outputChatBox (name.. " ****************", seller, 0, 255, 0) 
outputChatBox ("*********************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("********************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("choco", true) 
addEventHandler ("choco", getRootElement(), conschoc) 
  
function consfres (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 2500) then 
if (consumerHealth <= 20) then 
setElementHealth (thePlayer, consumerHealth+80) 
takePlayerMoney (thePlayer, 2500) 
givePlayerMoney (seller, 2500) 
outputChatBox (name.. " *******************", seller, 0, 255, 0) 
outputChatBox ("**********************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 2500) 
givePlayerMoney (seller, 2500) 
outputChatBox (name.. " ********************", seller, 0, 255, 0) 
outputChatBox ("***********************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("**********************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("berry", true) 
addEventHandler ("berry", getRootElement(), consfres) 
  
  
function consment (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local money = getPlayerMoney (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
if (money >= 2000) then 
if (consumerHealth <= 50) then 
setElementHealth (thePlayer, consumerHealth+50) 
takePlayerMoney (thePlayer, 2000) 
givePlayerMoney (seller, 2000) 
outputChatBox (name.. " ****************", seller, 0, 255, 0) 
outputChatBox ("**************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 2000) 
givePlayerMoney (seller, 2000) 
outputChatBox (name.. " ****************", seller, 0, 255, 0) 
outputChatBox ("***************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("*****************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("ment", true) 
addEventHandler ("ment", getRootElement(), consment) 
  
function conspolo (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 1000) then 
if (consumerHealth <= 80) then 
setElementHealth (thePlayer, consumerHealth+20) 
takePlayerMoney (thePlayer, 1000) 
givePlayerMoney (seller, 1000) 
outputChatBox (name.. " **************", seller, 0, 255, 0) 
outputChatBox ("****************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 1000) 
givePlayerMoney (seller, 1000) 
outputChatBox (name.. " ***************", seller, 0, 255, 0) 
outputChatBox ("************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("*******************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("polo", true) 
addEventHandler ("polo", getRootElement(), conspolo) 
  
function conssorbet (thePlayer, seller) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 3500) then 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 3500) 
givePlayerMoney (seller, 3500) 
outputChatBox (name.. " *****************", seller, 0, 255, 0) 
outputChatBox ("***************", thePlayer, 0, 255, 0) 
else 
outputChatBox ("**********", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("sorbet", true) 
addEventHandler ("sorbet", getRootElement(), conssorbet) 
  

I Fixed the unfinished string else i dint saw. Replace that with server side.

Link to comment
  
function heladosVender (thePlayer) 
local vehocc = getPedOccupiedVehicleSeat (thePlayer) 
local playerveh = getPedOccupiedVehicle (thePlayer) 
local x, y, z = getElementPosition (thePlayer) 
if isPedInVehicle (thePlayer) then 
if (getElementModel ( playerveh ) == 423 and vehocc == 0) then 
markerIce = createMarker (x, y, z-1, "cylinder", 4, 0, 255, 0, 255) 
setElementFrozen (playerveh, true) 
addEventHandler ("onMarkerHit", markerIce, heladosMarker) 
else 
outputChatBox ("*****************************", thePlayer, 255, 0, 0) 
end 
end 
end 
addCommandHandler ("sell", heladosVender) 
  
function noVender (thePlayer) 
local playerveh = getPedOccupiedVehicle (thePlayer) 
if isElementFrozen (playerveh) then 
setElementFrozen (playerveh, false) 
if isElement (markerIce) then 
destroyElement (markerIce) 
end 
end 
end 
addCommandHandler ("nosell", noVender) 
  
function heladosMarker (hitElement) 
if getElementType(hitElement) == "player" and hitElement and not isPedInVehicle (hitElement) then 
triggerClientEvent (hitElement, "openIceP", hitElement) 
end 
end 
  
function onPlayerExitWhoper () 
if (getElementModel ( source ) == 423) then 
if isElement (markerIce) then 
destroyElement (markerIce) 
if isElementFrozen (source) then 
setElementFrozen (source, false) 
end 
end 
end 
end 
addEventHandler ("onVehicleExit", getRootElement(), onPlayerExitWhoper) 
  
function consvaini (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 1500) then 
if (consumerHealth <= 70) then 
setElementHealth (thePlayer, consumerHealth+30) 
takePlayerMoney (thePlayer, 1500) 
givePlayerMoney (thePlayer, 1500) 
outputChatBox (name.. " *****************", seller, 0, 255, 0) 
outputChatBox ("**********************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 1500) 
givePlayerMoney (seller, 1500) 
outputChatBox (name.. " *****************", seller, 0, 255, 0) 
outputChatBox ("********************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("*********************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("vaini", true) 
addEventHandler ("vaini", getRootElement(), consvaini) 
  
function conschoc (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 3000) then 
if (consumerHealth <= 10) then 
setElementHealth (thePlayer, consumerHealth+90) 
takePlayerMoney (thePlayer, 3000) 
givePlayerMoney (seller, 3000) 
outputChatBox (name.. " *************************", seller, 0, 255, 0) 
outputChatBox ("*************************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 3000) 
givePlayerMoney (thePlayer, 3000) 
outputChatBox (name.. " ****************", seller, 0, 255, 0) 
outputChatBox ("*********************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("********************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("choco", true) 
addEventHandler ("choco", getRootElement(), conschoc) 
  
function consfres (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 2500) then 
if (consumerHealth <= 20) then 
setElementHealth (thePlayer, consumerHealth+80) 
takePlayerMoney (thePlayer, 2500) 
givePlayerMoney (seller, 2500) 
outputChatBox (name.. " *******************", seller, 0, 255, 0) 
outputChatBox ("**********************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 2500) 
givePlayerMoney (seller, 2500) 
outputChatBox (name.. " ********************", seller, 0, 255, 0) 
outputChatBox ("***********************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("**********************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("berry", true) 
addEventHandler ("berry", getRootElement(), consfres) 
  
  
function consment (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local money = getPlayerMoney (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
if (money >= 2000) then 
if (consumerHealth <= 50) then 
setElementHealth (thePlayer, consumerHealth+50) 
takePlayerMoney (thePlayer, 2000) 
givePlayerMoney (seller, 2000) 
outputChatBox (name.. " ****************", seller, 0, 255, 0) 
outputChatBox ("**************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 2000) 
givePlayerMoney (seller, 2000) 
outputChatBox (name.. " ****************", seller, 0, 255, 0) 
outputChatBox ("***************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("*****************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("ment", true) 
addEventHandler ("ment", getRootElement(), consment) 
  
function conspolo (thePlayer, seller) 
local consumerHealth = getElementHealth (thePlayer) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 1000) then 
if (consumerHealth <= 80) then 
setElementHealth (thePlayer, consumerHealth+20) 
takePlayerMoney (thePlayer, 1000) 
givePlayerMoney (seller, 1000) 
outputChatBox (name.. " **************", seller, 0, 255, 0) 
outputChatBox ("****************", thePlayer, 0, 255, 0) 
else 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 1000) 
givePlayerMoney (seller, 1000) 
outputChatBox (name.. " ***************", seller, 0, 255, 0) 
outputChatBox ("************", thePlayer, 0, 255, 0) 
end 
else 
outputChatBox ("*******************", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("polo", true) 
addEventHandler ("polo", getRootElement(), conspolo) 
  
function conssorbet (thePlayer, seller) 
local name = getPlayerName (thePlayer) 
local seller = getVehicleOccupant ( source, 0 ) 
local money = getPlayerMoney (thePlayer) 
if (money >= 3500) then 
setElementHealth (thePlayer, 100) 
takePlayerMoney (thePlayer, 3500) 
givePlayerMoney (seller, 3500) 
outputChatBox (name.. " *****************", seller, 0, 255, 0) 
outputChatBox ("***************", thePlayer, 0, 255, 0) 
else 
outputChatBox ("**********", thePlayer, 255, 0, 0) 
end 
end 
addEvent ("sorbet", true) 
addEventHandler ("sorbet", getRootElement(), conssorbet) 
  

I Fixed the unfinished string else i dint saw. Replace that with server side.

Tested? I dont really sure it fix the give money and outputchatbox to the seller :S

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...