yMassai Posted March 29, 2012 Posted March 29, 2012 Could anyone support me? I would like to create a weapon that can take only a few skins. Community Profile MTA:SA = Click Here
Castillo Posted March 29, 2012 Posted March 29, 2012 I'm afraid I don't understand, what do you mean by create a weapon that only a few skins can take? do you mean a pickup? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
yMassai Posted March 29, 2012 Author Posted March 29, 2012 I wanted to create a weapon in a certain place, I would like what only a skins can get the gun. Community Profile MTA:SA = Click Here
sckatchof Posted March 29, 2012 Posted March 29, 2012 You want a pickup like guns just one skin can take it ?
Castillo Posted March 29, 2012 Posted March 29, 2012 https://wiki.multitheftauto.com/wiki/Ser ... kup_events San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
yMassai Posted March 29, 2012 Author Posted March 29, 2012 (edited) function pickupUse ( thePlayer ) outputChatBox ( getPlayerName ( thePlayer ) .. " picked up a pickup!" ) end addEventHandler ( "onPickupUse", getRootElement(), pickupUse ) this? Edited March 29, 2012 by Guest Community Profile MTA:SA = Click Here
sckatchof Posted March 29, 2012 Posted March 29, 2012 função ColetaEncontrar ( thePlayer ) outputChatBox ( getPlayerName ( thePlayer ) .. "pegou uma pickup!" ) end AddEventHandler ( "onPickupUse" , getRootElement ( ) , ColetaEncontrar ) Omg what's thiiis use this createPickup Learn this please : https://wiki.multitheftauto.com/wiki/Scripting_Introduction
yMassai Posted March 29, 2012 Author Posted March 29, 2012 (edited) function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z currentweapon = getPlayerWeapon ( source ) --get the current weapon of the dead person createPickup ( x, y, z, 2, currentweapon, 10000, totalammo ) end lockSkins = { [287] = true ; [121] = true ; } -- sets the lock skins if ( not lockSkins[getElementModel ( player )] ) and ( seat == 0 ) then utputChatBox ( "*Você não pode pegar esta arma.", player , 255, 00, 00) --info in chatbox addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) --add an event handler for onPlayerWasted maybe? Edited March 29, 2012 by Guest Community Profile MTA:SA = Click Here
Castillo Posted March 29, 2012 Posted March 29, 2012 lockSkins = { [287] = true, [121] = true } -- sets the lock skins function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies if ( lockSkins[getElementModel ( source )] ) and ( seat == 0 ) then local x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z local currentweapon = getPedWeapon ( source ) --get the current weapon of the dead person createPickup ( x, y, z, 2, currentweapon, 10000, totalammo ) else outputChatBox ( "*Você não pode entrar neste veículo.", source, 255, 00, 00) --info in chatbox end end addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) --add an event handler for onPlayerWasted San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
yMassai Posted March 29, 2012 Author Posted March 29, 2012 lockSkins = { [287] = true, [121] = true } -- sets the lock skins function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies if ( lockSkins[getElementModel ( player )] ) and ( seat == 0 ) then local x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z local currentweapon = getPedWeapon ( source ) --get the current weapon of the dead person createPickup ( 1540.5999755859, -1660.9000244141, 13.60000038147, 2, 30, 10000, 1000 ) else outputChatBox ( "*Só militares podem pegar esta arma.", player, 255, 00, 00) --info in chatbox end end addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) --add an event handler for onPlayerWasted Not Work Community Profile MTA:SA = Click Here
DNL291 Posted March 29, 2012 Posted March 29, 2012 (edited) try function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies local skin = getElementModel(source) if ( skin == 287 ) or ( skin == 121 ) and ( seat == 0 ) then local x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z local currentweapon = getPedWeapon ( source ) --get the current weapon of the dead person createPickup ( x, y, z, 2, currentweapon, 10000, totalammo ) else outputChatBox ( "*Você não pode entrar neste veículo.", player, 255, 00, 00) --info in chatbox end end addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) --add an event handler for onPlayerWasted Edited March 29, 2012 by Guest Please do not PM me with scripting related question nor support, use the forums instead.
yMassai Posted March 29, 2012 Author Posted March 29, 2012 too not work Community Profile MTA:SA = Click Here
DNL291 Posted March 29, 2012 Posted March 29, 2012 check if this type server side in the meta.xml Please do not PM me with scripting related question nor support, use the forums instead.
yMassai Posted March 29, 2012 Author Posted March 29, 2012 <meta> <info author="Ninguem" name="test" version="1.0.0" type="script"/> <script src="weapon.lua" type ="server"/> </meta> Community Profile MTA:SA = Click Here
DNL291 Posted March 29, 2012 Posted March 29, 2012 worked for me. Please do not PM me with scripting related question nor support, use the forums instead.
yMassai Posted March 29, 2012 Author Posted March 29, 2012 you test online? Community Profile MTA:SA = Click Here
DNL291 Posted March 29, 2012 Posted March 29, 2012 copy the last code I updated. Please do not PM me with scripting related question nor support, use the forums instead.
drk Posted March 29, 2012 Posted March 29, 2012 Why don't use the fucking tables? Isn't more easy for him add skins?? And why you simply copy examples / other scripts DNL291? As far as I know, he want this: local skins = { [ 287 ] = true; [ 121 ] = true }; addEventHandler ( 'onPlayerWasted', root, function ( uAmmo, uKiller, uWeapon, uPart ) if ( skins [ getElementModel ( source ) ] ) then local x, y, z = getElementPosition ( source ) local cWeapon = getPedWeapon ( source ) thePickup = createPickup ( x, y, z, 2, cWeapon, 10000, uAmmo ); addEventHandler ( 'onPickupHit', thePickup, getPickup ) else return end end ) function getPickup ( player ) if ( skins [ getElementModel ( player ) ] ) then giveWeapon ( player, getPickupWeapon ( source ), getPickupAmmo ( source ) ); end end This creates a pickup when you die if you have any skin of the table. Then anyone who haves a skin of table can take the weapon. EPT Team Server Development: 0% Learning C++ | C++ is amazing
DNL291 Posted March 29, 2012 Posted March 29, 2012 (edited) lockSkins = { [287] = true, [121] = true } function onDeathPickupHit( player ) local skin = getElementModel(player) if ( lockSkins[skin] ) then getPickupWeapon( player ) else cancelEvent() outputChatBox("*Só militares podem pegar esta arma.", player, 255, 0, 0) end end function destroyDeathPickup( pickup ) removeEventHandler("onPickupHit", pickup, onDeathPickupHit ) destroyElement( pickup ) end addEventHandler("onPlayerWasted", root, function (totalammo, killer, killerweapon, bodypart) local timeout = 60000 local x, y, z = getElementPosition( source ) local currentweapon = getPedWeapon( source ) local totalammo = getPedTotalAmmo( source ) local pickup = createPickup( x, y, z, 2, currentweapon, timeout, totalammo ) addEventHandler("onPickupHit", pickup, onDeathPickupHit) setTimer( destroyDeathPickup, timeout, 1, pickup ) end) And why you simply copy examples / other scripts DNL291? is an example of wiki. https://wiki.multitheftauto.com/wiki/CreatePickup Edited March 29, 2012 by Guest Please do not PM me with scripting related question nor support, use the forums instead.
sckatchof Posted March 29, 2012 Posted March 29, 2012 try this and change x y z with your coordinate yourgun = createPickup ( x, y, z, 2, 31, 4000, 0) ---change x, y, z and change gun id function onPickupuse ( uPlayer ) local skin = getElementModel( uPlayer ) if ( skin == 287 ) or ( skin == 121 ) and ( seat == 0 ) then giveWeapon ( uPlayer, 31, 500, true ) ----give m4 change with your guns end end addEventHandler ( "onPickupUse", yourgun, onPickupuse ) Meta.xml "Ninguem" name="test" version="1.0.0" type="script"/>
drk Posted March 29, 2012 Posted March 29, 2012 (edited) DNL291, why change my code?? Mine was correct. No need to change my code. Edited March 29, 2012 by Guest EPT Team Server Development: 0% Learning C++ | C++ is amazing
DNL291 Posted March 29, 2012 Posted March 29, 2012 try this and change x y z with your coordinate yourgun = createPickup ( x, y, z, 2, 31, 4000, 0) ---change x, y, z and change gun id function onPickupuse ( uPlayer ) local skin = getElementModel( uPlayer ) if ( skin == 287 ) or ( skin == 121 ) and ( seat == 0 ) then giveWeapon ( uPlayer, 31, 500, true ) ----give m4 change with your guns end end addEventHandler ( "onPickupUse", yourgun, onPickupuse ) Meta.xml "Ninguem" name="test" version="1.0.0" type="script"/> is not what he wants. Please do not PM me with scripting related question nor support, use the forums instead.
drk Posted March 29, 2012 Posted March 29, 2012 Also, your code is wrong DNL291. You're trying to destroy player oO Good work EPT Team Server Development: 0% Learning C++ | C++ is amazing
DNL291 Posted March 29, 2012 Posted March 29, 2012 DNL291, why change my code?? Mine was correct. No need to change my code. not take anything from your code. Please do not PM me with scripting related question nor support, use the forums instead.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now