drk Posted September 24, 2011 Share Posted September 24, 2011 Hi ! Ive created a resource when a weapon fire the resource set the position of the player to the Hospital and fade the Camera. Then weapons are taked and gets 1000$ from the player. So, the code is: Server Side Code: function headless ( source ) if isPedHeadless ( source ) == true then outputChatBox ( "#ff8c00 -Cryptic KaMiKaSe- | #ff0000Você não pode atirar que nem um louco sem a cabeça !!!", source, 255, 255, 255, true ) fadeCamera ( source, false, 1.0, 0, 0, 0 ) setElementPosition ( source, -2866, 467, 4 ) takeAllWeapons ( source ) outputChatBox ( " ", source, 255, 255, 255, true ) outputChatBox ( " ", source, 255, 255, 255, true ) outputChatBox ( " ", source, 255, 255, 255, true ) outputChatBox ( "#ff8c00 - Cryptic KaMiKaSe- | #00ff00Você foi para o Hospital e foi curado ! Os médicos pegaram #ffff00R$1000 de você !", source, 255, 255, 255, true ) takePlayerMoney ( source, 1000 ) end end addEventHandler ( "onPlayerWeaponFire", getRootElement(), headless ) In debugscript and Console not appear erros in the script. Ive used the setPedHeadless in other resource when i type /semcabeca in the Chat the player is headless. ( Sorry for my bad english ). Help me pls ;S Link to comment
Static-X Posted September 24, 2011 Share Posted September 24, 2011 onPlayerWeaponFire, there is no such event. You can use onClientPlayerWeaponFire and make the script client sided or use triggering Link to comment
drk Posted September 24, 2011 Author Share Posted September 24, 2011 I'll test now. EDIT: Dont work ;S The meta.xml file: <meta> <script src="server/headless_s.lua" type="server" /> <script src="client/headless_c.lua" type="client" /> </meta> The Client Side code: function weapon () if isPedHeadless ( source ) == true then triggerServerEvent ( "onPlayerWeaponFire", source ) end addEventHandler ( "onClientPlayerWeaponFire", getRootElement(), weapon ) The Server Side code: function headless ( source ) outputChatBox ( "#ff8c00 -Cryptic KaMiKaSe- | #ff0000Você não pode atirar que nem um louco sem a cabeça !!!", source, 255, 255, 255, true ) fadeCamera ( source, false, 1.0, 0, 0, 0 ) setElementPosition ( source, -2866, 467, 4 ) takeAllWeapons ( source ) outputChatBox ( " ", source, 255, 255, 255, true ) outputChatBox ( " ", source, 255, 255, 255, true ) outputChatBox ( " ", source, 255, 255, 255, true ) outputChatBox ( "#ff8c00 - Cryptic KaMiKaSe- | #00ff00Você foi para o Hospital e foi curado ! Os médicos pegaram #ffff00R$1000 de você !", source, 255, 255, 255, true ) takePlayerMoney ( source, 1000 ) end addEvent ( "onPlayerWeaponFire", true ) addEventHandler ( "onPlayerWeaponFire", getRootElement(), headless ) Link to comment
BinSlayer1 Posted September 24, 2011 Share Posted September 24, 2011 function weapon () if source == getLocalPlayer() then if isPedHeadless ( source ) == true then triggerServerEvent ( "onPlayerWeaponFire", source ) end end end addEventHandler ( "onClientPlayerWeaponFire", getRootElement(), weapon ) function headless () outputChatBox ( "#ff8c00 -Cryptic KaMiKaSe- | #ff0000Você não pode atirar que nem um louco sem a cabeça !!!", source, 255, 255, 255, true ) fadeCamera ( source, false, 1.0, 0, 0, 0 ) setElementPosition ( source, -2866, 467, 4 ) takeAllWeapons ( source ) outputChatBox ( " ", source, 255, 255, 255, true ) outputChatBox ( " ", source, 255, 255, 255, true ) outputChatBox ( " ", source, 255, 255, 255, true ) outputChatBox ( "#ff8c00 - Cryptic KaMiKaSe- | #00ff00Você foi para o Hospital e foi curado ! Os médicos pegaram #ffff00R$1000 de você !", source, 255, 255, 255, true ) takePlayerMoney ( source, 1000 ) end addEvent ( "onPlayerWeaponFire", true ) addEventHandler ( "onPlayerWeaponFire", getRootElement(), headless ) edit: i edited the code minutes after posting so make sure u refresh the page Link to comment
TAPL Posted September 24, 2011 Share Posted September 24, 2011 isn't this better? function weapon () if isPedHeadless (localPlayer) == true then triggerServerEvent ("onPlayerWeaponFire", localPlayer) end end addEventHandler ( "onClientPlayerWeaponFire", localPlayer, weapon ) Link to comment
drk Posted September 25, 2011 Author Share Posted September 25, 2011 Thanks TAPL and BinSlayer1. It worked ! Link to comment
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