CJ appears, and class selection after first death. -
Hi I'm having an issue where after the server starts the FIRST death only, it makes CJ appear and class selection. But after the player dies again. It's fine and they spawn normally.
Re: CJ appears, and class selection after first death. -
Re: CJ appears, and class selection after first death. -
Код:
public OnPlayerClickTextDraw(playerid, Text:clickedid)
{
//You click this to show the skin preview below.
if(clickedid == Grove)
{
InterpolateCameraPos(playerid, 2448.8579, -1672.8854, 24.9642, 2448.8579, -1672.8854, 24.9642, 10000, CAMERA_MOVE);
InterpolateCameraLookAt(playerid, 2449.8555, -1672.7627, 24.7540, 2449.8555, -1672.7627, 24.7540, 10000, CAMERA_MOVE);
TextDrawSetPreviewModel(preview1, 105);
TextDrawSetPreviewModel(preview2, 106);
TextDrawSetPreviewModel(preview3, 107);
TextDrawSetPreviewModel(preview4, 270);
TextDrawHideForPlayer(playerid, preview1);TextDrawHideForPlayer(playerid, preview2);TextDrawHideForPlayer(playerid, preview3);TextDrawHideForPlayer(playerid, preview4);
TextDrawShowForPlayer(playerid, preview1);TextDrawShowForPlayer(playerid, preview2);TextDrawShowForPlayer(playerid, preview3);TextDrawShowForPlayer(playerid, preview4);
PlayerTeam[playerid] = TEAM_GROVE;
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
if(clickedid == Ballas)
{
InterpolateCameraPos(playerid, 2444.8850, -1264.8770, 33.3640, 2444.8850, -1264.8770, 33.3640, 10000, CAMERA_MOVE);
InterpolateCameraLookAt(playerid, 2444.3005, -1264.0607, 33.1439, 2444.3005, -1264.0607, 33.1439, 10000, CAMERA_MOVE);
TextDrawSetPreviewModel(preview1, 102);
TextDrawSetPreviewModel(preview2, 103);
TextDrawSetPreviewModel(preview3, 104);
TextDrawSetPreviewModel(preview4, 13);
TextDrawHideForPlayer(playerid, preview1);TextDrawHideForPlayer(playerid, preview2);TextDrawHideForPlayer(playerid, preview3);TextDrawHideForPlayer(playerid, preview4);
TextDrawShowForPlayer(playerid, preview1);TextDrawShowForPlayer(playerid, preview2);TextDrawShowForPlayer(playerid, preview3);TextDrawShowForPlayer(playerid, preview4);
PlayerTeam[playerid] = TEAM_BALLAS;
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
if(clickedid == FastFood)
{
InterpolateCameraPos(playerid, 2072.5442, -1824.8136, 20.9677, 2072.5442, -1824.8136, 20.9677, 10000, CAMERA_MOVE);
InterpolateCameraLookAt(playerid, 2073.2537, -1824.1030, 20.7876, 2073.2537, -1824.1030, 20.7876, 10000, CAMERA_MOVE);
TextDrawSetPreviewModel(preview1, 205);
TextDrawSetPreviewModel(preview2, 155);
TextDrawSetPreviewModel(preview3, 167);
TextDrawSetPreviewModel(preview4, 168);
TextDrawHideForPlayer(playerid, preview1);TextDrawHideForPlayer(playerid, preview2);TextDrawHideForPlayer(playerid, preview3);TextDrawHideForPlayer(playerid, preview4);
TextDrawShowForPlayer(playerid, preview1);TextDrawShowForPlayer(playerid, preview2);TextDrawShowForPlayer(playerid, preview3);TextDrawShowForPlayer(playerid, preview4);
PlayerTeam[playerid] = TEAM_FASTFOOD;
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
if(clickedid == Girls)
{
InterpolateCameraPos(playerid, 2335.8655, -1525.1362, 31.7334, 2335.8655, -1525.1362, 31.7334, 10000, CAMERA_MOVE);
InterpolateCameraLookAt(playerid, 2336.5732, -1524.4269, 31.5132, 2336.5732, -1524.4269, 31.5132, 10000, CAMERA_MOVE);
TextDrawSetPreviewModel(preview1, 40);
TextDrawSetPreviewModel(preview2, 55);
TextDrawSetPreviewModel(preview3, 56);
TextDrawSetPreviewModel(preview4, 90);
TextDrawHideForPlayer(playerid, preview1);TextDrawHideForPlayer(playerid, preview2);TextDrawHideForPlayer(playerid, preview3);TextDrawHideForPlayer(playerid, preview4);
TextDrawShowForPlayer(playerid, preview1);TextDrawShowForPlayer(playerid, preview2);TextDrawShowForPlayer(playerid, preview3);TextDrawShowForPlayer(playerid, preview4);
PlayerTeam[playerid] = TEAM_GIRLS;
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
if(clickedid == LSPD)
{
InterpolateCameraPos(playerid, 1507.9735, -1622.9977, 33.8574, 1507.9735, -1622.9977, 33.8574, 10000, CAMERA_MOVE);
InterpolateCameraLookAt(playerid, 1508.7632, -1623.6134, 33.4923, 1508.7632, -1623.6134, 33.4923, 10000, CAMERA_MOVE);
TextDrawSetPreviewModel(preview1, 288);
TextDrawSetPreviewModel(preview2, 265);
TextDrawSetPreviewModel(preview3, 267);
TextDrawSetPreviewModel(preview4, 266);
TextDrawHideForPlayer(playerid, preview1);TextDrawHideForPlayer(playerid, preview2);TextDrawHideForPlayer(playerid, preview3);TextDrawHideForPlayer(playerid, preview4);
TextDrawShowForPlayer(playerid, preview1);TextDrawShowForPlayer(playerid, preview2);TextDrawShowForPlayer(playerid, preview3);TextDrawShowForPlayer(playerid, preview4);
PlayerTeam[playerid] = TEAM_LSPD;
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
if(clickedid == Vagos)
{
InterpolateCameraPos(playerid, 2651.4519, -1066.1614, 80.2108, 2651.4519, -1066.1614, 80.2108, 10000, CAMERA_MOVE);
InterpolateCameraLookAt(playerid, 2650.8713, -1066.9785, 79.8807, 2650.8713, -1066.9785, 79.8807, 10000, CAMERA_MOVE);
TextDrawSetPreviewModel(preview1, 108);
TextDrawSetPreviewModel(preview2, 109);
TextDrawSetPreviewModel(preview3, 110);
TextDrawSetPreviewModel(preview4, 115);
TextDrawHideForPlayer(playerid, preview1);TextDrawHideForPlayer(playerid, preview2);TextDrawHideForPlayer(playerid, preview3);TextDrawHideForPlayer(playerid, preview4);
TextDrawShowForPlayer(playerid, preview1);TextDrawShowForPlayer(playerid, preview2);TextDrawShowForPlayer(playerid, preview3);TextDrawShowForPlayer(playerid, preview4);
PlayerTeam[playerid] = TEAM_VAGOS;
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
if(clickedid == Hobo)
{
InterpolateCameraPos(playerid, 2267.3882, -1642.7289, 21.8318, 2267.3882, -1642.7289, 21.8318, 10000, CAMERA_MOVE);
InterpolateCameraLookAt(playerid, 2267.8176, -1643.6338, 21.6316, 2267.8176, -1643.6338, 21.6316, 10000, CAMERA_MOVE);
TextDrawSetPreviewModel(preview1, 78);
TextDrawSetPreviewModel(preview2, 79);
TextDrawSetPreviewModel(preview3, 137);
TextDrawSetPreviewModel(preview4, 135);
TextDrawHideForPlayer(playerid, preview1);TextDrawHideForPlayer(playerid, preview2);TextDrawHideForPlayer(playerid, preview3);TextDrawHideForPlayer(playerid, preview4);
TextDrawShowForPlayer(playerid, preview1);TextDrawShowForPlayer(playerid, preview2);TextDrawShowForPlayer(playerid, preview3);TextDrawShowForPlayer(playerid, preview4);
PlayerTeam[playerid] = TEAM_HOBO;
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
//This shows up after clicking a teams textdraw, then after clicking one of the previews it spawns you.
if(clickedid == preview1)
{
if(PlayerTeam[playerid] == TEAM_GROVE) SetSpawnInfo(playerid, TEAM_GROVE, 105, 2498.8916,-1687.5150,13.5117,50.5411, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 105;
if(PlayerTeam[playerid] == TEAM_BALLAS) SetSpawnInfo(playerid, TEAM_BALLAS, 102, 2433.5688,-1239.8219,24.5277,144.9356, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 102;
if(PlayerTeam[playerid] == TEAM_FASTFOOD) SetSpawnInfo(playerid, TEAM_FASTFOOD, 205, 2100.5649,-1790.8584,13.5547,360.0000, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 205;
if(PlayerTeam[playerid] == TEAM_GIRLS) SetSpawnInfo(playerid, TEAM_GIRLS, 40, 2352.8230,-1513.8286,24.0000,146.4501, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 40;
if(PlayerTeam[playerid] == TEAM_VAGOS) SetSpawnInfo(playerid, TEAM_VAGOS, 108, 2628.7700,-1084.1127,69.6162,232.9606, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 108;
if(PlayerTeam[playerid] == TEAM_LSPD) SetSpawnInfo(playerid, TEAM_LSPD, 288, 1545.6051,-1674.2471,13.5607,82.8746, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 288;
if(PlayerTeam[playerid] == TEAM_HOBO) SetSpawnInfo(playerid, TEAM_HOBO, 78, 2283.6423,-1680.5818,14.2506,9.1904, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 78;
TogglePlayerSpectating(playerid, 0); SpawnPlayer(playerid); SendClientMessage(playerid, -1, "{17B4E8}[Info] {E6F200}Welcome to {F26D00}Carbon's Community Gangwar{E6F200}, for help use /help!");
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
if(clickedid == preview2)
{
if(PlayerTeam[playerid] == TEAM_GROVE) SetSpawnInfo(playerid, TEAM_GROVE, 106, 2498.8916,-1687.5150,13.5117,50.5411, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 106;
if(PlayerTeam[playerid] == TEAM_BALLAS) SetSpawnInfo(playerid, TEAM_BALLAS, 103, 2433.5688,-1239.8219,24.5277,144.9356, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 103;
if(PlayerTeam[playerid] == TEAM_FASTFOOD) SetSpawnInfo(playerid, TEAM_FASTFOOD, 155, 2100.5649,-1790.8584,13.5547,360.0000, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 155;
if(PlayerTeam[playerid] == TEAM_GIRLS) SetSpawnInfo(playerid, TEAM_GIRLS, 55, 2352.8230,-1513.8286,24.0000,146.4501, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 55;
if(PlayerTeam[playerid] == TEAM_VAGOS) SetSpawnInfo(playerid, TEAM_VAGOS, 109, 2628.7700,-1084.1127,69.6162,232.9606, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 109;
if(PlayerTeam[playerid] == TEAM_LSPD) SetSpawnInfo(playerid, TEAM_LSPD, 265, 1545.6051,-1674.2471,13.5607,82.8746, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 265;
if(PlayerTeam[playerid] == TEAM_HOBO) SetSpawnInfo(playerid, TEAM_HOBO, 79, 2283.6423,-1680.5818,14.2506,9.1904, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 79;
TogglePlayerSpectating(playerid, 0); SpawnPlayer(playerid); SendClientMessage(playerid, -1, "{17B4E8}[Info] {E6F200}Welcome to {F26D00}Carbon's Community Gangwar{E6F200}, for help use /help!");
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
if(clickedid == preview3)
{
if(PlayerTeam[playerid] == TEAM_GROVE) SetSpawnInfo(playerid, TEAM_GROVE, 107, 2498.8916,-1687.5150,13.5117,50.5411, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 107;
if(PlayerTeam[playerid] == TEAM_BALLAS) SetSpawnInfo(playerid, TEAM_BALLAS, 104, 2433.5688,-1239.8219,24.5277,144.9356, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 104;
if(PlayerTeam[playerid] == TEAM_FASTFOOD) SetSpawnInfo(playerid, TEAM_FASTFOOD, 167, 2100.5649,-1790.8584,13.5547,360.0000, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 167;
if(PlayerTeam[playerid] == TEAM_GIRLS) SetSpawnInfo(playerid, TEAM_GIRLS, 56, 2352.8230,-1513.8286,24.0000,146.4501, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 56;
if(PlayerTeam[playerid] == TEAM_VAGOS) SetSpawnInfo(playerid, TEAM_VAGOS, 110, 2628.7700,-1084.1127,69.6162,232.9606, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 110;
if(PlayerTeam[playerid] == TEAM_LSPD) SetSpawnInfo(playerid, TEAM_LSPD, 267, 1545.6051,-1674.2471,13.5607,82.8746, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 267;
if(PlayerTeam[playerid] == TEAM_HOBO) SetSpawnInfo(playerid, TEAM_HOBO, 137, 2283.6423,-1680.5818,14.2506,9.1904, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 137;
TogglePlayerSpectating(playerid, 0); SpawnPlayer(playerid); SendClientMessage(playerid, -1, "{17B4E8}[Info] {E6F200}Welcome to {F26D00}Carbon's Community Gangwar{E6F200}, for help use /help!");
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
if(clickedid == preview4)
{
if(PlayerTeam[playerid] == TEAM_GROVE) SetSpawnInfo(playerid, TEAM_GROVE, 270, 2498.8916,-1687.5150,13.5117,50.5411, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 270;
if(PlayerTeam[playerid] == TEAM_BALLAS) SetSpawnInfo(playerid, TEAM_BALLAS, 13, 2433.5688,-1239.8219,24.5277,144.9356, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 13;
if(PlayerTeam[playerid] == TEAM_FASTFOOD) SetSpawnInfo(playerid, TEAM_FASTFOOD, 168, 2100.5649,-1790.8584,13.5547,360.0000, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 168;
if(PlayerTeam[playerid] == TEAM_GIRLS) SetSpawnInfo(playerid, TEAM_GIRLS, 90, 2352.8230,-1513.8286,24.0000,146.4501, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 90;
if(PlayerTeam[playerid] == TEAM_VAGOS) SetSpawnInfo(playerid, TEAM_VAGOS, 115, 2628.7700,-1084.1127,69.6162,232.9606, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 115;
if(PlayerTeam[playerid] == TEAM_LSPD) SetSpawnInfo(playerid, TEAM_LSPD, 266, 1545.6051,-1674.2471,13.5607,82.8746, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 266;
if(PlayerTeam[playerid] == TEAM_HOBO) SetSpawnInfo(playerid, TEAM_HOBO, 135, 2283.6423,-1680.5818,14.2506,9.1904, 0, 0, 0, 0, 0, 0); PlayerSkin[playerid] = 135;
TogglePlayerSpectating(playerid, 0); SpawnPlayer(playerid); SendClientMessage(playerid, -1, "{17B4E8}[Info] {E6F200}Welcome to {F26D00}Carbon's Community Gangwar{E6F200}, for help use /help!");
PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
}
Re: CJ appears, and class selection after first death. -
Re: CJ appears, and class selection after first death. -
Re: CJ appears, and class selection after first death. -
If you want to add textdraws as class selection first you must create a function onplayerrequestclass that spawn automatically the player without select the class.
Then connect with a variable the textdraw with the playerrequestclass spawn.
Re: CJ appears, and class selection after first death. -
Re: CJ appears, and class selection after first death. -
This makes the class selection textdraws show up when a player selects a class.
And when the player dies for the first time it just shows the class select. But I don't want class selection to appear. I just want the player to respawn normally.
Re: CJ appears, and class selection after first death. -
So, you need to instantly Spawn the player in OnPlayerRequestClass and make a global array for all players (like bool:InSpawnSel[MAX_PLAYERS]) and an array for the currently selected class (custom class, not SAMP class).
So you have to move your OnPlayerSpawn code to the CustomSpawn function (except code regarding the custom class sel).
In OnPlayerClickTextDraw check if the player is in the custom spawn selection.
Once the player clicks the button that should make him spawn hide all textdraws and set InSpawnSel to false for that player and then call CustomSpawn.
After that the player should be able to re-enter it using F4.
If he still enters the spawn selection after death (without using F4) there is something else wrong.
You should btw never call ForceClassSelection since it makes the player constantly re-entering it.