Monsthers Posted September 29, 2015 Share Posted September 29, 2015 Hola saludos a todos, bueno vamos al grano, se que hay un script que al matar a un jugador te dan dinero ese script esta en la comunidad se llama ''killmoney'' Pero como ago que cuando un jugador de un team (POLICE) mate a un jugador de otro team (CRIMINAL) Gane cierta cantida de dinero? Aki el codigo del script function rewardOnWasted ( ammo, killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then givePlayerMoney ( killer, 1000 ) end end addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) Link to comment
aka Blue Posted September 29, 2015 Share Posted September 29, 2015 Usas una condicional if isPlayerInTeam es la función si no me equivoco. Link to comment
Tomas Posted September 29, 2015 Share Posted September 29, 2015 Usas una condicional ifisPlayerInTeam es la función si no me equivoco. Es una useful-function, debe copiar el source desde la wiki. Link to comment
Enargy, Posted September 29, 2015 Share Posted September 29, 2015 function rewardOnWasted ( ammo, killer, killerweapon, bodypart ) if ( killer ) and ( killer ~= source ) then if isPlayerInTeam( killer, "POLICE" ) and isPlayerInTeam( source, "CRIMINAL" ) then givePlayerMoney ( killer, 1000 ) end end end addEventHandler ( "onPlayerWasted", getRootElement(), rewardOnWasted ) function isPlayerInTeam(player, team) assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]") assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]") return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true))) end Link to comment
Recommended Posts