[Help] Auto Spawn after login - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] Auto Spawn after login (
/showthread.php?tid=186865)
[Help] Auto Spawn after login -
jm2rock - 31.10.2010
Hi. I want to make it so that I auto spawn when logged in.
Код:
if(dialogid == 1) //LOGIN
{
if(gPlayerLogged[playerid] == 1)
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You are already logged in.");
return 1;
}
if(response)
{
if(!strlen(inputtext))
{
DisplayDialogForPlayer(playerid, 1); //login
SendClientMessage(playerid, COLOR_WHITE, "SERVER: You must enter a password.");
return 1;
}
if(strlen(inputtext) >= 50)
{
DisplayDialogForPlayer(playerid, 1); //login
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Password is too long.");
return 0;
}
new tmppass[64];
//Store Player ID & TMP pass in echo to find string used to crash server
new playername[MAX_PLAYER_NAME];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
GetPlayerName(playerid, playername, sizeof(playername));
// printf("[login] [%s] %s", playername, inputtext[0]);
if(strlen(playername) == 3)
{
if(strcmp(playername, "Smo", true) == 0)
{
return 0;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Sorry, that name is too short, please change it.");
Kick(playerid);
return 1;
}
}
Encrypt(tmppass);
OnPlayerLogin(playerid,tmppass);
}
else
{
DisplayDialogForPlayer(playerid, 1); //login
}
}
Thats my login code. I changed the DisplayDialogForPlayer(playerid, 1); which SpawnPlayer(playerid); but that doesn't work at all.
Re: [Help] Auto Spawn after login -
pater - 31.10.2010
Try to add this:
pawn Код:
TogglePlayerSpectating(playerid, 0);
it worked for me :P
Re: [Help] Auto Spawn after login -
Mean - 31.10.2010
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
SpawnPlayer(playerid);
return 1;
}
Re: [Help] Auto Spawn after login -
jm2rock - 31.10.2010
Neither of them work for some reason. Here is my code.
Код:
public OnPlayerRequestClass(playerid, classid)
{
if(IsPlayerNPC(playerid))
{
printf("NPC: OnPlayerRequestClass: %d", playerid);
return 1;
}
if(gPlayerLogged[playerid] == 0)
{
SpawnPlayer(playerid);
return 1;
}
SetupPlayerForClassSelection(playerid);
if(gPlayerSpawned[playerid] == 1)
{
if(PlayerInfo[playerid][pMember] > 0 || PlayerInfo[playerid][pLeader] > 0 || PlayerInfo[playerid][pFMember] != 255)
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
}
else
{
PlayerInfo[playerid][pModel] = PedSkins[classid][0];
}
}
else
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
}
return 1;
}