This is my on player spawn code:
Now, I have a favorite spawn feature for players which can set their spawn location on their choice from a given list,
but the Class Selection Dialog is not appearing when i use setplayerpos, my code:
Any help would be appreciated.
Code:
public OnPlayerSpawn(playerid)
{
if(IsSpecing[playerid] == 1 && AdminDuty[playerid] == 1)
{
SetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);// Remember earlier we stored the positions in these variables, now we're gonna get them from the variables.
SetPlayerInterior(playerid,Inter[playerid]);//Setting the player's interior to when they typed '/spec'
SetPlayerVirtualWorld(playerid,vWorld[playerid]);//Setting the player's virtual world to when they typed '/spec'
IsSpecing[playerid] = 0;//Just saying you're free to use '/spec' again YAY :D
IsBeingSpeced[spectatorid[playerid]] = 0;//Just saying that the player who was being spectated, is not free from your stalking >:D
SetPlayerHealth(playerid, 500000);
SetPlayerTeam(playerid, TEAM_NONE);
SetPlayerColor(playerid,PINK);
SetPlayerSkin(playerid, 217);
GivePlayerWeapon(playerid, 38, 999999);
return 1;
}
if(IsSpecing[playerid] == 1 && AdminDuty[playerid] == 0)
{
SetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
SetPlayerInterior(playerid,Inter[playerid]);
SetPlayerVirtualWorld(playerid,vWorld[playerid]);
IsSpecing[playerid] = 0;
SetPlayerHealth(playerid, 99);
IsBeingSpeced[spectatorid[playerid]] = 0;
SpawnPlayer(playerid);
return 1;
}
StopAudioStreamForPlayer(playerid);
if(PInfo[playerid][big] == 1)
{
SetPlayerPos(playerid,-392.2922, 1510.5791, 76.6117);
ShowPlayerDialog(playerid, DIALOG_CLASSES, DIALOG_STYLE_LIST, "{6EF83C}Select your class", "Assault\nSniper\nMedic\nEngineer\nJet Trooper\nAir Trooper\nPyroman\nPilot\nDetonator\nSpy\nGunner", "Select", "Quit");
SendClientMessage(playerid, COLOR_PURPLE, "[SPAWN]: {FFFFFF}You have been spawned at your saved location.");
return 1;
}
if(PInfo[playerid][qua] == 1)
{
SetPlayerPos(playerid, 468.0350, 882.8987, -28.9385);
ShowPlayerDialog(playerid, DIALOG_CLASSES, DIALOG_STYLE_LIST, "{6EF83C}Select your class", "Assault\nSniper\nMedic\nEngineer\nJet Trooper\nAir Trooper\nPyroman\nPilot\nDetonator\nSpy\nGunner", "Select", "Quit");
SendClientMessage(playerid, COLOR_PURPLE, "[SPAWN]: {FFFFFF}You have been spawned at your saved location.");
return 1;
}
if(PInfo[playerid][des] == 1)
{
SetPlayerPos(playerid, 414.1834, 2533.3660, 19.1484);
ShowPlayerDialog(playerid, DIALOG_CLASSES, DIALOG_STYLE_LIST, "{6EF83C}Select your class", "Assault\nSniper\nMedic\nEngineer\nJet Trooper\nAir Trooper\nPyroman\nPilot\nDetonator\nSpy\nGunner", "Select", "Quit");
SendClientMessage(playerid, COLOR_PURPLE, "[SPAWN]: {FFFFFF}You have been spawned at your saved location.");
return 1;
}
if(IN_DM_CHAINSAW[playerid] == 1)
{
ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, " ", " ", " ", " ");
PlayerClass[playerid] = 0;
SetPlayerInterior(playerid, 0);
SetPlayerSkin(playerid, 264);
SetPlayerColor(playerid, 0xFFFFFFFF);
SetPlayerVirtualWorld(playerid, 10);
new ran = random(sizeof(ChainsawDMSpawns));
SetPlayerPos(playerid, ChainsawDMSpawns[ran][0], ChainsawDMSpawns[ran][1], ChainsawDMSpawns[ran][2]);
SetPlayerFacingAngle(playerid, ChainsawDMSpawns[ran][3]);
GivePlayerWeapon(playerid, 9, 1);
SetPlayerHealth(playerid, 99);
SetPlayerArmour(playerid, 99);
return 1;
}
else if(IN_DM_SNIPER[playerid] == 1)
{
ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, " ", " ", " ", " ");
SetPlayerInterior(playerid, 0);
PlayerClass[playerid] = 0;
SetPlayerSkin(playerid, 29);
SetPlayerColor(playerid, 0xFFFFFFFF);
SetPlayerVirtualWorld(playerid, 11);
new ran = random(sizeof(SniperDMSpawns));
SetPlayerPos(playerid, SniperDMSpawns[ran][0], SniperDMSpawns[ran][1], SniperDMSpawns[ran][2]);
SetPlayerFacingAngle(playerid, SniperDMSpawns[ran][3]);
GivePlayerWeapon(playerid, 34, 1000);
SetPlayerHealth(playerid, 99);
SetPlayerArmour(playerid, 99);
return 1;
}
else if(IN_DM_CBUG[playerid] == 1)
{
ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, " ", " ", " ", " ");
SetPlayerInterior(playerid, 0);
PlayerClass[playerid] = 0;
SetPlayerSkin(playerid, 294);
SetPlayerColor(playerid, 0xFFFFFFFF);
SetPlayerVirtualWorld(playerid, 12);
new ran = random(sizeof(CbugDMSpawns));
SetPlayerPos(playerid, CbugDMSpawns[ran][0], CbugDMSpawns[ran][1], CbugDMSpawns[ran][2]);
SetPlayerFacingAngle(playerid, CbugDMSpawns[ran][3]);
GivePlayerWeapon(playerid, 24, 1000);
SetPlayerHealth(playerid, 99);
SetPlayerArmour(playerid, 99);
return 1;
}
if(GetPlayerScore(playerid) >= 2500)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Your rank is: General");
SetPlayerArmour(playerid, 90);
}
else if(GetPlayerScore(playerid) >= 750 && GetPlayerScore(playerid) < 2500)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Your rank is: Colonel");
SendClientMessage(playerid, 0xFFFFFFFF, "RANK BONUS: Granades ; Tec-9 ; 50 Armor");
SetPlayerArmour(playerid, 50);
}
else if(GetPlayerScore(playerid) >= 300 && GetPlayerScore(playerid) < 750)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Your rank is: Lieutenant");
SendClientMessage(playerid, 0xFFFFFFFF, "RANK BONUS: Knife ; Combat Shotgun ; 40 Armor");
SetPlayerArmour(playerid, 40);
}
else if(GetPlayerScore(playerid) >= 150 && GetPlayerScore(playerid) < 300)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Your rank is Officer");
SendClientMessage(playerid, 0xFFFFFFFF, "RANK BONUS: D-Eagle ; 30 Armor");
SetPlayerArmour(playerid, 30);
}
else if(GetPlayerScore(playerid) >= 50 && GetPlayerScore(playerid) < 150)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Your rank is: Coporal");
SendClientMessage(playerid, 0xFFFFFFFF, "RANK BONUS: MP5 ; 20 Armor");
SetPlayerArmour(playerid, 20);
}
else if(GetPlayerScore(playerid) >= 0 && GetPlayerScore(playerid) < 50)
{
SendClientMessage(playerid, 0xFFFFFFFF, "Your rank is: Private");
SendClientMessage(playerid, 0xFFFFFFFF, "RANK BONUS: Shotgun ; Silenced Colt ; Baseball Bat ; 10 Armor");
SetPlayerArmour(playerid, 10);
}
if(IsSpecing[playerid] == 0)
{
switch(PlayerTeam[playerid])
{
case TEAM_AMERICA:
{
SetPlayerSkin(playerid, 287);
SetPlayerTeam(playerid, 0);
SetPlayerColor(playerid, COLOR_BLUELIGHT);
new rand = random(sizeof(America));
SetPlayerPos(playerid, America[rand][0], America[rand][1], America[rand][2]);
}
case TEAM_RUSSIA:
{
SetPlayerSkin(playerid, 285);
SetPlayerTeam(playerid, 1);
SetPlayerColor(playerid, RED);
new rand = random(sizeof(Russia));
SetPlayerPos(playerid, Russia[rand][0], Russia[rand][1], Russia[rand][2]);
}
case TEAM_ARABIA:
{
SetPlayerSkin(playerid, 179);
SetPlayerTeam(playerid, 2);
SetPlayerColor(playerid, COLOR_ORANGELIGHT);
new rand = random(sizeof(Arabia));
SetPlayerPos(playerid, Arabia[rand][0], Arabia[rand][1], Arabia[rand][2]);
}
case TEAM_FRANCE:
{
SetPlayerSkin(playerid, 121);
SetPlayerTeam(playerid, 3);
SetPlayerColor(playerid, GREEN);
new rand = random(sizeof(France));
SetPlayerPos(playerid, France[rand][0], France[rand][1], France[rand][2]);
}
case TEAM_AUSTRALIA:
{
SetPlayerSkin(playerid, 294);
SetPlayerTeam(playerid, 4);
SetPlayerColor(playerid, PURPLE);
new rand = random(sizeof(Australia));
SetPlayerPos(playerid, Australia[rand][0], Australia[rand][1], Australia[rand][2]);
}
case TEAM_AFRICA:
{
SetPlayerSkin(playerid, 142);
SetPlayerTeam(playerid, 5);
SetPlayerColor(playerid, YELLOW);
new rand = random(sizeof(Africa));
SetPlayerPos(playerid, Africa[rand][0], Africa[rand][1], Africa[rand][2]);
}
}
SetPlayerHealth(playerid, 100000);
SetTimerEx("Spawnprotect", 10000, false, "d", playerid);
SendClientMessage(playerid, -1, "{00FF00}You are under spawn protection for 10 seconds.");
GameTextForPlayer(playerid, "~n~~n~~g~Spawn Protection On", 3000, 4);
ASP[playerid] =1;
SetPlayerVirtualWorld(playerid, 0);
}
if(ChosenClass[playerid] == 0)
{
if(IN_DM_CHAINSAW[playerid] == 0 && IN_DM_SNIPER[playerid] == 0 && IN_DM_CBUG[playerid] == 0)
{
ShowPlayerDialog(playerid, DIALOG_CLASSES, DIALOG_STYLE_LIST, "{6EF83C}Select your class", "Assault\nSniper\nMedic\nEngineer\nJet Trooper\nAir Trooper\nPyroman\nPilot\nDetonator\nSpy\nGunner", "Select", "Quit");
}
}
TextDrawShowForPlayer(playerid,BG_TD);
TextDrawShowForPlayer(playerid,LINK_TD);
TextDrawShowForPlayer(playerid,TITLE_TD);
PlayerTextDrawShow(playerid, KILLS_TD[playerid]);
PlayerTextDrawShow(playerid, DEATHS_TD[playerid]);
PlayerTextDrawShow(playerid, CLASS_TD[playerid]);
PlayerTextDrawShow(playerid, TEAM_TD[playerid]);
PlayerTextDrawShow(playerid, SCORE_TD[playerid]);
PlayerTextDrawSetString(playerid, TEAM_TD[playerid], GetPlayerTeamName(playerid));
if(PInfo[playerid][Jailed] != 0)
{
SetPlayerInterior(playerid, 3);//sets player interior
SetPlayerVirtualWorld(playerid, playerid);//sets player vw
SetPlayerFacingAngle(playerid, 360.0);//player angle
SetPlayerPos(playerid, 197.5662, 175.4800, 1004.0);//player pos
SetPlayerHealth(playerid, 99);//player cannot be killed
ResetPlayerWeapons(playerid);//resets his weapons
JailTimer[playerid] = SetTimerEx("UnJail",PInfo[playerid][Jailed]*60000, false, "i", playerid);//jail timer
SendClientMessage(playerid, -1, "{FF0000}You didnt complete your jail time, You will stay in jail untill you serve your jail time.");
}
return 1;
}
but the Class Selection Dialog is not appearing when i use setplayerpos, my code:
Code:
if(PInfo[playerid][big] == 1)
{
SetPlayerPos(playerid,-392.2922, 1510.5791, 76.6117);
SendClientMessage(playerid, COLOR_PURPLE, "[SPAWN]: {FFFFFF}You have been spawned at your saved location.");
return 1;
}
if(PInfo[playerid][qua] == 1)
{
SetPlayerPos(playerid, 468.0350, 882.8987, -28.9385);
SendClientMessage(playerid, COLOR_PURPLE, "[SPAWN]: {FFFFFF}You have been spawned at your saved location.");
return 1;
}
if(PInfo[playerid][des] == 1)
{
SetPlayerPos(playerid, 414.1834, 2533.3660, 19.1484);
SendClientMessage(playerid, COLOR_PURPLE, "[SPAWN]: {FFFFFF}You have been spawned at your saved location.");
return 1;
}