23.12.2012, 22:18
I have a problem with spawning. When I log-in, I die.
The code for logging in can be found here:
The OnPlayerSpawn is here:
OnPlayerConnect is here:
If anybody has any idea what so-ever as to the problem, please notify me, thanks.
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;
}
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;
}
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;
}