Jump to content

Script ERROR..help please


Recommended Posts

when script starts i get a error in cmd window..

---Script----

Server Side:

    marcadorTienda = createMarker(2285.8000488281,549.59997558594,6.8000001907349,"cylinder",1.5,0,125,250,153) 
     
function mostrarTienda(hitPlayer) 
    triggerClientEvent(hitPlayer,"mostrarTienda",getRootElement(),hitPlayer) 
end 
addEventHandler("onMarkerHit",marcadorTienda,mostrarTienda) 
  
addEvent ("comproColt-45", true) 
addEventHandler ("comproColt-45", getRootElement(),  
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You Bought a colt", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproShotgun", true) 
addEventHandler ("comproShotgun", getRootElement(),  
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a Shotgun", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproTec-9", true) 
addEventHandler ("comproTec-9", getRootElement(),  
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a Tec-9", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproUZI", true) 
addEventHandler ("comproUZI", getRootElement(),  
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a UZI", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionUZI", true) 
addEventHandler ("comproMunicionUZI", getRootElement(),  
function (id, cost,munic) 
  local tieneUZI = getPedWeapon(source,5) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneUZI == 28) then 
    outputChatBox ("Congratulations!,you bought a UZI ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneUZI ~= 28) then 
    outputChatBox ("Ehm,I think you forgot to buy the UZI First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneUZI == 28) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else  
 outputChatBox ("Ehm,I think you forgot to buy the UZI First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionTec-9", true) 
addEventHandler ("comproMunicionTec-9", getRootElement(),  
function (id, cost,munic) 
  local tieneTec-9 = getPedWeapon(source,4) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneTec-9 == 32) then 
    outputChatBox ("Congratulations!,You bought a Tec-9 Ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneTec-9 ~= 32) then 
    outputChatBox ("Ehm,I think you forgot to buy the Tec-9 First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneTec-9 == 32) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Tec-9 First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionShotg", true) 
addEventHandler ("comproMunicionShotg", getRootElement(),  
function (id, cost,munic) 
  local tieneShotgun = getPedWeapon(source,3) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneShotgun == 25) then 
    outputChatBox ("Congratulations,You bought a shotgun ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneShotgun ~= 25) then 
    outputChatBox ("Ehm,I think you forgot to buy the Shotgun First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneShotgun == 25) then 
    outputChatBox ("No money? Go kill some zombies.", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Shotgun First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionColt-45", true) 
addEventHandler ("comproMunicionColt-45", getRootElement(),  
function (id, cost,munic) 
  local tieneColt-45 = getPedWeapon(source,2) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneColt-45 == 22) then 
    outputChatBox ("Congartulations,You bought a Colt ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneColt-45 ~= 22) then 
    outputChatBox ("Ehm,I think you forgot to buy the Colt First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneColt-45 == 22) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Colt First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEventHandler("onResourceStart",getRootElement(), 
function () 
    outputChatBox("Gunshop by LiOneLMeSsI") 
end 
) 

Client Side:

GUIEditor_Image = {} 
  
tiendaDeArmas2 = guiCreateWindow(181,168,456,318,"Gun Shop By:LiOneLMeSsI",false) 
botonComprarColt-45 = guiCreateButton(15,106,99,26,"Colt($100)",false,tiendaDeArmas2) 
botonComprarShotgung = guiCreateButton(121,106,99,26,"Shotgungunn($500)",false,tiendaDeArmas2) 
botonComprarTec-9 = guiCreateButton(226,106,99,26,"Tec-9($650)",false,tiendaDeArmas2) 
botonComprarUZI = guiCreateButton(330,106,98,26,"UZI($700)",false,tiendaDeArmas2) 
botonComprarMunicColt-45 = guiCreateButton(11,234,105,26,"Ammo.x17($10)",false,tiendaDeArmas2) 
botonComprarMunicUZI = guiCreateButton(336,234,105,26,"Ammo.x20($50)",false,tiendaDeArmas2) 
botonComprarMunicTec-9 = guiCreateButton(228,234,105,26,"Ammo.x30($40)",false,tiendaDeArmas2) 
botonComprarMunicShotgung = guiCreateButton(120,234,105,26,"Ammo.x17($25)",false,tiendaDeArmas2) 
municTec-9Img = guiCreateStaticImage(248,154,68,73,"images/53.png",false,tiendaDeArmas2) 
municUZIImg = guiCreateStaticImage(356,155,62,70,"images/55.png",false,tiendaDeArmas2) 
municColt-45Img = guiCreateStaticImage(35,157,64,71,"images/51.png",false,tiendaDeArmas2) 
municShotgungImg = guiCreateStaticImage(141,154,66,72,"images/52.png",false,tiendaDeArmas2) 
imageColt-45 = guiCreateStaticImage(35,38,63,61,"images/22.png",false,tiendaDeArmas2) 
imageUZI = guiCreateStaticImage(342,36,64,62,"images/28.png",false,tiendaDeArmas2) 
imageTec-9 = guiCreateStaticImage(242,34,65,65,"images/32.png",false,tiendaDeArmas2) 
imageEscopeta = guiCreateStaticImage(138,37,65,62,"images/25.png",false,tiendaDeArmas2) 
Salir = guiCreateButton(362,279,70,25,"Close",false,tiendaDeArmas2) 
guiWindowSetMovable(tiendaDeArmas2,false) 
guiWindowSetSizable(tiendaDeArmas2,false) 
guiSetVisible(tiendaDeArmas2,false) 
  
function mostrarTienda() 
guiSetVisible (tiendaDeArmas2,true) 
showCursor(true) 
end 
addEvent("mostrarTienda",true) 
addEventHandler("mostrarTienda",getRootElement(),mostrarTienda) 
  
function closeShop2() 
    if guiGetVisible(tiendaDeArmas2) then  
        guiSetVisible(tiendaDeArmas2,false) 
        showCursor(false) 
    end 
end 
addEventHandler ("onClientGUIClick", Salir, closeShop2) 
  
function darColt-45() 
    local itemID = 22 
    local itemCost = 100 
    local itemMunic = 1 
    triggerServerEvent ("comproColt-45", getLocalPlayer(), itemID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarColt-45, darColt-45) 
  
function darShotgung() 
    local itemID = 25 
    local itemCost = 500 
    local itemMunic = 1  
    triggerServerEvent ("comproShotgungunn", getLocalPlayer(), itemID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarShotgung, darShotgung) 
  
function darTec-9() 
    local itemID = 32 
    local itemCost = 600 
    local itemMunic = 1 
    triggerServerEvent ("comproTec-9", getLocalPlayer(), itemID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarTec-9, darTec-9) 
  
function darUZI() 
    local itemID = 28 
    local itemCost = 700 
    local itemMunic = 1 
    triggerServerEvent ("comproUZI", getLocalPlayer(), itemID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarUZI, darUZI) 
  
function darMunicUZI() 
    local armaID = 28 
    local itemCost = 50 
    local itemMunic = 30 
    triggerServerEvent ("comproMunicionUZI", getLocalPlayer(), armaID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarMunicUZI, darMunicUZI) 
  
function darMunicTec-9() 
    local armaID = 32 
    local itemCost = 40 
    local itemMunic = 30 
    triggerServerEvent ("comproMunicionTec-9", getLocalPlayer(), armaID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarMunicTec-9, darMunicTec-9) 
  
function darMunicShotgung() 
    local armaID = 25 
    local itemCost = 25 
    local itemMunic = 17 
    triggerServerEvent ("comproMunicionShotgung", getLocalPlayer(), armaID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarMunicShotgung, darMunicShotgung) 
  
function darMunicColt-45() 
    local armaID = 22 
    local itemCost = 10 
    local itemMunic = 17 
    triggerServerEvent ("comproMunicionColt-45", getLocalPlayer(), armaID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarMunicColt-45, darMunicColt-45) 

Errors:

WARRNING: Loading script failed: shop1\tienda_sv.lua:76: unexpected symbol near '_' 

I hope you can help me guys :) And thanks :D

Link to comment
Well, from what you are giving us, i can't find the error you're saying. I think you forgot to give us the right script which is the file "tienda_sv.lua".

You can't find the error? just try to open the script in any local server :/..and see the error :( :(

read the error again please

SCRIPT ERROR: shop1\tienda_sv.lua:76 unexpected symbo1 near '-' 

Link to comment

My bad, on the error you said "_", and it was actually "-", not exactly the same, so i didn't look at the script.

In your script, one of the variables is named tieneTec-9, but the server reads it like tieneTec - 9, like maths you know. So you can replace it by tieneTec_9:

    marcadorTienda = createMarker(2285.8000488281,549.59997558594,6.8000001907349,"cylinder",1.5,0,125,250,153) 
    
function mostrarTienda(hitPlayer) 
    triggerClientEvent(hitPlayer,"mostrarTienda",getRootElement(),hitPlayer) 
end 
addEventHandler("onMarkerHit",marcadorTienda,mostrarTienda) 
  
addEvent ("comproColt-45", true) 
addEventHandler ("comproColt-45", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You Bought a colt", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproShotgun", true) 
addEventHandler ("comproShotgun", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a Shotgun", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproTec-9", true) 
addEventHandler ("comproTec-9", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a Tec-9", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproUZI", true) 
addEventHandler ("comproUZI", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a UZI", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionUZI", true) 
addEventHandler ("comproMunicionUZI", getRootElement(), 
function (id, cost,munic) 
  local tieneUZI = getPedWeapon(source,5) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneUZI == 28) then 
    outputChatBox ("Congratulations!,you bought a UZI ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneUZI ~= 28) then 
    outputChatBox ("Ehm,I think you forgot to buy the UZI First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneUZI == 28) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else 
 outputChatBox ("Ehm,I think you forgot to buy the UZI First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionTec-9", true) 
addEventHandler ("comproMunicionTec-9", getRootElement(), 
function (id, cost,munic) 
  local tieneTec_9 = getPedWeapon(source,4) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneTec_9 == 32) then 
    outputChatBox ("Congratulations!,You bought a Tec-9 Ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneTec_9 ~= 32) then 
    outputChatBox ("Ehm,I think you forgot to buy the Tec-9 First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneTec_9 == 32) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Tec-9 First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionShotg", true) 
addEventHandler ("comproMunicionShotg", getRootElement(), 
function (id, cost,munic) 
  local tieneShotgun = getPedWeapon(source,3) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneShotgun == 25) then 
    outputChatBox ("Congratulations,You bought a shotgun ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneShotgun ~= 25) then 
    outputChatBox ("Ehm,I think you forgot to buy the Shotgun First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneShotgun == 25) then 
    outputChatBox ("No money? Go kill some zombies.", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Shotgun First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionColt-45", true) 
addEventHandler ("comproMunicionColt-45", getRootElement(), 
function (id, cost,munic) 
  local tieneColt-45 = getPedWeapon(source,2) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneColt-45 == 22) then 
    outputChatBox ("Congartulations,You bought a Colt ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneColt-45 ~= 22) then 
    outputChatBox ("Ehm,I think you forgot to buy the Colt First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneColt-45 == 22) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Colt First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEventHandler("onResourceStart",getRootElement(), 
function () 
    outputChatBox("Gunshop by LiOneLMeSsI") 
end 
) 

Once again, read the error and you should be able to fix it yourself.

Link to comment
My bad, on the error you said "_", and it was actually "-", not exactly the same, so i didn't look at the script.

In your script, one of the variables is named tieneTec-9, but the server reads it like tieneTec - 9, like maths you know. So you can replace it by tieneTec_9:

    marcadorTienda = createMarker(2285.8000488281,549.59997558594,6.8000001907349,"cylinder",1.5,0,125,250,153) 
    
function mostrarTienda(hitPlayer) 
    triggerClientEvent(hitPlayer,"mostrarTienda",getRootElement(),hitPlayer) 
end 
addEventHandler("onMarkerHit",marcadorTienda,mostrarTienda) 
  
addEvent ("comproColt-45", true) 
addEventHandler ("comproColt-45", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You Bought a colt", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproShotgun", true) 
addEventHandler ("comproShotgun", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a Shotgun", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproTec-9", true) 
addEventHandler ("comproTec-9", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a Tec-9", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproUZI", true) 
addEventHandler ("comproUZI", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a UZI", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionUZI", true) 
addEventHandler ("comproMunicionUZI", getRootElement(), 
function (id, cost,munic) 
  local tieneUZI = getPedWeapon(source,5) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneUZI == 28) then 
    outputChatBox ("Congratulations!,you bought a UZI ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneUZI ~= 28) then 
    outputChatBox ("Ehm,I think you forgot to buy the UZI First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneUZI == 28) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else 
 outputChatBox ("Ehm,I think you forgot to buy the UZI First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionTec-9", true) 
addEventHandler ("comproMunicionTec-9", getRootElement(), 
function (id, cost,munic) 
  local tieneTec_9 = getPedWeapon(source,4) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneTec_9 == 32) then 
    outputChatBox ("Congratulations!,You bought a Tec-9 Ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneTec_9 ~= 32) then 
    outputChatBox ("Ehm,I think you forgot to buy the Tec-9 First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneTec_9 == 32) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Tec-9 First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionShotg", true) 
addEventHandler ("comproMunicionShotg", getRootElement(), 
function (id, cost,munic) 
  local tieneShotgun = getPedWeapon(source,3) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneShotgun == 25) then 
    outputChatBox ("Congratulations,You bought a shotgun ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneShotgun ~= 25) then 
    outputChatBox ("Ehm,I think you forgot to buy the Shotgun First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneShotgun == 25) then 
    outputChatBox ("No money? Go kill some zombies.", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Shotgun First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionColt-45", true) 
addEventHandler ("comproMunicionColt-45", getRootElement(), 
function (id, cost,munic) 
  local tieneColt-45 = getPedWeapon(source,2) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneColt-45 == 22) then 
    outputChatBox ("Congartulations,You bought a Colt ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneColt-45 ~= 22) then 
    outputChatBox ("Ehm,I think you forgot to buy the Colt First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneColt-45 == 22) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Colt First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEventHandler("onResourceStart",getRootElement(), 
function () 
    outputChatBox("Gunshop by LiOneLMeSsI") 
end 
) 

Once again, read the error and you should be able to fix it yourself.

AHA!! Understand now :D gonna try and tell you..thanks

Link to comment
My bad, on the error you said "_", and it was actually "-", not exactly the same, so i didn't look at the script.

In your script, one of the variables is named tieneTec-9, but the server reads it like tieneTec - 9, like maths you know. So you can replace it by tieneTec_9:

    marcadorTienda = createMarker(2285.8000488281,549.59997558594,6.8000001907349,"cylinder",1.5,0,125,250,153) 
    
function mostrarTienda(hitPlayer) 
    triggerClientEvent(hitPlayer,"mostrarTienda",getRootElement(),hitPlayer) 
end 
addEventHandler("onMarkerHit",marcadorTienda,mostrarTienda) 
  
addEvent ("comproColt-45", true) 
addEventHandler ("comproColt-45", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You Bought a colt", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproShotgun", true) 
addEventHandler ("comproShotgun", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a Shotgun", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproTec-9", true) 
addEventHandler ("comproTec-9", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a Tec-9", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproUZI", true) 
addEventHandler ("comproUZI", getRootElement(), 
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a UZI", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionUZI", true) 
addEventHandler ("comproMunicionUZI", getRootElement(), 
function (id, cost,munic) 
  local tieneUZI = getPedWeapon(source,5) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneUZI == 28) then 
    outputChatBox ("Congratulations!,you bought a UZI ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneUZI ~= 28) then 
    outputChatBox ("Ehm,I think you forgot to buy the UZI First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneUZI == 28) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else 
 outputChatBox ("Ehm,I think you forgot to buy the UZI First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionTec-9", true) 
addEventHandler ("comproMunicionTec-9", getRootElement(), 
function (id, cost,munic) 
  local tieneTec_9 = getPedWeapon(source,4) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneTec_9 == 32) then 
    outputChatBox ("Congratulations!,You bought a Tec-9 Ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneTec_9 ~= 32) then 
    outputChatBox ("Ehm,I think you forgot to buy the Tec-9 First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneTec_9 == 32) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Tec-9 First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionShotg", true) 
addEventHandler ("comproMunicionShotg", getRootElement(), 
function (id, cost,munic) 
  local tieneShotgun = getPedWeapon(source,3) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneShotgun == 25) then 
    outputChatBox ("Congratulations,You bought a shotgun ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneShotgun ~= 25) then 
    outputChatBox ("Ehm,I think you forgot to buy the Shotgun First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneShotgun == 25) then 
    outputChatBox ("No money? Go kill some zombies.", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Shotgun First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionColt-45", true) 
addEventHandler ("comproMunicionColt-45", getRootElement(), 
function (id, cost,munic) 
  local tieneColt-45 = getPedWeapon(source,2) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneColt-45 == 22) then 
    outputChatBox ("Congartulations,You bought a Colt ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneColt-45 ~= 22) then 
    outputChatBox ("Ehm,I think you forgot to buy the Colt First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneColt-45 == 22) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Colt First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEventHandler("onResourceStart",getRootElement(), 
function () 
    outputChatBox("Gunshop by LiOneLMeSsI") 
end 
) 

Once again, read the error and you should be able to fix it yourself.

AHA!! Understand now gonna try and tell you..thanks

look changed it and got another problem but fixed too..everything's fixed now but there's another error but not shown anything in CMD window..with when i buy UZI weapon works..but when i buy the ammo for it..it tells me the message

"i think you forgot to buy UZI first"

but i bought it already...Another weapons're Working good normal with buy gun and buy ammo..This scripts after i fixed

Server Side:

    marcadorTienda = createMarker(2285.8000488281,549.59997558594,6.8000001907349,"cylinder",1.5,0,125,250,153) 
     
function mostrarTienda(hitPlayer) 
    triggerClientEvent(hitPlayer,"mostrarTienda",getRootElement(),hitPlayer) 
end 
addEventHandler("onMarkerHit",marcadorTienda,mostrarTienda) 
  
addEvent ("comprocolt_45", true) 
addEventHandler ("comprocolt_45", getRootElement(),  
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You Bought a colt", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproShotgun", true) 
addEventHandler ("comproShotgun", getRootElement(),  
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a Shotgun", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comprotec_9", true) 
addEventHandler ("comprotec_9", getRootElement(),  
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a tec_9", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproUZI", true) 
addEventHandler ("comproUZI", getRootElement(),  
function (id, cost,munic) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("Congratulations!,You bought a UZI", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber (id),tonumber (munic)) 
  else 
    outputChatBox ("No money? Go kill some Zombies", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionUZI", true) 
addEventHandler ("comproMunicionUZI", getRootElement(),  
function (id, cost,munic) 
  local tieneUZI = getPedWeapon(source,5) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneUZI == 28) then 
    outputChatBox ("Congratulations!,you bought a UZI ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneUZI ~= 28) then 
    outputChatBox ("Ehm,I think you forgot to buy the UZI First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneUZI == 28) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else  
 outputChatBox ("Ehm,I think you forgot to buy the UZI First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMuniciontec_9", true) 
addEventHandler ("comproMuniciontec_9", getRootElement(),  
function (id, cost,munic) 
  local tienetec_9 = getPedWeapon(source,4) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tienetec_9 == 32) then 
    outputChatBox ("Congratulations!,You bought a tec_9 Ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tienetec_9 ~= 32) then 
    outputChatBox ("Ehm,I think you forgot to buy the tec_9 First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tienetec_9 == 32) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the tec_9 First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicionShotgun", true) 
addEventHandler ("comproMunicionShotgun", getRootElement(),  
function (id, cost,munic) 
  local tieneShotgun = getPedWeapon(source,3) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tieneShotgun == 25) then 
    outputChatBox ("Congratulations,You bought a shotgun ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneShotgun ~= 25) then 
    outputChatBox ("Ehm,I think you forgot to buy the Shotgun First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneShotgun == 25) then 
    outputChatBox ("No money? Go kill some zombies.", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Shotgun First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEvent ("comproMunicioncolt_45", true) 
addEventHandler ("comproMunicioncolt_45", getRootElement(),  
function (id, cost,munic) 
  local tienecolt_45 = getPedWeapon(source,2) 
  if (getPlayerMoney (source) >= tonumber(cost)) and (tienecolt_45 == 22) then 
    outputChatBox ("Congartulations,You bought a Colt ammo", source, 0, 255, 0, false) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source,tonumber(id),tonumber(munic)) 
  elseif (getPlayerMoney (source) >= tonumber(cost)) and (tienecolt_45 ~= 22) then 
    outputChatBox ("Ehm,I think you forgot to buy the Colt First -.-", source, 255, 0, 0, false) 
  elseif (getPlayerMoney (source) < tonumber(cost)) and (tienecolt_45 == 22) then 
    outputChatBox ("No money? Go kill some zombies", source, 255, 0, 0, false) 
  else outputChatBox ("Ehm,I think you forgot to buy the Colt First -.-", source, 255, 0, 0, false) 
  end 
end) 
  
addEventHandler("onResourceStart",getRootElement(), 
function () 
    outputChatBox("Gunshop by LiOneLMeSsI") 
end 
) 

Client Side:

GUIEditor_Image = {} 
  
tiendaDeArmas2 = guiCreateWindow(181,168,456,318,"Gun Shop By:LiOneLMeSsI",false) 
botonComprarcolt_45 = guiCreateButton(15,106,99,26,"Colt($100)",false,tiendaDeArmas2) 
botonComprarShotgun = guiCreateButton(121,106,99,26,"Shotgun($500)",false,tiendaDeArmas2) 
botonComprartec_9 = guiCreateButton(226,106,99,26,"tec_9($650)",false,tiendaDeArmas2) 
botonComprarUZI = guiCreateButton(330,106,98,26,"UZI($700)",false,tiendaDeArmas2) 
botonComprarMuniccolt_45 = guiCreateButton(11,234,105,26,"Ammo.x17($10)",false,tiendaDeArmas2) 
botonComprarMunicUZI = guiCreateButton(336,234,105,26,"Ammo.x20($50)",false,tiendaDeArmas2) 
botonComprarMunictec_9 = guiCreateButton(228,234,105,26,"Ammo.x30($40)",false,tiendaDeArmas2) 
botonComprarMunicShotgun = guiCreateButton(120,234,105,26,"Ammo.x17($25)",false,tiendaDeArmas2) 
munictec_9Img = guiCreateStaticImage(248,154,68,73,"images/53.png",false,tiendaDeArmas2) 
municUZIImg = guiCreateStaticImage(356,155,62,70,"images/55.png",false,tiendaDeArmas2) 
municcolt_45Img = guiCreateStaticImage(35,157,64,71,"images/51.png",false,tiendaDeArmas2) 
municShotgunImg = guiCreateStaticImage(141,154,66,72,"images/52.png",false,tiendaDeArmas2) 
imagecolt_45 = guiCreateStaticImage(35,38,63,61,"images/22.png",false,tiendaDeArmas2) 
imageUZI = guiCreateStaticImage(342,36,64,62,"images/28.png",false,tiendaDeArmas2) 
imagetec_9 = guiCreateStaticImage(242,34,65,65,"images/32.png",false,tiendaDeArmas2) 
imageEscopeta = guiCreateStaticImage(138,37,65,62,"images/25.png",false,tiendaDeArmas2) 
Salir = guiCreateButton(362,279,70,25,"Close",false,tiendaDeArmas2) 
guiWindowSetMovable(tiendaDeArmas2,false) 
guiWindowSetSizable(tiendaDeArmas2,false) 
guiSetVisible(tiendaDeArmas2,false) 
  
function mostrarTienda() 
guiSetVisible (tiendaDeArmas2,true) 
showCursor(true) 
end 
addEvent("mostrarTienda",true) 
addEventHandler("mostrarTienda",getRootElement(),mostrarTienda) 
  
function closeShop2() 
    if guiGetVisible(tiendaDeArmas2) then  
        guiSetVisible(tiendaDeArmas2,false) 
        showCursor(false) 
    end 
end 
addEventHandler ("onClientGUIClick", Salir, closeShop2) 
  
function darcolt_45() 
    local itemID = 22 
    local itemCost = 100 
    local itemMunic = 1 
    triggerServerEvent ("comprocolt_45", getLocalPlayer(), itemID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarcolt_45, darcolt_45) 
  
function darShotgun() 
    local itemID = 25 
    local itemCost = 500 
    local itemMunic = 1  
    triggerServerEvent ("comproShotgun", getLocalPlayer(), itemID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarShotgun, darShotgun) 
  
function dartec_9() 
    local itemID = 32 
    local itemCost = 600 
    local itemMunic = 1 
    triggerServerEvent ("comprotec_9", getLocalPlayer(), itemID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprartec_9, dartec_9) 
  
function darUZI() 
    local itemID = 28 
    local itemCost = 700 
    local itemMunic = 1 
    triggerServerEvent ("comproUZI", getLocalPlayer(), itemID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarUZI, darUZI) 
  
function darMunicUZI() 
    local armaID = 28 
    local itemCost = 50 
    local itemMunic = 30 
    triggerServerEvent ("comproMunicionUZI", getLocalPlayer(), armaID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarMunicUZI, darMunicUZI) 
  
function darMunictec_9() 
    local armaID = 32 
    local itemCost = 40 
    local itemMunic = 30 
    triggerServerEvent ("comproMuniciontec_9", getLocalPlayer(), armaID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarMunictec_9, darMunictec_9) 
  
function darMunicShotgun() 
    local armaID = 25 
    local itemCost = 25 
    local itemMunic = 17 
    triggerServerEvent ("comproMunicionShotgun", getLocalPlayer(), armaID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarMunicShotgun, darMunicShotgun) 
  
function darMuniccolt_45() 
    local armaID = 22 
    local itemCost = 10 
    local itemMunic = 17 
    triggerServerEvent ("comproMunicioncolt_45", getLocalPlayer(), armaID, itemCost,itemMunic) 
end 
addEventHandler ("onClientGUIClick", botonComprarMuniccolt_45, darMuniccolt_45) 

Please help me with this :( ....and THanks a lot

Link to comment
Well, that is wrong: (line 59)
  local tieneUZI = getPedWeapon(source,5) 

the slot 5 is for assault rifles, and the UZI is a submachine gun, just change it to 4.

   local tieneUZI = getPedWeapon(source,4) 

Here you got the weapons and their slots: https://wiki.multitheftauto.com/wiki/Weapon

Woohoo!!! Working Clear Cool Nice :) Thanks a lot of your nice HELP :)

.. may you add me in skype?: lionelmessishoter .. i want to speak with you

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