16.01.2011, 22:35
Well, I got a wierd problem with my player spawning.
When I spawn at first, soon as I log into the server, it spawns me by my skin, and in my current position.
Right after I die, it sets my skin to 0 and spawns me at the same place I died, witch it should not do!
If I die again, it pops up a message of "stay within the world bounds", and crashes my game.
This is my OnPlayerSpawn public:
OnPlayerDeath:
OnPlayerConnect:
And the right code witch I call when I log in:
Can anybody help me please?
When I spawn at first, soon as I log into the server, it spawns me by my skin, and in my current position.
Right after I die, it sets my skin to 0 and spawns me at the same place I died, witch it should not do!
If I die again, it pops up a message of "stay within the world bounds", and crashes my game.
This is my OnPlayerSpawn public:
Код:
public OnPlayerSpawn(playerid)
{
if(GetPVarInt(playerid, "Newbie") == 1)
{
GivePlayerCash(playerid, 5000);
SetPlayerScore(playerid, 1);
SetPlayerSkin(playerid, random(299));
SetPlayerPos(playerid, -2706.5261, 397.7129, 4.3672);
DeletePVar(playerid, "Newbie");
}
else if(GetPVarInt(playerid, "JustLogged") == 1)
{
GivePlayerCash(playerid, pStats[playerid][pMoney]);
SetPlayerScore(playerid, pStats[playerid][pScore]);
SetPlayerSkin(playerid, pStats[playerid][pSkin]);
SetPlayerPos(playerid, pStats[playerid][pPosX], pStats[playerid][pPosY], pStats[playerid][pPosZ]+3);
DeletePVar(playerid, "JustLogged");
}
else if(GetPVarInt(playerid, "JustDied") == 1)
{
SetPlayerPos(playerid, -2706.5261, 397.7129, 4.3672);
SetPlayerSkin(playerid, pStats[playerid][pSkin]);
DeletePVar(playerid, "JustDied");
}
return 1;
}
Код:
SendDeathMessage(killerid, playerid, reason);
SetPVarInt(playerid, "JustDied", 1);
pStats[playerid][pSkin] = GetPlayerSkin(playerid);
pStats[playerid][pDeaths] += 1;
pStats[killerid][pKills] += 1;
Код:
public OnPlayerConnect(playerid)
{
new string[128];
format(string, sizeof(string), "* %s(%d) has joined the server.", GetName(playerid), playerid);
SendClientMessageToAll(COLOR_GREY, string);
SetPlayerColor(playerid, COLOR_GREY);
TogglePlayerSpectating(playerid, true);
InitPlayerConnection(playerid);
SetPlayerPos(playerid,-2706.5261, 397.7129, 4.3672);
return 1;
}
Код:
SetPVarInt(playerid, "Authentication", 1);
SetPVarInt(playerid, "JustLogged", 1);
LoadAccountVariables(playerid);
pStats[playerid][pLogins] += 1;
SetPlayerColor(playerid, COLOR_WHITE);
TogglePlayerSpectating(playerid, 0);
SetSpawnInfo(playerid, 0, pStats[playerid][pSkin], pStats[playerid][pPosX], pStats[playerid][pPosY], pStats[playerid][pPosZ], 0.0, 0, 0, 0, 0, 0, 0);
SpawnPlayer(playerid);

