B!ERPuNK Posted October 5, 2010 Posted October 5, 2010 Hello guys, i have a question. I have two resources, for convenience, let's call them A and B. In resource A, i want to create two (and eventually more) teams. This is the script i've added in the server script of resource A: function createTeams () local teamCops = createTeam ("cops", 0, 0, 255) local teamMedics = createTeam ("medics", 0, 255, 255) end Now, in resource B, i want to add a player to team cops when he does /cop in the chatbox and to team medics if he does /medic. I have added the following script to the server script of resource B: function becomeCop (source) setPlayerTeam (source, cops) outputChatBox ("You are now a cop!", source) end The problem is, when i do /cop, it doesn't add my player to the team. However, the text does show up in the chatbox. So can anyone tell me what i have done wrong ? Thanks .
Castillo Posted October 5, 2010 Posted October 5, 2010 function becomeCop (source) setPlayerTeam (source, getTeamFromName("cops")) outputChatBox ("You are now a cop!", source) end
B!ERPuNK Posted October 5, 2010 Author Posted October 5, 2010 function becomeCop (source) setPlayerTeam (source, getTeamFromName("cops")) outputChatBox ("You are now a cop!", source) end Thanks a lot, it work's now . I thought the name of the team was also the team object, but i was wrong . But thanks again, now people can finally get a job with my resource, or at least, become a medic or cop .
Castillo Posted October 5, 2010 Posted October 5, 2010 function becomeCop (source) setPlayerTeam (source, getTeamFromName("cops")) outputChatBox ("You are now a cop!", source) end Thanks a lot, it work's now . I thought the name of the team was also the team object, but i was wrong . But thanks again, now people can finally get a job with my resource, or at least, become a medic or cop . You welcome
B!ERPuNK Posted October 5, 2010 Author Posted October 5, 2010 Oh, i have 1 more question: What function can you use to change a players skin? I know setPedSkin but i read it was deprecated. And using spawnPlayer is also kinda annoying, because then i have to add the coordinates and that kind of things, and i have used the event onPlayerSpawn a couple of times in my scripts that wouldnt work appropriately anymore if i use it.
Castillo Posted October 5, 2010 Posted October 5, 2010 Oh, i have 1 more question:What function can you use to change a players skin? I know setPedSkin but i read it was deprecated. And using spawnPlayer is also kinda annoying, because then i have to add the coordinates and that kind of things, and i have used the event onPlayerSpawn a couple of times in my scripts that wouldnt work appropriately anymore if i use it. setElementModel(playerElement,skinID)?
B!ERPuNK Posted October 5, 2010 Author Posted October 5, 2010 Whaha thanks, i should've remembered that one but i forgot . Thanks again ^^
CrazyDude Posted October 5, 2010 Posted October 5, 2010 Hello guys, i have a question.I have two resources, for convenience, let's call them A and B. In resource A, i want to create two (and eventually more) teams. This is the script i've added in the server script of resource A: function createTeams () local teamCops = createTeam ("cops", 0, 0, 255) local teamMedics = createTeam ("medics", 0, 255, 255) end Now, in resource B, i want to add a player to team cops when he does /cop in the chatbox and to team medics if he does /medic. I have added the following script to the server script of resource B: function becomeCop (source) setPlayerTeam (source, cops) outputChatBox ("You are now a cop!", source) end The problem is, when i do /cop, it doesn't add my player to the team. However, the text does show up in the chatbox. So can anyone tell me what i have done wrong ? Thanks . Btw, you made your team vars local, so you can't access them from other function. Also, you have var "teamCop", why you using var called "cops" in there: setPlayerTeam (source, cops) ?
dzek (varez) Posted October 5, 2010 Posted October 5, 2010 @CrazyDude: read carefully if you are trying to help. you can mislead others. I have two resources, for convenience, let's call them A and B. (...) In resource A (...) [1st script here] (...) Now, in resource B (...) [2nd script here] You are suggesting that variables (even global) from one resource can be read in other resources.
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