-
Posts
21,935 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Castillo
-
Server side functions: getResources -- To get resources list. getResourceInfo -- To get the resource type. triggerClientEvent -- To trigger the maps table to the client side. Client side functions: addEvent addEventHandler guiGridListAddRow guiGridListSetItemText
-
dxDrawText requires the 'onClientRender' event in order to work.
-
That's because of how you made the table, also, 'source' of 'onVehicleEnter' is the vehicle element, not the player who entered. armySkins = { [ 287 ] = true, [ 217 ] = true } armycars = { [ 432 ] = true, [ 520 ] = true, [ 425 ] = true, [ 548 ] = true } function enterVehicle ( thePlayer, seat, jacked ) if ( armycars [ getElementModel ( source ) ] ) and ( not armySkins [ getElementModel ( thePlayer ) ] ) and ( seat == 0 ) then cancelEvent ( ) outputChatBox ( "Only army members can drive this car!", thePlayer ) end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) -- this is the event.
-
function start () executeSQLCreateTable("RaceStats", "serial STRING, nick STRING, RaceCash INT, RaceWins INT, RaceDM INT, RacePoints INT, RaceFirst INT, RaceSecond INT, RaceThird INT, RaceCompletes INT, RaceHunters INT") end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), start) function onPlayerJoinLoadStats() local serial = getPlayerSerial(source) local result = executeSQLSelect ( "RaceStats", "*", "serial = '" .. tostring(serial) .. "'" ) if type( result ) == "table" and #result > 0 then setElementData(source, "Wins", tonumber(result[1]["RaceWins"]) or 0) setElementData(source, "DM", tonumber(result[1]["RaceDM"]) or 0) setElementData(source, "Points", tonumber(result[1]["RacePoints"]) or 0) setElementData(source, "First", tonumber(result[1]["RaceFirst"]) or 0) setElementData(source, "Second", tonumber(result[1]["RaceSecond"]) or 0) setElementData(source, "Third", tonumber(result[1]["RaceThird"]) or 0) setElementData(source, "Completes", tonumber(result[1]["RaceCompletes"]) or 0) setElementData(source, "Hunters", tonumber(result[1]["RaceHunters"]) or 0) givePlayerMoney(source, tonumber(result[1]["RaceCash"])) else executeSQLInsert( "RaceStats", "'" .. tostring( serial ) .. "', '" .. getPlayerName( source ) .. "', '0', '0', '0', '0', '0', '0', '0', '0', '0'" ) end end addEventHandler("onPlayerJoin", getRootElement(), onPlayerJoinLoadStats) function onPlayerQuitSaveCash ( ) local serial = getPlayerSerial ( source ) executeSQLUpdate ( "RaceStats", "RaceCash = '".. getPlayerMoney ( source ) .."'", "nick = '".. getPlayerName ( source ) .."'", "RaceWins = '".. tonumber ( getElementData ( source, "Wins" ) ) or 0 .."'", "RaceDM = '".. tonumber ( getElementData ( source, "DM" ) ) or 0 .."'", "RacePoints = '".. tonumber ( getElementData ( source, "Points" ) ) or 0 .."'", "RaceFirst = '".. tonumber ( getElementData ( source,"First" ) ) or 0 .."'", "RaceSecond = '".. tonumber ( getElementData ( source, "Second" ) ) or 0 .."'", "RaceThird = '".. tonumber ( getElementData ( source, "Third" ) ) or 0 .."'", "RaceCompletes = '".. tonumber ( getElementData ( source, "Completes" ) ) or 0 .."'", "RaceHunters = '".. tonumber ( getElementData ( source, "Hunters" ) ) or 0 .."'", "serial = '".. tostring ( serial ) .."'" ) end addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuitSaveCash) addEventHandler("onPlayerLogout", getRootElement(), onPlayerQuitSaveCash) Try that.
-
function testFunction ( argument ) outputChatBox ( "Argument value is '".. ( argument and "true" or "false" ) .."'" ) end testFunction ( true ) testFunction ( false ) Is that what you meant?
-
Have you checked if the file is on the resource folder/peds?
-
Hunter = createVehicle ( 425, 362.26513671875, 1997.4976806641, 21.543445587158, 0, 0, 91.75 ) function lockArmy ( player, seat, jacked ) if ( source == Hunter ) then local team = getPlayerTeam ( player ) local teamName = ( team and getTeamName ( team ) or "" ) if ( teamName == "Army" ) then cancelEvent ( ) outputChatBox ( "Only Army is allowed to use this vehicle!", player, 255, 0, 0, true ) end end end addEventHandler ( "onVehicleStartEnter", getRootElement(), lockArmy ) That's what you meant?
-
Postea el codigo.
-
Awesome! keep up the good work people! Merry christmas to all the MTA team!
-
Can you post the script?
-
-- Create Peds.xml and insert tags -- function createFileHandler ( ) xmlCreateFile ( "peds/peds.xml", "peds" ) end addCommandHandler ( "addpedfile", createFileHandler ) function pedfunc ( player, cmd, id ) if isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "lvl 5" ) ) then if ( id == "" ) then outputChatBox ( "Ped-System: Error, the command is /addped ", player, 255, 0, 0 ) return end local x, y, z = getElementPosition ( player ) local rot = getPedRotation ( player ) local int = getElementInterior ( player ) local dim = getElementDimension ( player ) local file = xmlLoadFile ( "peds/peds.xml" ) if ( file ) then local newChild = xmlFindChild ( file, "peds", 0 ) xmlNodeSetAttribute ( newChild, "id", id ) xmlNodeSetAttribute ( newChild, "x", x ) xmlNodeSetAttribute ( newChild, "x", x ) xmlNodeSetAttribute ( newChild, "y", y ) xmlNodeSetAttribute ( newChild, "z", z ) xmlNodeSetAttribute ( newChild, "rotation", rot ) xmlNodeSetAttribute ( newChild, "int", int ) xmlNodeSetAttribute ( newChild, "dim", dim ) created = createPed ( id, x+1, y, z, rot, int, dim ) setElementInterior ( created, int ) setElementDimension ( created, dim ) setPedRotation ( created, rot ) setElementFrozen ( created, true ) outputChatBox ( "Ped-System: You have successfully made a ped with an ID of #ff0000".. id .."#00ff00!", player, 0, 255, 0, true ) else outputChatBox ( "Ped-System: Failed to load XML file!", player, 255, 0, 0 ) end else outputChatBox ( "Ped-System: This command is only for admins!", player, 255, 0, 0 ) end end addCommandHandler ( "addped", pedfunc )
-
Yes, it'll remain being 'source'. Do you mean it only set's one of the element data's?
-
They are, mind posting the script?
-
xmlLoadFile xmlCreateChild xmlNodeSetAttribute These are the functions you require to do it.
-
You must upload them to: mods\deathmatch\resources\
-
You must execute a MySQL query.
-
Vas a tener que hacer un trigger desde el cliente al iniciar el recurso ( onClientResourceStart ), luego en el server side verificas la cuenta y envias tu evento.
-
Eso es porque el cliente aun no cargo el script.
-
Works perfect here, no error or anything.
-
It is necessary, because it'll be triggered even by remote players, so you need to check if hitPlayer is equal to the local player.
-
Just do: addEventHandler ( "onMarkerHit", root, theFunction ) Instead of: addEventHandler ( "onMarkerHit", theMarker, theFunction )
-
Exactly.
-
You can cancel the damage of specified ped elements ( by checking before cancel ). If you cancel globally, it'll not affect the players.
-
Well, I didn't even mention that because it would be inefficient.
-
As far as I know, there isn't. But, what's wrong with cancelling the damage? it works perfectly fine.