29.10.2009, 17:46
Here's my OnPlayerSpawn..
Well, the problem is: Sometimes it attaches the label, and other times, it doesn't.. It has something to do with not attaching whilst spawning. (I have a position saving script)
pawn Code:
public OnPlayerSpawn(playerid)
{
new string[128];
new spawnrand = random(sizeof(HospitalSpawns));
if(SInfo[playerid][Admin] > 0)
{
format(string, sizeof(string), "Administrator LVL: %d", SInfo[playerid][Admin]);
lol[playerid] = Create3DTextLabel(string, red, 0,0,0, 40.0, 0, 1);
GetPlayerPos(playerid, X, Y, Z);
Attach3DTextLabelToPlayer(lol[playerid], playerid, X, Y, Z+0.3);
}
if(Died[playerid] == 1)
{
SendClientMessage(playerid, orange, "You have been critically injured, $100 dollars has been taken for your hospital bill.");
SGivePlayerMoney(playerid, -100);
SetPlayerSkin(playerid,SInfo[playerid][Skin]);
SetPlayerPos(playerid,HospitalSpawns[spawnrand][0],HospitalSpawns[spawnrand][1],HospitalSpawns[spawnrand][2]);
SetPlayerFacingAngle(playerid,HospitalSpawns[spawnrand][3]);
Died[playerid]=0;
}
SetPlayerSkin(playerid, SInfo[playerid][Skin]);
SetPlayerArmour(playerid, 100);
SetPlayerHealth(playerid, 100);
GivePlayerWeapon(playerid, 22, 999999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 1);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 200);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 200);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, SInfo[playerid][Interior]);
TogglePlayerControllable(playerid, 1);
return 1;
}