need help with OnPlayerSpawn and GivePlayerWeapon -
Shrooman - 01.08.2009
hello, i have a problem :] i'm always using search function, but i didn't find any topic that would give me clear answer for my problem, i can often just find a way to do something even without any clear answers... but well not this time :]
so, there are three player classes: assault, support, specialist, i want them all to have diffrent weapons, i know how to use "random" function, but weapon can't be randomized on createplayerclass, because in this case same weapon will be given for this class until server gets restarted, so i have to use giveplayerweapon under onplayerspawn. and i don't know how to do this, like i said i know about random function, but i don't know how to make game remember what playerclass was chosen by certain player
let's for example say that there are two classes: assault and support, i will not give whole createplayerclass lines because they would be just full of zeros (spawn locations are randomized too)
Assault:
weapon 1: random from 29, 30
weapon 2: random from 16, 23
Support:
weapon 1: random from 25, 27
weapon 2: random from 18, 23
How to make all that under OnPlayerSpawn? classid can be used only in OnPlayerRequestClass
Re: need help with OnPlayerSpawn and GivePlayerWeapon -
Burridge - 01.08.2009
So it's a TDM yes?
Re: need help with OnPlayerSpawn and GivePlayerWeapon -
Shrooman - 01.08.2009
it's a free for all game me and my friends play in the evenings, we don't like to waste time for using commands to make something, get weapons, we just want to choose class and play, i created five classes but it was hard to balance them, so i lately decided to reduce amount of classes and give them random weapons, not completely random, one class always have assault weapon, other class got uzi or sawnoff and so on
edit:
i'm just becoming confused when there is more than one set of if/else or switch/cases under (or related to) one callback
Re: need help with OnPlayerSpawn and GivePlayerWeapon -
cyber_punk - 01.08.2009
Your confusing Teams with classes it seems to me. Its much easier to assign a Team to a Class then you can keep track of what Team they are on and do things accordingly.
For instance say you have 18 skins, now each skin in the class selection is a class, so you have a function to set there team from what skin they pick. (store the team in a variable like gTeam[MAX_PLAYERS] or something) Now when they spawn just check if(gTeam[playerid] = whatever) then give them whatever weapon.
Re: need help with OnPlayerSpawn and GivePlayerWeapon -
Shrooman - 01.08.2009
so even if i'l assign teams for certain classes just to make it easier to give random weapon it will be still completely possible to play pure deathmatch or free for all?
can AddPlayerClassEx (this function can automaticly assign team to certain class) be used to make that what you describe? (instead of variable like gTeam[MAX_PLAYERS] )
Re: need help with OnPlayerSpawn and GivePlayerWeapon -
cyber_punk - 01.08.2009
Yes It still can be deathmatch, I think AddPlayerClassEx still sets the teams with gTeam.