^Dev-PoinT^ Posted December 2, 2011 Share Posted December 2, 2011 Hi all i have Make Gamemode but it dont know how to Make Spawn Protect can any one show me how to Make it Thx Link to comment
TAPL Posted December 2, 2011 Share Posted December 2, 2011 what do you mean 'Spawn Protect' ? Link to comment
^Dev-PoinT^ Posted December 2, 2011 Author Share Posted December 2, 2011 if the Players Spawn give them anti-Damge For 5 Secned and then outputChatBox(getPlayerName).. is No Not Protected! did you get it? Link to comment
unknooooown Posted December 2, 2011 Share Posted December 2, 2011 (edited) if the Players Spawn give them anti-Damge For 5 Secned and thenoutputChatBox(getPlayerName).. is No Not Protected! did you get it? Dev_Point. If you want to cancel damage on a player you need to cancel it clientside. You could do something like: Server: function setPlayerAlphaProtectedVisible(enabled) if enabled == true then setElementAlpha ( source, 150 ) elseif enabled == false then setElementAlpha ( source, 255 ) end end function setPlayerProtected() triggerClientEvent(source,"enableClientPlayerProtection",source,true) setPlayerAlphaProtectedVisible(true) setTimer(setPlayerAlphaProtectedVisible,5000,1,false) end addEventHandler("onPlayerSpawn",root,setPlayerProtected) Client: function cancelDamageOnHurt cancelEvent() end function enableClientPlayerProtection(enabled) if enabled == true then addEventHandler("onClientPlayerDamage",localPlayer,cancelDamageOnHurt) setTimer(enableClientPlayerProtection,5000,1,false) elseif enabled == false then removeEventHandler("onClientPlayerDamage",localPlayer,cancelDamageOnHurt) outputChatBox(getPlayerName(localPlayer) .. " is no longer spawnprotected ",0,153,0,true ) end end addEvent("enableClientPlayerProtection",true) addEventHandler("enableClientPlayerProtection",localPlayer,enableClientPlayerProtection) NOTE: HAVENT TESTED IT! I expect that this would work, and it would protect the player for 5 secs every time he spawns. You could add some checks to disable this for some players. Feel free to use this and develop it further if you can use it. Edited December 2, 2011 by Guest Link to comment
^Dev-PoinT^ Posted December 2, 2011 Author Share Posted December 2, 2011 there is problem with this function cancelDamageOnHurt cancelEvent() end dosnt have to be closed? Link to comment
TAPL Posted December 2, 2011 Share Posted December 2, 2011 Client Side local Protect = false function OnSpawn() Protect = true setTimer(function() Protect = false triggerServerEvent("ShowMsg",localPlayer) end, 5000, 1) end addEventHandler("onClientPlayerSpawn",localPlayer,OnSpawn) function ProtectDamage() if (Protect) then cancelEvent() end end addEventHandler ("onClientPlayerDamage",localPlayer,ProtectDamage) Server Side function msg() outputChatBox(getPlayerName(source).." is No Not Protected!",root,255,255,0,true) end addEvent("ShowMsg",true) addEventHandler ("ShowMsg",root,msg) Link to comment
^Dev-PoinT^ Posted December 2, 2011 Author Share Posted December 2, 2011 and how can i add msg Tapl is Now SpawnProtected = true flase = Tapl is not Protected ? Link to comment
TAPL Posted December 2, 2011 Share Posted December 2, 2011 what? edit the script as you need we're not in your head to know what you want Link to comment
^Dev-PoinT^ Posted December 2, 2011 Author Share Posted December 2, 2011 i mean if tapl spawn say Tapl is Now Protected and if he not Protected say Tapl in not Protected just like this Link to comment
unknooooown Posted December 2, 2011 Share Posted December 2, 2011 there is problem with this function cancelDamageOnHurt cancelEvent() end dosnt have to be closed? What are you talking about? Did you even try it? Link to comment
^Dev-PoinT^ Posted December 2, 2011 Author Share Posted December 2, 2011 yes dosnt work but how can i add msg if he Portected say PlayerName.. is Now Spawn Protect! Link to comment
unknooooown Posted December 2, 2011 Share Posted December 2, 2011 yes dosnt workbut how can i add msg if he Portected say PlayerName.. is Now Spawn Protect! Where do you think that you should add it? I'm not gonna tell you exactly where it should be, because its so obvious. Tell me where you think it should be, and I will tell you if its correct. Link to comment
^Dev-PoinT^ Posted December 2, 2011 Author Share Posted December 2, 2011 i fix it with this function msg() outputChatBox(getPlayerName(source).." is Not Protected!",root,255,0,0,true) end addEvent("ShowMsg",true) addEventHandler ("ShowMsg",root,msg) function spawn () outputChatBox(getPlayerName(source).." is Spawn Protected !",root,0,255,0,true) end addEventHandler ( "onPlayerSpawn", getRootElement(), spawn ) its Nice to fix by myself Link to comment
unknooooown Posted December 2, 2011 Share Posted December 2, 2011 I just tested the first script I gave you. There was a few errors in it, but it works. Server: function setPlayerAlphaProtectedVisible(enabled,source) if enabled == true then setElementAlpha ( source, 150 ) elseif enabled == false then setElementAlpha ( source, 255 ) end end function setPlayerProtected() triggerClientEvent(source,"enableClientPlayerProtection",source,true) setPlayerAlphaProtectedVisible(true,source) setTimer(setPlayerAlphaProtectedVisible,5000,1,false,source) end addEventHandler("onPlayerSpawn",root,setPlayerProtected) Client: function cancelDamageOnHurt() cancelEvent() end function enableClientPlayerProtection(enabled) if enabled == true then addEventHandler("onClientPlayerDamage",localPlayer,cancelDamageOnHurt) setTimer(enableClientPlayerProtection,5000,1,false) outputChatBox(getPlayerName(localPlayer) .. " is now spawnprotected ",0,153,0,true ) elseif enabled == false then removeEventHandler("onClientPlayerDamage",localPlayer,cancelDamageOnHurt) outputChatBox(getPlayerName(localPlayer) .. " is no longer spawnprotected ",0,153,0,true ) end end addEvent("enableClientPlayerProtection",true) addEventHandler("enableClientPlayerProtection",localPlayer,enableClientPlayerProtection) This example WILL work. Try and read it and understand it Dev_Point. EDIT: I'm very happy to hear you fixed it on your own! That's what I like to see from you Dev_Point You are getting better and better, so keep it up buddy. Link to comment
^Dev-PoinT^ Posted December 2, 2011 Author Share Posted December 2, 2011 thx Man Topic Closde 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