24.09.2015, 07:08
Hey guys, my first post here.
I've been trying to make this script work for a few days now and losing my patience because I can't get it to work. So I thought I'd drop by the friendly neighbourhood SA-MP forums.
Basically what I'm trying to do, is; when a person spawns; they will be randomized into either: "Team 1" or "Team 2"
Team 1 will be put in a Shamal, and will have their own set of player color/weapons
Team 2 will have their own set of player color/weapons
Here is my script:
Now, what happens when I load this gamemode is weird. I'll click the spawn, but nothing happens. I tend to always get put into the "pilots" team and not the other. Also, the "pilots" do not spawn in the Shamal. And; the whole code is basically flawed and doesn't work.
I was hoping someone can give me some advice on how to make this work. Ideally, I would like it if the players spawn first and there is a delay before they get assorted into either the "pilots" or "farmers" team.
PS: If someone can tell me how to put a limit into how many players can get into a specific team. I will love you. For e.g: there can only be 3 pilots.
I also have further questions since I am very new to pawno (this is my first ever script) and if someone can give me some more advice (maybe through PM) I will be a happy chap
I've been trying to make this script work for a few days now and losing my patience because I can't get it to work. So I thought I'd drop by the friendly neighbourhood SA-MP forums.
Basically what I'm trying to do, is; when a person spawns; they will be randomized into either: "Team 1" or "Team 2"
Team 1 will be put in a Shamal, and will have their own set of player color/weapons
Team 2 will have their own set of player color/weapons
Here is my script:
Quote:
new AllTeams = 2; //SPAWN POINTS new Float:RandomSpawnsPilots[][] = { {1493.0514,-884.9464,59.4047,112.1835}, // Randomspawn {1443.8907,-2493.9626,13.5547,269.8119}, // Randomspawn {1441.1844,-2593.3213,13.5469,270.2715} // Randomspawn }; new Float:RandomSpawnsFarmers[][] = { {718.4906, -1477.3024, 5.4688, 357.9947}, // Randomspawn {722.3772, -1477.2856, 5.4688, 272.3814} // Randomspawn }; //TEXT DRAWS public OnPlayerSpawn(playerid) { //IF THE PLAYER IS TEAM 0 (DEAD) HE WILL DIE AND NOT SPAWN -> SPECTATE. { if(GetPlayerTeam(playerid) == 0) SetPlayerHealth(playerid, -1); TogglePlayerSpectating(playerid, 1); SetPlayerColor(playerid,COLOR_GREY); } { if(GetPlayerTeam(playerid) == 1) PutPlayerInVehicle(playerid, 519, 0); SetPlayerColor(playerid, COLOR_NEUTRALGREEN); GivePlayerWeapon(playerid, 9, 0); } { if(GetPlayerTeam(playerid) == 2) SetPlayerColor(playerid, COLOR_BLUE); GivePlayerWeapon(playerid, 3, 0); } new randteam = random(sizeof(AllTeams)); SetPlayerTeam(playerid, randteam); { new randpilots = random(sizeof(RandomSpawnsPilots)); SetPlayerPos(playerid, RandomSpawnsPilots[randpilots][0], RandomSpawnsPilots[randpilots][1],RandomSpawnsPilots[randpilots][2]); SetPlayerFacingAngle(playerid, RandomSpawnsPilots[randpilots][3]); } { new randfarmers = random(sizeof(RandomSpawnsFarmers)); SetPlayerPos(playerid, RandomSpawnsFarmers[randfarmers][0], RandomSpawnsFarmers[randfarmers][1], RandomSpawnsFarmers[randfarmers][2]); SetPlayerFacingAngle(playerid, RandomSpawnsFarmers[randfarmers][3]); } return 1; } |
I was hoping someone can give me some advice on how to make this work. Ideally, I would like it if the players spawn first and there is a delay before they get assorted into either the "pilots" or "farmers" team.
PS: If someone can tell me how to put a limit into how many players can get into a specific team. I will love you. For e.g: there can only be 3 pilots.
I also have further questions since I am very new to pawno (this is my first ever script) and if someone can give me some more advice (maybe through PM) I will be a happy chap
![Smiley](images/smilies/smile.png)