I tried to do an auto-spawn after login, I almost succeded, but I have a little problem !
Код:
public SpawnPlayerAfterLogin(playerid)
{
new string[128];
new name[MAX_PLAYER_NAME];
Spawned[playerid] = 1;
GetPlayerName(playerid,name,sizeof(name));
if(GetPlayerJobID(playerid) == 0)
{
SetSpawnInfo(playerid,TEAM_Civilian,240,1476.3324,-1696.2444,14.0469,180.0161,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, COLOR_WHITE);
gTeam[playerid] = TEAM_Civilian;
format(string,sizeof(string),"[ ~ ] Civilian %s joined the server !",name);
SendClientMessageToAll(COLOR_WHITE,string);
}
else if(GetPlayerJobID(playerid) == 1)
{
SetSpawnInfo(playerid,TEAM_Cop,265,1546.5210,-1675.5144,13.5625,92.6616,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, COP_COLOR);
gTeam[playerid] = TEAM_Cop;
format(string,sizeof(string),"[ ~ ] Officer %s joined the server !",name);
SendClientMessageToAll(COP_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 2)
{
SetSpawnInfo(playerid,TEAM_Medic,50,1990.6846,-2050.8533,13.5426,170.0355,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, MEDIC_COLOR);
gTeam[playerid] = TEAM_Medic;
format(string,sizeof(string),"[ ~ ] Medical Worker %s joined the server !",name);
SendClientMessageToAll(MEDIC_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 3)
{
SetSpawnInfo(playerid,TEAM_Anarchist,175,2185.6057,-2288.0615,13.5469,47.3818,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, Anarchist_COLOR);
gTeam[playerid] = TEAM_Anarchist;
format(string,sizeof(string),"[ ~ ] Anarchist %s joined the server !",name);
SendClientMessageToAll(Anarchist_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 4)
{
SetSpawnInfo(playerid,TEAM_Mechanic,240,1476.3324,-1696.2444,14.0469,180.0161,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, MECHANIC_COLOR);
gTeam[playerid] = TEAM_Mechanic;
format(string,sizeof(string),"[ ~ ] Mechanic %s joined the server !",name);
SendClientMessageToAll(MECHANIC_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 5)
{
SetSpawnInfo(playerid,TEAM_Governor,228,1124.8789,-2037.1559,69.8828,271.8082,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerSkin(playerid, 228);
SetPlayerColor(playerid, Governor_COLOR);
gTeam[playerid] = TEAM_Governor;
format(string,sizeof(string),"[ ~ ] Governor %s joined the server !",name);
SendClientMessageToAll(Governor_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 6)
{
SetSpawnInfo(playerid,TEAM_Hitman,125,285.6758,-1510.4330,24.9219,236.9597,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, HITMAN_COLOR);
gTeam[playerid] = TEAM_Governor;
format(string,sizeof(string),"[ ~ ] Hitman %s joined the server !",name);
SendClientMessageToAll(HITMAN_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 7)
{
SetSpawnInfo(playerid,TEAM_DUSTMAN,16,2509.6653,-2637.4514,13.6452,359.5769,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, GREEN);
gTeam[playerid] = TEAM_DUSTMAN;
format(string,sizeof(string),"[ ~ ] Dustman %s joined the server !",name);
SendClientMessageToAll(GREEN,string);
}
else if(GetPlayerJobID(playerid) == 8)
{
SetSpawnInfo(playerid,TEAM_FBI,165,1262.0186,-1639.9615,13.5517,174.0827,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, COLOR_WARNING);
gTeam[playerid] = TEAM_FBI;
format(string,sizeof(string),"[ ~ ] FBI chief %s joined the server !",name);
SendClientMessageToAll(COLOR_WARNING,string);
}
else if(GetPlayerJobID(playerid) == 9)
{
SetSpawnInfo(playerid,TEAM_Godfather,120,1283.2012,-832.1804,83.1406,6.9243,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, ORANGE);
gTeam[playerid] = TEAM_Godfather;
format(string,sizeof(string),"[ ~ ] Godfather %s joined the server !",name);
SendClientMessageToAll(ORANGE,string);
}
else if(GetPlayerJobID(playerid) == 10)
{
SetSpawnInfo(playerid,TEAM_SG,286,1262.0186,-1639.9615,13.5517,174.0827,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, SG_COLOR);
gTeam[playerid] = TEAM_SG;
format(string,sizeof(string),"[ ~ ] FBI agent %s joined the server !",name);
SendClientMessageToAll(SG_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 11)
{
SetSpawnInfo(playerid,TEAM_rober,293,1883.4136,-2008.2400,13.5469,174.5157,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, COLOR_GREY);
gTeam[playerid] = TEAM_rober;
format(string,sizeof(string),"[ ~ ] Thief %s joined the server !",name);
SendClientMessageToAll(COLOR_GREY,string);
}
else if(GetPlayerJobID(playerid) == 13)
{
SetSpawnInfo(playerid,TEAM_DRUG,292,-366.7414,-1413.3528,25.7266,2.9484,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, DRUG_COLOR);
gTeam[playerid] = TEAM_DRUG;
format(string,sizeof(string),"[ ~ ] Drug Dealer %s joined the server !",name);
SendClientMessageToAll(DRUG_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 14)
{
SetSpawnInfo(playerid,TEAM_COMMANDER,113,237.6355,109.9400,1011.0570,63.8935,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, COMMANDER_COLOR);
gTeam[playerid] = TEAM_COMMANDER;
format(string,sizeof(string),"[ ~ ] Commander %s joined the server !",name);
SendClientMessageToAll(COMMANDER_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 20)
{
SetSpawnInfo(playerid,TEAM_FISHER,36,375.7592,-2068.4624,7.8359,192.6050,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, COLOR_YELLOW);
gTeam[playerid] = TEAM_FISHER;
format(string,sizeof(string),"[ ~ ] Fisher %s joined the server !",name);
SendClientMessageToAll(COLOR_YELLOW,string);
}
else if(GetPlayerJobID(playerid) == 21)
{
SetSpawnInfo(playerid,TEAM_PDRIVER,255,1022.6448,-1122.1598,23.8717,180.9363,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, COLOR_PINK);
gTeam[playerid] = TEAM_PDRIVER;
format(string,sizeof(string),"[ ~ ] Personal Driver %s joined the server !",name);
SendClientMessageToAll(COLOR_PINK,string);
}
else if(GetPlayerJobID(playerid) == 22)
{
SetSpawnInfo(playerid,TEAM_MDIGGER,260,2483.7917,-2115.8574,13.5469,3.1797,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, MDIGGER_COLOR);
gTeam[playerid] = TEAM_MDIGGER;
format(string,sizeof(string),"[ ~ ] Mine Digger %s joined the server !",name);
SendClientMessageToAll(MDIGGER_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 23)
{
SetSpawnInfo(playerid,TEAM_OUTLAW,133,2483.7917,-2115.8574,13.5469,3.1797,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, COLOR_RED);
GivePlayerWanted(playerid);
gTeam[playerid] = TEAM_OUTLAW;
format(string,sizeof(string),"[ ~ ] Outlaw %s joined the server !",name);
SendClientMessageToAll(COLOR_RED,string);
}
else if(GetPlayerJobID(playerid) == 24)
{
SetSpawnInfo(playerid,TEAM_RECYCLER,27,2483.7917,-2115.8574,13.5469,3.1797,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid, RECYCLER_COLOR);
gTeam[playerid] = TEAM_RECYCLER;
format(string,sizeof(string),"[ ~ ] Recycler %s joined the server !",name);
SendClientMessageToAll(RECYCLER_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 25)
{
SetSpawnInfo(playerid,TEAM_DOCTOR,70,2483.7917,-2115.8574,13.5469,3.1797,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid,DOCTOR_COLOR);
gTeam[playerid] = TEAM_DOCTOR;
format(string,sizeof(string),"[ ~ ] Doctor %s joined the server !",name);
SendClientMessageToAll(DOCTOR_COLOR,string);
}
else if(GetPlayerJobID(playerid) == 19)
{
SetSpawnInfo(playerid,TEAM_HOMELESS,230,1124.8789,-2037.1559,69.8828,271.8082,0,0,0,0,0,0);
SpawnPlayer(playerid);
SetPlayerColor(playerid,COLOR_GREEN);
gTeam[playerid] = TEAM_HOMELESS;
format(string,sizeof(string),"[ ~ ] Homeless %s joined the server !",name);
SendClientMessageToAll(COLOR_GREEN,string);
}
return 1;
}