NickRosso Posted May 28, 2012 Share Posted May 28, 2012 Hi. I need something like that: When you're logined, the system put's every player into a Team and every team has a randomly selected player target. Or it can be made without teams? Is this possible? I Don't know how to start. I just know Pawno but lua. I've watched a lot of tutorial but can't make my own. I would be very thankful if anybody helps. Nick Link to comment
elf23 Posted May 29, 2012 Share Posted May 29, 2012 setPedTarget doesn't work with local player. You can make it only for other players. Link to comment
Castillo Posted May 29, 2012 Share Posted May 29, 2012 By targets you mean aiming to a player or just that you gotta kill that player? Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 In my head i was dreaming about that: You have a target to KILL, and you are a target too. So someone has to kill you too. Link to comment
Castillo Posted May 29, 2012 Share Posted May 29, 2012 You can use the function: getRandomPlayer. Link to comment
NickRosso Posted May 29, 2012 Author Share Posted May 29, 2012 I'll try it tomorrow, thank you so much you helped me a lot. I'll post it in here if you don't mind (if it won't work) Link to comment
Castillo Posted May 29, 2012 Share Posted May 29, 2012 You're welcome. I'm moving this to "Scripting" section. Link to comment
NickRosso Posted May 30, 2012 Author Share Posted May 30, 2012 (edited) There we are. I started it. I want that if the resource starts everyone got a target. You have one target, and this can't be yourself. Then if everyone has a target, and a new player joins he got a target. It doesn't matter that he has the same target that somebody else, but want to limit this number. So 3 men could have the same target. And when somebody kills his target he gots the recently joined new player as a target. I'm stepping into a big task, but i belive that i can make it with help. I like to start things in the middle. So i started learning lua from here. I have this so far: Meta.xml "--" version="1.0" type="script" description="Target system"/> target.lua addEventHandler ( "onResourceStart", resourceRoot, function () for index, player in pairs(getElementsByType("player")) do while true do local randomTarget = getRandomPlayer ( ) if randomTarget ~= player then outputChatBox ("Your target is: " ..getPlayerName ( randomTarget ), player ) break end end end end ) ) Stuck at the beggining. Any tips? EDIT: So far made by Alpha Edited May 30, 2012 by Guest Link to comment
Alpha Posted May 30, 2012 Share Posted May 30, 2012 Your script is server side, onClientResourceStart is a client side event. Server side: addEventHandler ( "onResourceStart", resourceRoot, function () for index, player in pairs(getElementsByType("player")) do while true do local randomTarget = getRandomPlayer ( ) if randomTarget ~= player then outputChatBox ("Your target is: " ..getPlayerName ( randomTarget ), player ) break end end end end ) Link to comment
NickRosso Posted May 30, 2012 Author Share Posted May 30, 2012 I'll never learn this. No way. Browsing the wiki but can't figure it out. No problem i won't give up. Thanks. Link to comment
Alpha Posted May 30, 2012 Share Posted May 30, 2012 Before heading to the wiki, I suggest looking at lua tutorials. Here: viewtopic.php?f=148&t=40809 Link to comment
NickRosso Posted May 30, 2012 Author Share Posted May 30, 2012 Thanks i missed this link. Will check it out now. 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