Jump to content

drk

Members
  • Posts

    1,607
  • Joined

  • Last visited

Everything posted by drk

  1. Thanks very much. It worked! The wors part of the script is done
  2. I tried this too: request = executeSQLQuery ('CREATE TABLE IF NOT EXISTS Top ( map TEXT, player TEXT, time NUMBER )') addEventHandler( 'onGamemodeMapStart',root, function( mapname ) mapName = getResourceName( mapname ) local result = executeSQLQuery ( "SELECT player, time FROM Top WHERE map = ?", mapName ) if not result or #result == 0 then -- not use result == false just use operator not you check ( if value nil or false ) executeSQLQuery( "INSERT INTO Top (map,player,time) VALUES('"..mapName.."','No one','')" ) local result = executeSQLQuery ( "SELECT * FROM Top WHERE map = '"..mapName.."'" ) outputChatBox( 'Top: ' ..result[1].player.. ' | Time: ' ..result[1].time,root,255,255,255,false) outputChatBox('No top!',root,255,255,255,false) end end ) Don't output nothing
  3. Try now, code updated. Copy my last code.
  4. Try changing playSound('path',false) to triggerEvent('playSound',theKiller,'songs/2.ogg')
  5. First, you add the sound to meta? You have the sound in the resource folder ( sounds/3.ogg / 2.ogg )?? You get any error? I don't know if you can show a image only for the local player..
  6. if (attacker and attacker ~= source) then You can, but you have to change the function argument theKiller to your.
  7. No, see function arguments first.
  8. local sx, sy = guiGetScreenSize() image = guiCreateStaticImage(sx/5,sy/5.8,399,169,'SAMP'..math.random(1,4)..'.png',false) owned = guiCreateStaticImage(0.45,0.6722,0.917,0.0533,'images/owned.png',true) addEventHandler('onClientPlayerWasted', root, function(theKiller,theWeapon,bodyPart) if theKiller and theKiller ~= source then if bodyPart == 9 then outputChatBox('**Owned -> HeadShot!! + $50**',theKiller,255,255,0) playSound('sounds/2.ogg',false) guiSetVisible(owned,true) givePlayerMoney(theKiller,50) setTimer(guiSetVisible,4000,1,owned,false) end else guiSetVisible(image,true) setTimer(guiSetVisible,4000,1,image,false) outputChatBox('** Opps, you dead! Try again - $5 **', source, 255, 255, 0) takePlayerMoney(source,5) playSound('sounds/3.ogg',false) end end end)
  9. local x,y = guiGetScreenSize() function headshot ( killer, weapon, bodypart ) if ( killer ) and ( killer ~= source ) then local image = guiCreateStaticImage ( x/5, y/5.8, 399,169, "SAMP"..math.random(1,4)..".png", false ) guiSetVisible ( image, false ) guiSetVisible ( image, true ) guiStaticImageLoadImage(image, "SAMP"..math.random(1,4)..".png") setTimer (guiSetVisible, 4000, 1, image, false ) end addEventHandler ( "onClientPlayerWasted", root, headshot ) function yasser (killer, weapon, bodypart ) if ( killer ) and ( killer ~= source ) then if (bodypart == 9) then outputChatBox("**OWned->HeadShot !!!+$50**",killer,255,255,0) owned = guiCreateStaticImage(0.45,0.6722,0.0917,0.0533,"images/owned.png",true) givePlayerMoney ( killer, 50 ) guiSetVisible(owned, false) guiSetVisible(owned, true) setTimer (guiSetVisible, 4000, 1, owned, false ) end end end end addEventHandler ( "onClientPlayerWasted", root, yasser ) function trigger ( killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then if (bodypart == 9) then triggerClientEvent(killer,"playWastedSound",killer,"sounds/2.ogg") end end end addEventHandler ( "onPlayerWasted", root, trigger) function wastedme () outputChatBox("**Woops Your Dead Try Next Time - $5**",source,255,255,0) takePlayerMoney( source, 5 ) triggerClientEvent(source,"playWastedSound",source,"sounds/3.ogg") end addEventHandler ( "onPlayerWasted", root, wastedme)
  10. Race meta.xml or go to Admin Panel -> Resources tab -> Search for 'race' -> Select it -> Click on Configs -> Double click on Random maps -> Set to true -> Click Ok -> Done
  11. I'm trying with SQL but it don't work anyway. It creates the table now, but don't do anything more and don't output nothing ( I put to output in the chat box the top and time but it don't output nothing ) table = executeSQLCreateTable( "Top", "map TEXT, player TEXT, time NUM" ) addEventHandler('onGamemodeMapStart',root, function(mapname) mapName = getResourceName(mapname) result = executeSQLSelect ( "Top", "map", "map = '" ..mapName.. "'" ) if result == false then local query = executeSQLInsert( "Top", "'"..mapName.."', 'No one', ''" ) local result = executeSQLSelect( "Top", "player, time", "map = '"..mapName.."'" ) outputChatBox('Top: ' .. result[1][1] .. ' | Time: ' .. result[1][2],thePlayer) -- tried with source too but don't work end end)
  12. Stop votemanager resource and set to Random maps in Race gamemode configs.
  13. Line?? It may be fine if you tell us.
  14. Is onClientPlayerWasted event in the same lua file of onPlayerWasted? lol
  15. I don't know why I will use these functions .. Edit: executeSQL.. work with dbConnect or use internal.db?
  16. It isn't creating tables Im doing something wrong? connect = mysql_connect('%%%%%%', '%%%%%%', '%%%%%%', 'mtasa') aNewTable = mysql_query( connect, "CREATE TABLE IF NOT EXISTS `Top` ( map STRING, player STRING, time NUMBER ) " ) addEventHandler('onGamemodeMapStart',root, function(mapname) mapName = getResourceName(mapname) if (aNewTable) then local query = mysql_query( connect, "INSERT INTO `Top` SET map='"..mapName..", player='No Top', time='' " ) end end) function addTop(thePlayer) --settings local player = mysql_escape_string(connect,getPlayerName(thePlayer)) local time = exports.race:getTimePassed() --update top local query = mysql_query(connect, "UPDATE `Top` SET player='"..player.."', time='" .. time .. "' WHERE map='"..mapName.."'") local result = mysql_query(connect, "SELECT player, time FROM `Top` WHERE map='"..mapName.."'") outputChatBox('Top: ' .. result[1].player .. ' | Time: ' .. result[2].time,thePlayer) end I tried without `` but don't work too
  17. Thanks Kenix and Solidsnake14.
  18. Ah, thank's dude But I need ' ' before and after myTable?
  19. What I don't know is what I put in column = 'Teste' and column = 'Example' I don't know what is each one.
  20. Hey, to update a row in MySQL using mysql_query is like this executeSQLQuery("UPDATE tableName SET column1 = ?,column2 = ?,column3 = ?,column4 = ? WHERE column1 = 'text1'", "text1", 1, "text2", 2) ? local query = mysql_query( connect, "UPDATE table SET column = ? WHERE column = 'Example'" )
×
×
  • Create New...