createPed ( 233, -1510.3675537109, 1414.2272949219, 1.3327666521072 )
marcadorTienda = createMarker( -1508.2982177734, 1414.5153808594, 1.3277132511139,"cylinder",1.5,0,125,250,153)
function mostrarTienda(hitPlayer)
triggerClientEvent(hitPlayer,"mostrarTienda",getRootElement(),hitPlayer)
end
addEventHandler("onMarkerHit",marcadorTienda,mostrarTienda)
addEvent ("comproDeagle", true)
addEventHandler ("comproDeagle", getRootElement(),
function (id, cost,munic)
if (getPlayerMoney (source) >= tonumber(cost)) then
outputChatBox ("Has comprado una Deagle", source, 0, 255, 0, false)
takePlayerMoney (source, tonumber (cost))
giveWeapon(source, tonumber (id),tonumber (munic))
else
outputChatBox ("Necesitas dinero", source, 255, 0, 0, false)
end
end)
addEvent ("comproShotgun", true)
addEventHandler ("comproShotgun", getRootElement(),
function (id, cost,munic)
if (getPlayerMoney (source) >= tonumber(cost)) then
outputChatBox ("Has comprado una Shotgun", source, 0, 255, 0, false)
takePlayerMoney (source, tonumber (cost))
giveWeapon(source, tonumber (id),tonumber (munic))
else
outputChatBox ("Necesitas dinero", source, 255, 0, 0, false)
end
end)
addEvent ("comproMp5", true)
addEventHandler ("comproMp5", getRootElement(),
function (id, cost,munic)
if (getPlayerMoney (source) >= tonumber(cost)) then
outputChatBox ("Has comprado una Mp5", source, 0, 255, 0, false)
takePlayerMoney (source, tonumber (cost))
giveWeapon(source, tonumber (id),tonumber (munic))
else
outputChatBox ("Necesitas dinero", source, 255, 0, 0, false)
end
end)
addEvent ("comproM4", true)
addEventHandler ("comproM4", getRootElement(),
function (id, cost,munic)
if (getPlayerMoney (source) >= tonumber(cost)) then
outputChatBox ("Has comprado una M4", source, 0, 255, 0, false)
takePlayerMoney (source, tonumber (cost))
giveWeapon(source, tonumber (id),tonumber (munic))
else
outputChatBox ("Necesitas dinero", source, 255, 0, 0, false)
end
end)
addEvent ("comproMunicionM4", true)
addEventHandler ("comproMunicionM4", getRootElement(),
function (id, cost,munic)
local tieneM4 = getPedWeapon(source,5)
if (getPlayerMoney (source) >= tonumber(cost)) and (tieneM4 == 31) then
outputChatBox ("Has comprado municion de M4", source, 0, 255, 0, false)
takePlayerMoney (source, tonumber (cost))
giveWeapon(source,tonumber(id),tonumber(munic))
elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneM4 ~= 31) then
outputChatBox ("No Tienes Esta Arma", source, 255, 0, 0, false)
elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneM4 == 31) then
outputChatBox ("Necesitas dinero", source, 255, 0, 0, false)
else outputChatBox ("No Tienes Esta Arma", source, 255, 0, 0, false)
end
end)
addEvent ("comproMunicionMp5", true)
addEventHandler ("comproMunicionMp5", getRootElement(),
function (id, cost,munic)
local tieneMp5 = getPedWeapon(source,4)
if (getPlayerMoney (source) >= tonumber(cost)) and (tieneMp5 == 29) then
outputChatBox ("Has comprado municion de Mp5", source, 0, 255, 0, false)
takePlayerMoney (source, tonumber (cost))
giveWeapon(source,tonumber(id),tonumber(munic))
elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneMp5 ~= 29) then
outputChatBox ("No Tienes Esta Arma", source, 255, 0, 0, false)
elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneMp5 == 29) then
outputChatBox ("Necesitas dinero", source, 255, 0, 0, false)
else outputChatBox ("No Tienes Esta Arma", 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 ("Has comprado municion de Shotgun", 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 ("No Tienes Esta Arma", source, 255, 0, 0, false)
elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneShotgun == 25) then
outputChatBox ("Necesitas dinero", source, 255, 0, 0, false)
else outputChatBox ("No Tienes Esta Arma", source, 255, 0, 0, false)
end
end)
addEvent ("comproMunicionDeagle", true)
addEventHandler ("comproMunicionDeagle", getRootElement(),
function (id, cost,munic)
local tieneDeagle = getPedWeapon(source,2)
if (getPlayerMoney (source) >= tonumber(cost)) and (tieneDeagle == 24) then
outputChatBox ("Has comprado municion de Deagle", source, 0, 255, 0, false)
takePlayerMoney (source, tonumber (cost))
giveWeapon(source,tonumber(id),tonumber(munic))
elseif (getPlayerMoney (source) >= tonumber(cost)) and (tieneDeagle ~= 24) then
outputChatBox ("No Tienes Esta Arma", source, 255, 0, 0, false)
elseif (getPlayerMoney (source) < tonumber(cost)) and (tieneDeagle == 24) then
outputChatBox ("Necesitas dinero", source, 255, 0, 0, false)
else outputChatBox ("No Tienes Esta Arma", source, 255, 0, 0, false)
end
end)
Intenta con eso