OnPlayerRequestClass problem/question
#1

Well, I want to do the next thing. Depending on how many teams are available, create classid's/skins or whatever. This is what I got so far, I thought is gonna work.

I've got this for gTeams variable:
pawn Код:
new gTeams = 1;
OnPlayerRequestClass:
Код:
  for(new t = 0; t<sizeof(gTeams)-1; t++)
  {
    if(classid >= 4*TeamInfo[t][tID]-4 && classid < 4*TeamInfo[t][tID])
    {
      if(classid == 4*TeamInfo[t][tID]-4)
      {
        format(cutstring, sizeof(cutstring), "%s", TeamInfo[t][tName]);
	strdel(cutstring, 0, 1);
	format(cutstring, sizeof(cutstring), "~w~%s", cutstring);
	format(letter, sizeof(letter), "%s", TeamInfo[t][tName]);
	strdel(letter, 1, strlen(letter));
	format(letter, sizeof(letter), "~b~~h~%s", letter);
	format(fullstring, sizeof(fullstring), "%s%s (Leaders only)", letter, cutstring);
	GameTextForPlayer(playerid, fullstring, 3000, 6);
	gTeam[playerid] = TeamInfo[t][tID]+100;
      }
      else
      {
        format(cutstring, sizeof(cutstring), "%s", TeamInfo[t][tName]);
	strdel(cutstring, 0, 1);
	format(cutstring, sizeof(cutstring), "~w~%s", cutstring);
	format(letter, sizeof(letter), "%s", TeamInfo[t][tName]);
	strdel(letter, 1, strlen(letter));
	format(letter, sizeof(letter), "~b~~h~%s", letter);
	format(fullstring, sizeof(fullstring), "%s%s", letter, cutstring);
	GameTextForPlayer(playerid, fullstring, 3000, 6);
	gTeam[playerid] = TeamInfo[t][tID];
      }
    }
    else if(classid >= 4*gTeams-4)
    {
      format(fullstring, sizeof(fullstring), "~b~~h~C~w~ivilian");
      GameTextForPlayer(playerid, fullstring, 3000, 6);
      gTeam[playerid] = PlayerInfo[playerid][pTeam];
    }
  }
gTeams - The number of last Team, it's sizeof(gTeams)-1 but that doesn't matter, I know why I did that way, other things from the team are working (like counting them).
classid >= 4*TeamInfo[t][tID]-4 - This means first skin from team.
classid < 4*TeamInfo[t][tID] - This means last skin from team.
classid == 4*TeamInfo[t][tID]-4 - First skin it's for Owner.
else if(classid >= 4*gTeams-4) - If classid it's more than gTeams or equal (last skin from the last team+1) then the next skins are for civilians.

At, OnGameModeInit I've got this (there can be put 4 skins per team, so thats why I'm using -4 and *4 at RequestClass):
pawn Код:
for(new t = 0; t<sizeof(gTeams)-1; t++)
{
    AddPlayerClass(TeamInfo[t][tSkins][0], 1970.1796,1368.7910,9.2578,272.9419,0,0,0,0,0,0);
    AddPlayerClass(TeamInfo[t][tSkins][1], 1970.1796,1368.7910,9.2578,272.9419,0,0,0,0,0,0);
    AddPlayerClass(TeamInfo[t][tSkins][2], 1970.1796,1368.7910,9.2578,272.9419,0,0,0,0,0,0);
    AddPlayerClass(TeamInfo[t][tSkins][3], 1970.1796,1368.7910,9.2578,272.9419,0,0,0,0,0,0);
}
The default skins are set automaticaly to 101 (all of them), when team has been created.

And after them I have (for Civilian skins):
pawn Код:
for(new c = 0; c<sizeof(ClassIDs); c++)
{
    AddPlayerClass(ClassIDs[c], 1970.1796,1368.7910,9.2578,272.9419,0,0,0,0,0,0);  
}
Where ClassIDs:
pawn Код:
new ClassIDs[22] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22};
The teams are counted when the GameMode initiate, using a stock.

pawn Код:
format(TeamInfo[teamid][tName], 128, "%s", dini_Get(filename, "TeamName"));
format(TeamInfo[teamid][tOwner], 128, "%s", dini_Get(filename, "OwnerName"));
TeamInfo[teamid][tID] = dini_Int(filename, "ID");
format(TeamInfo[teamid][tEmployers], 512, "%s", dini_Get(filename, "Employers"));
TeamInfo[teamid][tSpawnCoords][0] = dini_Float(filename, "SpawnX");
TeamInfo[teamid][tSpawnCoords][1] = dini_Float(filename, "SpawnY");
TeamInfo[teamid][tSpawnCoords][2] = dini_Float(filename, "SpawnZ");
TeamInfo[teamid][tSpawnCoords][3] = dini_Float(filename, "SpawnAngle");
TeamInfo[teamid][tSkins][0] = dini_Int(filename, "OwnerSkin");
TeamInfo[teamid][tSkins][1] = dini_Int(filename, "Skin1");
TeamInfo[teamid][tSkins][2] = dini_Int(filename, "Skin2");
TeamInfo[teamid][tSkins][3] = dini_Int(filename, "Skin3");
format(TeamInfo[teamid][tColor], 128, "%s", dini_Get(filename, "TeamColor"));
printf("\n[TEAMS] Team `%s` successfully loaded!", TeamInfo[teamid][tName]);
gTeams++;
Not teams are the problem. The problem is somewhere inside the OnPlayerRequestClass. Cause when I spawn it's says that I choosed the wrong skin.

pawn Код:
if(gTeam[playerid]+100 != PlayerInfo[playerid][pTeam] && gTeam[playerid] != PlayerInfo[playerid][pTeam])
{
    SendClientMessage(playerid, COLOR_WHITE, "* {FF0000}Wrong skin selected{FFFFFF}, you have been kicked!");
}
gTeam+100 means that the player is the leader of the Team.

When the class selection appears, I can choose only Civilian skins, and the text doesn't appear. I created 1 team, and it's the same, team skins and text aren't appearing..
If the 'for' is the problem, I can do it in another way? If yes, how?
It's not Godfather edit !

Thanks in advance.

LE: Teams are created in-game, they'r stored in a file. Restarted the server many times.. still same.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)