CobbTheWarriorsRPG
Members-
Posts
111 -
Joined
-
Last visited
Everything posted by CobbTheWarriorsRPG
-
Well im making this, if somebody damage you and you are in los santos, you dont get damaged but doesnt work --Server Side function cancelDamage( attacker, weapon, bodypart, loss ) local location = getElementZoneName ( attacker, true ) if ( location == "Los Santos" ) then cancelEvent() end end addEventHandler ( "onPlayerDamage", root, cancelDamage ))
-
[QUESTION]Is possible make this?
CobbTheWarriorsRPG replied to CobbTheWarriorsRPG's topic in Scripting
Thanks bro!!!!! -
[QUESTION]Is possible make this?
CobbTheWarriorsRPG replied to CobbTheWarriorsRPG's topic in Scripting
Hmm can you give me an example bro? i doesnt understand the example of the wiki -
Well i have a question... Its possible to change the .txd textures of the character cj? Thanks.
-
Doesnt work the table for the timer
-
I will test it @WhoAmI thanks!
-
Or trigger to client the timers?
-
It works but, when someone enters and you are holding the marker, the timer is killed
-
function SpawnPicks ( ) if ( not Marker ) then Marker = createMarker ( -1438.2526855469, 1490.6701660156, 1.8671875-0.5, "cylinder", 1.5, 255, 255, 0, 170 ) addEventHandler ( "onMarkerHit", Marker, onMarkerHit ) addEventHandler( "onMarkerLeave", Marker, markerLeave ) outputChatBox("#FF0000[ALERTA]#FFFFFFTraficantes avistados en "..getElementZoneName(Marker).."",root, 0,0,0, true) blip = createBlipAttachedTo ( Marker, 19 ) --Bots load bot1 = exports [ "slothbot" ]:spawnBot (-1451.6501464844, 1498.3551025391, 11.8046875, 0, 28, 0, 0, teamLV, 29, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot1, teamLV) bot2 = exports [ "slothbot" ]:spawnBot (-1454.3022460938, 1485.8472900391, 11.8046875, 0, 43, 0, 0, teamLV, 31, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot2, teamLV) bot3 = exports [ "slothbot" ]:spawnBot (-1460.1511230469, 1498.7517089844, 8.2578125, 0, 73, 0, 0, teamLV, 31, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot3, teamLV) bot4 = exports [ "slothbot" ]:spawnBot ( -1447.7530517578, 1490.2437744141, 7.1015625, 0, 100, 0, 0, teamLV, 4, "waiting", true ) exports [ "slothbot" ]:setBotTeam ( bot4, teamLV) bot5 = exports [ "slothbot" ]:spawnBot ( -1400.6428222656, 1488.1295166016, 7.1015625, 0, 102, 0, 0, teamLV, 27, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot5, teamLV) bot6 = exports [ "slothbot" ]:spawnBot ( -1399.9071044922, 1489.8024902344, 7.1015625, 0, 103, 0, 0, teamLV, 31, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot6, teamLV) bot7 = exports [ "slothbot" ]:spawnBot ( -1399.6480712891, 1492.4254150391, 7.1015625, 0, 104, 0, 0, teamLV, 27, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot7, teamLV) bot8 = exports [ "slothbot" ]:spawnBot ( -1385.8913574219, 1489.462890625, 13.84375, 0, 28, 0, 0, teamLV, 31, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot8, teamLV) bot9 = exports [ "slothbot" ]:spawnBot ( -1375.5046386719, 1488.4661865234, 11.203125, 0, 29, 0, 0, teamLV, 4, "waiting", true ) exports [ "slothbot" ]:setBotTeam ( bot9, teamLV) bot10 = exports [ "slothbot" ]:spawnBot ( -1383.7861328125, 1494.6298828125, 8.90625, 0, 102, 0, 0, teamLV, 27, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot10, teamLV) bot11 = exports [ "slothbot" ]:spawnBot ( -1370.4478759766, 1494.6135253906, 1.8515625, 0, 100, 0, 0, teamLV, 27, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot11, teamLV) bot12 = exports [ "slothbot" ]:spawnBot ( -1372.8487548828, 1495.0855712891, 1.8515625, 0, 103, 0, 0, teamLV, 22, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot12, teamLV) bot13 = exports [ "slothbot" ]:spawnBot ( -1399.1472167969, 1496.5262451172, 1.8671875, 0, 104, 0, 0, teamLV, 27, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot13, teamLV) bot14 = exports [ "slothbot" ]:spawnBot ( -1398.8568115234, 1483.0720214844, 1.8671875, 0, 28, 0, 0, teamLV, 31, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot14, teamLV) bot15 = exports [ "slothbot" ]:spawnBot ( -1391.5030517578, 1485.5445556641, 1.8671875, 0, 29, 0, 0, teamLV, 9, "waiting", true ) exports [ "slothbot" ]:setBotTeam ( bot15, teamLV) bot16 = exports [ "slothbot" ]:spawnBot ( -1422.9012451172, 1492.8765869141, 1.8671875, 0, 100, 0, 0, teamLV, 9, "waiting", true ) exports [ "slothbot" ]:setBotTeam ( bot16, teamLV) bot17 = exports [ "slothbot" ]:spawnBot ( -1436.3575439453, 1493.6381835938, 1.8671875, 0, 33, 0, 0, teamLV, 9, "waiting", true ) exports [ "slothbot" ]:setBotTeam ( bot17, teamLV) end end addEventHandler ( "onResourceStart", resourceRoot, SpawnPicks ) setTimer ( SpawnPicks, 1200000, 0 ) function onMarkerHit (player) if ( not isTimer (timer) ) then timer = setTimer ( function(player) local acc = getPlayerAccount ( player ) outputChatBox(getPlayerName(player).." Ha robado la droga!") setElementData(player,"Weed",getElementData(player,"Weed")+math.random(1,30)) setAccountData(acc,"Weed",getElementData(player,"Weed")) setElementData(player,"God",getElementData(player,"God")+math.random(1,30)) setAccountData(acc,"God",getElementData(player,"God")) setElementData(player,"Speed",getElementData(player,"Speed")+math.random(1,30)) setAccountData(acc,"Speed",getElementData(player,"Speed")) setElementData(player,"Lsd",getElementData(player,"Lsd")+math.random(1,30)) setAccountData(acc,"Lsd",getElementData(player,"Lsd")) setElementData(player,"Steroids",getElementData(player,"Steroids")+math.random(1,30)) setAccountData(acc,"Steroids",getElementData(player,"Steroids")) setElementData(player,"Heroin",getElementData(player,"Heroin")+math.random(1,30)) setAccountData(acc,"Heroin",getElementData(player,"Heroin")) destroyElement(bot1) destroyElement(bot2) destroyElement(bot3) destroyElement(bot4) destroyElement(bot5) destroyElement(bot6) destroyElement(bot7) destroyElement(bot8) destroyElement(bot9) destroyElement(bot10) destroyElement(bot11) destroyElement(bot12) destroyElement(bot13) destroyElement(bot14) destroyElement(bot15) destroyElement(bot16) destroyElement(bot17) destroyElement ( Marker ) destroyElement ( blip ) marker = nil end, 12000, 1, player) end end function markerLeave( ) if isTimer( timer ) then killTimer (timer) end end
-
In the lines 4 and 5, expected element at argument 2, got nil
-
Doesnt work bro 0_o
-
Doesnt work bro see function onMarkerHit (player) if ( not isTimer (timer) ) then timer = setTimer ( function() local acc = getPlayerAccount ( player ) outputChatBox(getPlayerName(player).." Ha robado la droga!") setElementData(player,"Weed",getElementData(player,"Weed")+math.random(1,30)) setAccountData(acc,"Weed",getElementData(player,"Weed")) setElementData(player,"God",getElementData(player,"God")+math.random(1,30)) setAccountData(acc,"God",getElementData(player,"God")) setElementData(player,"Speed",getElementData(player,"Speed")+math.random(1,30)) setAccountData(acc,"Speed",getElementData(player,"Speed")) setElementData(player,"Lsd",getElementData(player,"Lsd")+math.random(1,30)) setAccountData(acc,"Lsd",getElementData(player,"Lsd")) setElementData(player,"Steroids",getElementData(player,"Steroids")+math.random(1,30)) setAccountData(acc,"Steroids",getElementData(player,"Steroids")) setElementData(player,"Heroin",getElementData(player,"Heroin")+math.random(1,30)) setAccountData(acc,"Heroin",getElementData(player,"Heroin")) destroyElement(bot1) destroyElement(bot2) destroyElement(bot3) destroyElement(bot4) destroyElement(bot5) destroyElement(bot6) destroyElement(bot7) destroyElement(bot8) destroyElement(bot9) destroyElement(bot10) destroyElement(bot11) destroyElement(bot12) destroyElement(bot13) destroyElement(bot14) destroyElement(bot15) destroyElement(bot16) destroyElement(bot17) end, 5000, 1) end destroyElement ( marker ) destroyElement ( blip ) marker = nil end
-
No errors on debugscript, and when you stay in the marker along two minutes does not give the drug
-
Well, im trying to make, when you stay in a marker for 2 minutes, the timer called timer gives to you "drugs", and when you stay in the marker along two minutes does not give the drug function SpawnPicks ( ) if ( not marker ) then marker = createMarker ( -1438.2526855469, 1490.6701660156, 1.8671875-0.5, "cylinder", 1.5, 255, 255, 0, 170 ) addEventHandler ( "onMarkerHit", Marker, onMarkerHit ) addEventHandler( "onMarkerLeave", Marker, markerLeave ) outputChatBox("#FF0000[ALERTA]#FFFFFFTraficantes avistados en "..getElementZoneName(marker).."",root, 0,0,0, true) blip = createBlipAttachedTo ( marker, 19 ) --Bots load bot1 = exports [ "slothbot" ]:spawnBot (-1451.6501464844, 1498.3551025391, 11.8046875, 0, 28, 0, 0, teamLV, 29, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot1, teamLV) bot2 = exports [ "slothbot" ]:spawnBot (-1454.3022460938, 1485.8472900391, 11.8046875, 0, 43, 0, 0, teamLV, 31, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot2, teamLV) bot3 = exports [ "slothbot" ]:spawnBot (-1460.1511230469, 1498.7517089844, 8.2578125, 0, 73, 0, 0, teamLV, 31, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot3, teamLV) bot4 = exports [ "slothbot" ]:spawnBot ( -1447.7530517578, 1490.2437744141, 7.1015625, 0, 100, 0, 0, teamLV, 4, "waiting", true ) exports [ "slothbot" ]:setBotTeam ( bot4, teamLV) bot5 = exports [ "slothbot" ]:spawnBot ( -1400.6428222656, 1488.1295166016, 7.1015625, 0, 102, 0, 0, teamLV, 27, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot5, teamLV) bot6 = exports [ "slothbot" ]:spawnBot ( -1399.9071044922, 1489.8024902344, 7.1015625, 0, 103, 0, 0, teamLV, 31, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot6, teamLV) bot7 = exports [ "slothbot" ]:spawnBot ( -1399.6480712891, 1492.4254150391, 7.1015625, 0, 104, 0, 0, teamLV, 27, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot7, teamLV) bot8 = exports [ "slothbot" ]:spawnBot ( -1385.8913574219, 1489.462890625, 13.84375, 0, 28, 0, 0, teamLV, 31, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot8, teamLV) bot9 = exports [ "slothbot" ]:spawnBot ( -1375.5046386719, 1488.4661865234, 11.203125, 0, 29, 0, 0, teamLV, 4, "waiting", true ) exports [ "slothbot" ]:setBotTeam ( bot9, teamLV) bot10 = exports [ "slothbot" ]:spawnBot ( -1383.7861328125, 1494.6298828125, 8.90625, 0, 102, 0, 0, teamLV, 27, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot10, teamLV) bot11 = exports [ "slothbot" ]:spawnBot ( -1370.4478759766, 1494.6135253906, 1.8515625, 0, 100, 0, 0, teamLV, 27, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot11, teamLV) bot12 = exports [ "slothbot" ]:spawnBot ( -1372.8487548828, 1495.0855712891, 1.8515625, 0, 103, 0, 0, teamLV, 22, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot12, teamLV) bot13 = exports [ "slothbot" ]:spawnBot ( -1399.1472167969, 1496.5262451172, 1.8671875, 0, 104, 0, 0, teamLV, 27, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot13, teamLV) bot14 = exports [ "slothbot" ]:spawnBot ( -1398.8568115234, 1483.0720214844, 1.8671875, 0, 28, 0, 0, teamLV, 31, "guarding", true ) exports [ "slothbot" ]:setBotTeam ( bot14, teamLV) bot15 = exports [ "slothbot" ]:spawnBot ( -1391.5030517578, 1485.5445556641, 1.8671875, 0, 29, 0, 0, teamLV, 9, "waiting", true ) exports [ "slothbot" ]:setBotTeam ( bot15, teamLV) bot16 = exports [ "slothbot" ]:spawnBot ( -1422.9012451172, 1492.8765869141, 1.8671875, 0, 100, 0, 0, teamLV, 9, "waiting", true ) exports [ "slothbot" ]:setBotTeam ( bot16, teamLV) bot17 = exports [ "slothbot" ]:spawnBot ( -1436.3575439453, 1493.6381835938, 1.8671875, 0, 33, 0, 0, teamLV, 9, "waiting", true ) exports [ "slothbot" ]:setBotTeam ( bot17, teamLV) end end addEventHandler ( "onResourceStart", resourceRoot, SpawnPicks ) setTimer ( SpawnPicks, 1200000, 0 ) function onMarkerHit (player) if ( not isTimer(timer) ) then --Here timer = setTimer ( function() local acc = getPlayerAccount ( player ) outputChatBox(getPlayerName(player).." Ha robado la droga!") setElementData(player,"Weed",getElementData(player,"Weed")+math.random(1,30)) setAccountData(acc,"Weed",getElementData(player,"Weed")) setElementData(player,"God",getElementData(player,"God")+math.random(1,30)) setAccountData(acc,"God",getElementData(player,"God")) setElementData(player,"Speed",getElementData(player,"Speed")+math.random(1,30)) setAccountData(acc,"Speed",getElementData(player,"Speed")) setElementData(player,"Lsd",getElementData(player,"Lsd")+math.random(1,30)) setAccountData(acc,"Lsd",getElementData(player,"Lsd")) setElementData(player,"Steroids",getElementData(player,"Steroids")+math.random(1,30)) setAccountData(acc,"Steroids",getElementData(player,"Steroids")) setElementData(player,"Heroin",getElementData(player,"Heroin")+math.random(1,30)) setAccountData(acc,"Heroin",getElementData(player,"Heroin")) destroyElement(bot1) destroyElement(bot2) destroyElement(bot3) destroyElement(bot4) destroyElement(bot5) destroyElement(bot6) destroyElement(bot7) destroyElement(bot8) destroyElement(bot9) destroyElement(bot10) destroyElement(bot11) destroyElement(bot12) destroyElement(bot13) destroyElement(bot14) destroyElement(bot15) destroyElement(bot16) destroyElement(bot17) end, 120000, 1) killTimer(timer) destroyElement ( marker ) destroyElement ( blip ) pickup = nil end end function markerLeave( ) if isTimer( timer ) then killTimer (timer) end end
-
Hi... i Need a scripter for doing a drug sell system, its so easy, but i dont know how to do it, if you are interested contact me on PM or leave a message, i will pay.
-
[AYUDA]Panel de venta de drogas
CobbTheWarriorsRPG replied to CobbTheWarriorsRPG's topic in Scripting
No pero mira, es un panel para el vendedor, y otro panel para el comprador (se abre cuando este golpea un marcador), digamos yo soy el vendedor, tengo un editbox y coloco el precio de la marihuana en 1 y le doy guardar, ahora quiero que al vendedor al entrar al marcador vea el precio! -
Buenas, estoy tratando de hacer un panel de venta de drogas, todo iba muy bien...pero ya no sé como hacer que cuando le coloques un precio digamos a la maría, éste precio quede guardado y aparesca en el editbox de el comprador, las drogas se almacenan en setAccountData, aun no estan agregadas por que no sé como realizar esto, una ayudita? gracias! client Side -Window sell y compra GUIEditor = { label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() ventanaCompra = guiCreateWindow(222, 119, 395, 349, "Comprar Drogas a usuario", false) guiWindowSetSizable(ventanaCompra, false) cerrarCompra = guiCreateButton(46, 293, 93, 46, "Cerrar", false, ventanaCompra) cantidadCripa = guiCreateEdit(248, 46, 43, 31, "", false, ventanaCompra) cantidadRuedas = guiCreateEdit(248, 87, 43, 31, "", false, ventanaCompra) cantidadPerica = guiCreateEdit(248, 128, 43, 31, "", false, ventanaCompra) cantidadLsd = guiCreateEdit(248, 169, 43, 31, "", false, ventanaCompra) cantidadHeroina = guiCreateEdit(248, 210, 43, 31, "", false, ventanaCompra) cantidadRivotril = guiCreateEdit(248, 251, 43, 31, "", false, ventanaCompra) precioCripa = guiCreateEdit(149, 46, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioCripa, true) precioRuedas = guiCreateEdit(149, 87, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioRuedas, true) precioPerica = guiCreateEdit(149, 128, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioPerica, true) precioLsd = guiCreateEdit(149, 169, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioLsd, true) precioHeroina = guiCreateEdit(149, 210, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioHeroina, true) precioRivotril = guiCreateEdit(149, 251, 86, 31, "", false, ventanaCompra) guiEditSetReadOnly(precioRivotril, true) GUIEditor.label[1] = guiCreateLabel(15, 47, 124, 236, "Cripa Precio\n\n\nRuedas Precio\n\n\nPerica Precio\n\n\nLsd Precio\n\n\nHeroina Precio\n\n\nRivotril Precio", false, ventanaCompra) GUIEditor.label[2] = guiCreateLabel(241, 23, 50, 13, "Cantidad", false, ventanaCompra) comprarCripa = guiCreateButton(310, 46, 68, 31, "Comprar", false, ventanaCompra) comprarRuedas = guiCreateButton(310, 87, 68, 31, "Comprar", false, ventanaCompra) comprarPerica = guiCreateButton(310, 128, 68, 31, "Comprar", false, ventanaCompra) comprarLsd = guiCreateButton(310, 169, 68, 31, "Comprar", false, ventanaCompra) comprarHeroina = guiCreateButton(310, 210, 68, 31, "Comprar", false, ventanaCompra) comprarRivotril = guiCreateButton(310, 251, 68, 31, "Comprar", false, ventanaCompra) --ventana Sell panelSell = guiCreateWindow(251, 207, 294, 319, "Venta de drogas", false) guiWindowSetSizable(panelSell, false) priceWeed = guiCreateEdit(147, 30, 53, 29, "", false, panelSell) priceRuedas = guiCreateEdit(147, 59, 53, 29, "", false, panelSell) pricePerica = guiCreateEdit(147, 88, 53, 29, "", false, panelSell) priceLsd = guiCreateEdit(147, 117, 53, 29, "", false, panelSell) priceEsteroides = guiCreateEdit(147, 146, 53, 29, "", false, panelSell) priceRivotril = guiCreateEdit(147, 175, 53, 29, "", false, panelSell) stopSell = guiCreateButton(29, 234, 100, 48, "Parar de vender", false, panelSell) GUIEditor.label[1] = guiCreateLabel(29, 40, 94, 16, "Cripa", false, panelSell) GUIEditor.label[2] = guiCreateLabel(29, 66, 94, 16, "Ruedas", false, panelSell) GUIEditor.label[3] = guiCreateLabel(29, 92, 94, 16, "Perica", false, panelSell) GUIEditor.label[4] = guiCreateLabel(29, 120, 94, 16, "LSD", false, panelSell) GUIEditor.label[5] = guiCreateLabel(29, 149, 94, 16, "Esteroides", false, panelSell) GUIEditor.label[6] = guiCreateLabel(29, 178, 94, 16, "Rivortril", false, panelSell) GUIEditor.label[7] = guiCreateLabel(145, 210, 45, 14, "Precios", false, panelSell) guardaCripa = guiCreateButton(219, 33, 65, 26, "Guardar", false, panelSell) guardaRuedas = guiCreateButton(220, 62, 64, 26, "Guardar", false, panelSell) guardaPerica = guiCreateButton(220, 91, 64, 26, "Guardar", false, panelSell) guardaLsd = guiCreateButton(220, 120, 60, 26, "Guardar", false, panelSell) guardaEsteroides = guiCreateButton(220, 149, 60, 26, "Guardar", false, panelSell) guardaRivotril = guiCreateButton(220, 178, 60, 26, "Guardar", false, panelSell) guiSetVisible ( panelSell, false) guiSetVisible ( ventanaCompra, false) addEventHandler ( "onClientGUIClick", cerrarCompra, cerrarCompraEvent, false ) addEventHandler ( "onClientGUIClick", stopSell, cerrarVentaEvent, false ) addEventHandler ( "onClientGUIClick", guardaCripa, addPrecioCripa, false ) end ) --Window Shop --Funciones para vendedor function venderDroga( localPlayer ) triggerServerEvent ( "onClick", getLocalPlayer() ) guiSetVisible ( panelSell, true) showCursor ( true ) end addCommandHandler("venderdroga", venderDroga ) function addPrecioCripa (localPlayer) local valorCripa = guiGetText ( priceWeed ) if ( tonumber(valorCripa) > 0 ) then triggerServerEvent ( "addCripaCost", getLocalPlayer(), source ) outputChatBox("has puesto un precio a la cripa de "..valorCripa.."") else outputChatBox("Coloca un valor mayor a 0") end end function cerrarVentaEvent ( localPlayer ) triggerServerEvent ( "onClick2", getLocalPlayer() ) guiSetVisible ( panelSell, false) showCursor ( false ) end --Funciones comprador function MarkerHit ( p, matchingDimension ) local priceCripa = triggerServerEvent ( "valorCripa", getLocalPlayer() ) if p == localPlayer then guiSetVisible ( ventanaCompra, true) showCursor ( true ) guiSetText(precioCripa, "..priceCripa..") end end addEventHandler ( "onClientMarkerHit", getRootElement(marker), MarkerHit ) function cerrarCompraEvent ( localPlayer ) guiSetVisible ( ventanaCompra, false) showCursor ( false ) end Server Side function drug( ) local x, y, z = getElementPosition ( source ) marker = createMarker ( x, y, z-1, "cylinder", 1.5, 255, 255, 0, 170 ) end addEvent( "onClick", true ) addEventHandler("onClick", root , drug) function destroyMarker( ) if isElement( marker) then destroyElement(marker) end end addEvent( "onClick2", true ) addEventHandler("onClick2", root , destroyMarker) function asignarValoresCripa(source, valorCripa) setAccountData( source,"valorCripa", valorCripa) end addEvent( "addCripaCost", true ) addEventHandler("addCripaCost", root , asignarValoresCripa) function darValoresCripa (p) getAccountData(p,"valorCripa") end addEvent( "valorCripa", true ) addEventHandler("valorCripa", root , darValoresCripa) Muchas gracias!
-
A lot of thanks bro!, it works! And thanks for solve my question!
-
A lots of thanks @Mrtasty Its works! but... im trying to add more distances, but it doesnt work see men if tonumber(distance) >= 100 then string = type .. " BONUS 70$! Distance: " .. distance .. " Time: " .. time givePlayerMoney (source, 70) elseif tonumber(distance) >= 150 then string = type .. " BONUS 1000$! Distance: " .. distance .. " Time: " .. time givePlayerMoney (source, 1000) end
-
@MrTasty ERRO: stunt\main_server.lua atempt to compare a number whit string And thanks for the help bro!
-
Ohh made, Sorry. Here is the problem Line 62 to 64, im tring to do this: if the distance is the same or more to 100 on a wheelie it gives to you 70 bucks! local root = getRootElement() local resourceRoot = getResourceRootElement(getThisResource()) local textTable = {} addEvent("onPlayerStuntComplete", true) function onStuntStart_server(resource) local players = getElementsByType("player") for i,v in ipairs(players) do createPlayerDisplay(v) end end function createPlayerDisplay(player) textTable[player] = {} textTable[player].display = textCreateDisplay() textTable[player].textitem = textCreateTextItem ("", .5, .85, "low", 255, 255, 255, 255, 1.5, "center") textDisplayAddText(textTable[player].display, textTable[player].textitem) setElementData(player, "stuntTextTimer", false) end function onPlayerJoin_server() createPlayerDisplay(source) end function onPlayerQuit_server(reason) -- kill the timer of the current display if it exists local oldTimer = getElementData(source, "stuntTextTimer") if (oldTimer) then killTimer(oldTimer) end -- destroy text objects and clear the player's table textDestroyTextItem(textTable[source].textitem) textDestroyDisplay(textTable[source].display) textTable[source] = nil end function onStunt(type, vehicle, time, distance, height, rotation, greatLanding) assert(vehicle and isElement(vehicle), "omgz i cant see the vehicle") assert(source and isElement(source), "omgz i cant see the player") -- get rid of the current display if it exists local oldTimer = getElementData(source, "stuntTextTimer") if (oldTimer) then killTimer(oldTimer) hidePlayerDisplay(source) end -- create the new display local string if (type == "Jump") then string = "JUMP BONUS $50! Distance: " .. distance .. " Height: " .. height .. " Rotation: " .. rotation .. "º Time: " .. time .. "s" givePlayerMoney (source, 50) if (greatLanding) then string = string .. "\nLANDING BONUS 20$! What a great landing!" givePlayerMoney (source, 20) end else if (type == "Two-Wheeler") then type = "TWO-WHEELER" elseif (type == "Wheelie") then type = "WHEELIE" elseif (type == "Stoppie") then type = "STOPPIE" else error("unexpected stunt type recieved") end string = type .. " BONUS 70$! Distance: " .. distance .. " Time: " .. time if " .. distance .. " >= 100 then givePlayerMoney (source, 70) end end textItemSetText(textTable[source].textitem, string) textDisplayAddObserver(textTable[source].display, source) local timer = setTimer(hidePlayerDisplay, 5000, 1, source) setElementData(source, "stuntTextTimer", timer) end function hidePlayerDisplay(player) textDisplayRemoveObserver(textTable[player].display, player) setElementData(player, "stuntTextTimer", false) end addEventHandler("onResourceStart", resourceRoot, onStuntStart_server) addEventHandler("onPlayerJoin", root, onPlayerJoin_server) addEventHandler("onPlayerQuit", root, onPlayerQuit_server) addEventHandler("onPlayerStuntComplete", root, onStunt)
-
Hello, i have a problem, i need help with this code, im trying to make a resource, wich when you do "stunt", it gives x money to you acording to the distance, here the code: local root = getRootElement() local resourceRoot = getResourceRootElement(getThisResource()) local textTable = {} addEvent("onPlayerStuntComplete", true) function onStuntStart_server(resource) local players = getElementsByType("player") for i,v in ipairs(players) do createPlayerDisplay(v) end end function createPlayerDisplay(player) textTable[player] = {} textTable[player].display = textCreateDisplay() textTable[player].textitem = textCreateTextItem ("", .5, .85, "low", 255, 255, 255, 255, 1.5, "center") textDisplayAddText(textTable[player].display, textTable[player].textitem) setElementData(player, "stuntTextTimer", false) end function onPlayerJoin_server() createPlayerDisplay(source) end function onPlayerQuit_server(reason) -- kill the timer of the current display if it exists local oldTimer = getElementData(source, "stuntTextTimer") if (oldTimer) then killTimer(oldTimer) end -- destroy text objects and clear the player's table textDestroyTextItem(textTable[source].textitem) textDestroyDisplay(textTable[source].display) textTable[source] = nil end function onStunt(type, vehicle, time, distance, height, rotation, greatLanding) assert(vehicle and isElement(vehicle), "omgz i cant see the vehicle") assert(source and isElement(source), "omgz i cant see the player") -- get rid of the current display if it exists local oldTimer = getElementData(source, "stuntTextTimer") if (oldTimer) then killTimer(oldTimer) hidePlayerDisplay(source) end -- create the new display local string if (type == "Jump") then string = "JUMP BONUS $50! Distance: " .. distance .. " Height: " .. height .. " Rotation: " .. rotation .. "º Time: " .. time .. "s" givePlayerMoney (source, 50) if (greatLanding) then string = string .. "\nLANDING BONUS 20$! What a great landing!" givePlayerMoney (source, 20) end else if (type == "Two-Wheeler") then type = "TWO-WHEELER" elseif (type == "Wheelie") then type = "WHEELIE" elseif (type == "Stoppie") then type = "STOPPIE" else error("unexpected stunt type recieved") end string = type .. " BONUS 70$! Distance: " .. distance .. " Time: " .. time if " .. distance .. " >= 100 then givePlayerMoney (source, 70) end end textItemSetText(textTable[source].textitem, string) textDisplayAddObserver(textTable[source].display, source) local timer = setTimer(hidePlayerDisplay, 5000, 1, source) setElementData(source, "stuntTextTimer", timer) end function hidePlayerDisplay(player) textDisplayRemoveObserver(textTable[player].display, player) setElementData(player, "stuntTextTimer", false) end addEventHandler("onResourceStart", resourceRoot, onStuntStart_server) addEventHandler("onPlayerJoin", root, onPlayerJoin_server) addEventHandler("onPlayerQuit", root, onPlayerQuit_server) addEventHandler("onPlayerStuntComplete", root, onStunt) Lot of thanks!.
-
[HELP]Define arguments in a command
CobbTheWarriorsRPG replied to CobbTheWarriorsRPG's topic in Scripting
Thanks Spajk -
Hello, Im trying to mading a script who creates bots whit the weapon who copies you in the comand this is the script function SpawnHunter ( player, wep ) wep = tonumber(wep) if wep then local x,y,z = getElementPosition ( player ) local accountname = getAccountName ( getPlayerAccount ( player ) ) if isObjectInACLGroup ( "user.".. accountname, aclGetGroup ( "Admin" ) ) then exports [ "slothbot" ]:spawnBot ( x, y, z, 90, 288, 0, 0, locos, wep, "guarding", true ) end end end addCommandHandler("spawnbot", SpawnHunter) But doesnt work. Thanks a lot.
-
[HELP]Show gui only for the gui who hits the marker
CobbTheWarriorsRPG replied to CobbTheWarriorsRPG's topic in Scripting
Thanks Manve!