Need help with this simple problem. -
rangerxxll - 03.03.2012
Good evening.
I currently have this code, in my script
pawn Код:
SetPlayerTeamFromClass(playerid)
{
new classid = GetPlayerSkin(playerid);
if (classid == 120 || classid == 35 || classid == 112
{
SetPlayerColor(playerid,COLOR_CYAN);
SetPlayerTeam(playerid, TEAM_HUMANS);
}
else if (classid == 137 || classid == 135 || classid == 136
{
SetPlayerColor(playerid, COLOR_BROWN);
SetPlayerTeam(playerid, TEAM_ZOMBIES
}
}
And I get these errors.
Код:
C:\Users\Luke\Desktop\Script\Scripts\Lost Woods BETA.pwn(326) : warning 203: symbol is never used: "HumanSpawns"
C:\Users\Luke\Desktop\Script\Scripts\Lost Woods BETA.pwn(326) : warning 203: symbol is never used: "SetPlayerTeamFromClass"
C:\Users\Luke\Desktop\Script\Scripts\Lost Woods BETA.pwn(326) : warning 203: symbol is never used: "ZombieSpawns"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Warnings.
How is SetPlayerTeamFromClass never used? Also, for the other errors, those are for my random spawn positions, which aren't going so well either.
pawn Код:
new Float:HumanSpawns[][] =
{
{1775.8531,-1303.9132,120.2586,272.4887},
{1774.5525,-1306.3617,120.2586,274.0972},
{1774.6008,-1301.7284,120.2586,270.8802},
{1771.9750,-1303.1437,120.2586,265.5953},
{1778.1970,-1303.5835,120.2586,271.5696}
};
new Float:ZombieSpawns[][] =
{
{1833.1782,-1292.7540,120.2656,10.1452},
{1827.6752,-1291.5758,120.2656,17.0386},
{1831.7612,-1308.2998,120.2656,182.9397},
{1827.4015,-1309.8148,120.2656,178.1143}
};
I've defined the human and zombie team as:
pawn Код:
#define TEAM_HUMANS 0
#define TEAM_ZOMBIES 1
And I also have
How come I'm getting these errors?
Re: Need help with this simple problem. -
R0FLC0PTER - 03.03.2012
You aren't using the SetPlayerTeamFromClass function anywhere.
If i recall correctly this function should be called from your OnPlayerSpawn callback.
And for your random spawns, you should look up some tutorials, because just declaring some variables isn't gonna cut it.
Re: Need help with this simple problem. -
rangerxxll - 03.03.2012
I moved it under OnPlayerRequestClass. But it still claims SetPlayerTeamFromClass is still undefined.
Re: Need help with this simple problem. -
niels44 - 03.03.2012
ok try this: i had this problem first too with my randomspawns and shit:
under onplayerrequestclass:
pawn Код:
new classid = GetPlayerSkin(playerid);
if (classid == 120 || classid == 35 || classid == 112
{
SetPlayerColor(playerid,COLOR_CYAN);
SetPlayerTeam(playerid, TEAM_HUMANS);
}
else if (classid == 137 || classid == 135 || classid == 136
{
SetPlayerColor(playerid, COLOR_BROWN);
SetPlayerTeam(playerid, TEAM_ZOMBIES);
}
under onplayerspawn:
pawn Код:
if(gTeam[playerid] == TEAM_HUMANS)
{
new Random = random(sizeof(HumanSpawns));
SetPlayerPos(playerid, HumanSpawns[Random][0], HumanSpawns[Random][1], HumanSpawns[Random][2]);
else if(gTeam[playerid] == TEAM_ZOMBIES)
{
new Random = random(sizeof(ZombieSpawns));
SetPlayerPos(playerid, ZombieSpawns[Random][0], ZombieSpawns[Random][1], ZombieSpawns[Random][2]
SetPlayerInterior(playerid, 0);
i hope i helped you out abit... but for the requestclass i recommend you to use this:
pawn Код:
switch(classid)
{
case 0..9:
{
GameTextForPlayer(playerid, "~p~Dealer ~r~Class", 3000, 4);
Teams[playerid] = DEALER;
}
case 10..19:
{
GameTextForPlayer(playerid, "~b~Police ~r~Class", 3000, 4);
Teams[playerid] = POLICE;
}
change the Team and POLICE etc. to your own teams and variables and the: case: 0..9: means that somewhere in your gamemode you have AddPlayerClass(blablabla);
and 0..9 means that the first 10 AddPlayerClasses will be for the Dealer Team.
if you have any other questions send me PM pls cuz i mostly aint watching topics which ive already seen XD
greets niels
Re: Need help with this simple problem. -
rangerxxll - 03.03.2012
Thanks for your help. Would this work?
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
switch ( classid )
{
case 0:
{
GameTextForPlayer(playerid, "~b~ Human", 300, 1);
SetPlayerTeam(playerid, TEAM_HUMANS);
}
case 1:
{
GameTextForPlayer(playerid, "~b~ Human", 300, 1);
SetPlayerTeam(playerid, TEAM_HUMANS);
}
case 2:
{
GameTextForPlayer(playerid, "~b~ Human", 300, 1);
SetPlayerTeam(playerid, TEAM_HUMANS);
}
case 3:
{
GameTextForPlayer(playerid, "~b~ Human", 300, 1);
SetPlayerTeam(playerid, TEAM_HUMANS);
}
case 4:
{
GameTextForPlayer(playerid, "~r~ Zombie", 300, 1);
SetPlayerTeam(playerid, TEAM_ZOMBIES);
}
case 5:
{
GameTextForPlayer(playerid, "~r~ Zombie", 300, 1);
SetPlayerTeam(playerid, TEAM_ZOMBIES);
}
case 6:
{
GameTextForPlayer(playerid, "~r~ Zombie", 300, 1);
SetPlayerTeam(playerid, TEAM_ZOMBIES);
}
case 7:
{
GameTextForPlayer(playerid, "~r~ Zombie", 300, 1);
SetPlayerTeam(playerid, TEAM_ZOMBIES);
}
}
return 1;
}
I've tested it, but when I go to chose my skin/class the skins don't show up. And yes, I do got them.
pawn Код:
//------------------------------HUMAN CLASS------------------------------------------
AddPlayerClass(120,-1633.9758,-2237.3757,31.4766,106.9500,0,0,0,0,0,0); // Human Spawn 1 classid=0
AddPlayerClass(35,-1675.7295,-2372.9072,94.6731,348.4488,0,0,0,0,0,0); // Human Spawn 2 classid=1
AddPlayerClass(112,-1657.2673,-2034.8319,65.4988,166.2332,0,0,0,0,0,0); // Human Spawn 3 classid=2
//-------------------------ZOMBIE CLASS---------------------------------------------
AddPlayerClass(137,-1414.2123,-2543.9963,58.1086,262.9706,0,0,0,0,0,0); // Zombie Spawn 1 classid=3
AddPlayerClass(135,-1723.3090,-2545.6929,9.4780,95.6908,0,0,0,0,0,0); // Zombie Spawn 2 classid=4
AddPlayerClass(136,-1883.5908,-2409.6572,32.2462,318.2824,0,0,0,0,0,0); // Zombie Spawn 3 classid=5
Re: Need help with this simple problem. -
niels44 - 03.03.2012
are you sure you have your classes on top of your OnGameModeInit? so not under the objects or/and cars?
and about that requestclass i would recommend you to place them in class and not as individuals:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
switch ( classid )
{
case 0..3:
{
GameTextForPlayer(playerid, "~b~ Human", 3000, 1);
gTeam[playerid] = TEAM_HUMANS;
}
case 4..7:
{
GameTextForPlayer(playerid, "~r~ Zombie", 3000, 1);
gTeam[playerid] = TEAM_ZOMBIES;
}
i hope you understand and see what i changed XD and eehm if you DO have your classes on top of gamemode init and still not works then post ehre again