Dying when I spawn. -
JoelR - 23.12.2012
I have a problem with spawning. When I log-in, I die.
The code for logging in can be found here:
pawn Код:
stock LoginPlayerData(playerid)
{
HasLoggedIn[playerid] = 1;
LoggedIn[playerid] = 1;
StatTimer[playerid] = SetTimerEx("StatSaveTimer", 3000, 1, "i", playerid);
SetPlayerScore(playerid, Player[playerid][Level]);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, Player[playerid][Money]);
TextDrawShowForPlayer(playerid, WebsiteTD);
if(Player[playerid][Watch] == 1)
{
TextDrawShowForPlayer(playerid, TimeTextDraw);
}
if(Player[playerid][SpawnLoc] == 0)
{
SetSpawnInfo(playerid, 0, Player[playerid][Clothes1], 1285.8728,167.2267,20.4670,49.3510, 0, 0, 0, 0, 0, 0);
}
else
{
SetSpawnInfo(playerid, 0, Player[playerid][Clothes1], Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ], Player[playerid][LastA], 0, 0, 0, 0, 0, 0);
}
SpawnPlayer(playerid);
SetPlayerHealth(playerid, 100);
SetPlayerSkin(playerid, Player[playerid][Clothes1]);
SetPlayerFightingStyle(playerid, Player[playerid][FightStyle]);
TTPTimer[playerid] = SetTimerEx("TotalTimePlayed", 60000, 1, "i", playerid);
LCTimer[playerid] = SetTimerEx("LastCheckTime", 60000, 1, "i", playerid);
HouseIDTimer[playerid] = SetTimerEx("HouseIDs", 100, 1, "i", playerid);
BusinessIDTimer[playerid] = SetTimerEx("BusinessIDs", 100, 1, "i", playerid);
LoadPlayerVehicles(playerid);
return 1;
}
The OnPlayerSpawn is here:
pawn Код:
public OnPlayerSpawn(playerid)
{
if(IsSpecing[playerid] == 1)
{
SetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]);
SetPlayerInterior(playerid,Inter[playerid]);
SetPlayerVirtualWorld(playerid,vWorld[playerid]);
IsSpecing[playerid] = 0;
IsBeingSpeced[spectatorid[playerid]] = 0;
}
else
{
new Float:health;
GetPlayerHealth(playerid, health);
if(health < 5)
{
SetPlayerHealth(playerid, 100);
}
GiveOwnedWeapons(playerid);
SetPlayerHealth(playerid, Player[playerid][Health]);
TogglePlayerControllable(playerid, 1);
}
if(!gPlayerAnimLibsPreloaded[playerid])
{
PreLoadNewAnimations(playerid);
}
TogglePlayerSpectating(playerid, 0);
return 1;
}
OnPlayerConnect is here:
pawn Код:
public OnPlayerConnect(playerid)
{
new string[512];
format(string, sizeof(string), "[Join]: %s has joined the server. {FFFFFF}IP: %s", RemoveUnderScore(playerid), GetIP(playerid));
SendToAdmins(GREY, string);
IsPlayerBanned(playerid);
ConnectData(playerid);
TogglePlayerSpectating(playerid, 1);
return 1;
}
If anybody has any idea what so-ever as to the problem, please notify me, thanks.
Re: Dying when I spawn. -
Riggster - 23.12.2012
Quote:
Originally Posted by JoelR
I have a problem with spawning. When I log-in, I die.
The code for logging in can be found here:
pawn Код:
stock LoginPlayerData(playerid) { HasLoggedIn[playerid] = 1; LoggedIn[playerid] = 1; StatTimer[playerid] = SetTimerEx("StatSaveTimer", 3000, 1, "i", playerid); SetPlayerScore(playerid, Player[playerid][Level]); ResetPlayerMoney(playerid); GivePlayerMoney(playerid, Player[playerid][Money]); TextDrawShowForPlayer(playerid, WebsiteTD); if(Player[playerid][Watch] == 1) { TextDrawShowForPlayer(playerid, TimeTextDraw); } if(Player[playerid][SpawnLoc] == 0) { SetSpawnInfo(playerid, 0, Player[playerid][Clothes1], 1285.8728,167.2267,20.4670,49.3510, 0, 0, 0, 0, 0, 0); } else { SetSpawnInfo(playerid, 0, Player[playerid][Clothes1], Player[playerid][LastX], Player[playerid][LastY], Player[playerid][LastZ], Player[playerid][LastA], 0, 0, 0, 0, 0, 0); } SpawnPlayer(playerid); SetPlayerHealth(playerid, 100); SetPlayerSkin(playerid, Player[playerid][Clothes1]); SetPlayerFightingStyle(playerid, Player[playerid][FightStyle]);
TTPTimer[playerid] = SetTimerEx("TotalTimePlayed", 60000, 1, "i", playerid); LCTimer[playerid] = SetTimerEx("LastCheckTime", 60000, 1, "i", playerid); HouseIDTimer[playerid] = SetTimerEx("HouseIDs", 100, 1, "i", playerid); BusinessIDTimer[playerid] = SetTimerEx("BusinessIDs", 100, 1, "i", playerid); LoadPlayerVehicles(playerid); return 1; }
The OnPlayerSpawn is here:
pawn Код:
public OnPlayerSpawn(playerid) { if(IsSpecing[playerid] == 1) { SetPlayerPos(playerid,SpecX[playerid],SpecY[playerid],SpecZ[playerid]); SetPlayerInterior(playerid,Inter[playerid]); SetPlayerVirtualWorld(playerid,vWorld[playerid]); IsSpecing[playerid] = 0; IsBeingSpeced[spectatorid[playerid]] = 0; } else { new Float:health; GetPlayerHealth(playerid, health); if(health < 5) { SetPlayerHealth(playerid, 100); } GiveOwnedWeapons(playerid); SetPlayerHealth(playerid, Player[playerid][Health]); TogglePlayerControllable(playerid, 1); } if(!gPlayerAnimLibsPreloaded[playerid]) { PreLoadNewAnimations(playerid); } TogglePlayerSpectating(playerid, 0); return 1; }
OnPlayerConnect is here:
pawn Код:
public OnPlayerConnect(playerid) { new string[512]; format(string, sizeof(string), "[Join]: %s has joined the server. {FFFFFF}IP: %s", RemoveUnderScore(playerid), GetIP(playerid)); SendToAdmins(GREY, string); IsPlayerBanned(playerid); ConnectData(playerid); TogglePlayerSpectating(playerid, 1); return 1; }
If anybody has any idea what so-ever as to the problem, please notify me, thanks.
|
Do you have your servers gravity up at a high amount?
Re: Dying when I spawn. -
JoelR - 23.12.2012
I have nothing in the script or anywhere else defining the gravity?
Re: Dying when I spawn. -
[HiC]TheKiller - 23.12.2012
pawn Код:
SetPlayerHealth(playerid, Player[playerid][Health]);
Under OnPlayerSpawn is probably going to be 0. Make sure you set that to a value or take it out.
Re: Dying when I spawn. -
Threshold - 24.12.2012
Most recommended, you use Player[playerid][Health] = 100; under your login code.