SA-MP Forums Archive
Huge problem - 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: Huge problem (/showthread.php?tid=109388)



Huge problem - tomnidi - 19.11.2009

Everytime I die, I spawn with a CJ skin.
I don't know why's that problem, but I remember that before I changed it to 0.3a it wasn't a problem.
Someone can assist me fixing it? What publics and commands should I show you here?
Thanks.


Re: Huge problem - miokie - 19.11.2009

What gamemode are you using?


Re: Huge problem - yom - 19.11.2009

CJ is skin id 0, so this is probably a variable problem witch doesn't have correct skinid value, if you ever do SetPlayerSkin under OnPlayerSpawn, or similar.


Re: Huge problem - Sfinx_17 - 19.11.2009

ok but before you spawn with cj skin what skin you have?


Re: Huge problem - yom - 19.11.2009

Sorry?

You should show us your script, or if you don't want to, just debug your script! It's easy and will help you to understand and solve your problems by yourself Debugging mean, keep traces of variables's values, isolate the problem, then solve it.

We can't help you more if we don't see your code. And NO, i'm not trying to steal your code or ideas, i'm here to help people if i can, but again that's not that easy without any code.


Re: Huge problem - Sfinx_17 - 20.11.2009

tomnidi..show me the OneGameModeInit


Re: Huge problem - tomnidi - 20.11.2009

Well, I didn't want to post here all the script, but if you will tell me what to post I will.
The problem is that I changed nothing after I moved to samp 0.3, and when I was using samp 0.2x it wasn't a problem.
Is there an Spawn function that have been removed on samp 0.3a?
This problem happens only if I die. If I first time spawn, I have the normal skin. If I relog, I still have the normal skin..
Right after I spawn after a death, I'm not spawning with my normal skin and I get skin ID 0.


Re: Huge problem - hipy - 20.11.2009

Then you must be doing OnPlayerDeath that causes the skin to change.


Re: Huge problem - dice7 - 20.11.2009

And OnPlayerSpawn


Re: Huge problem - tomnidi - 20.11.2009

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	new string[128];
	if(IsPlayerConnected(killerid))
	{
	  if(killerid != playerid)
	  {
	   	if(AdminDuty[playerid])
		  {
		    if(!AdminDuty[killerid])
		    {
					KickPlayer(killerid,"System","Killing an administrator on duty with abuse.");
					format(string, sizeof(string), "[INFO:] System has kicked %s, Reason: Killing an administrator on duty with abuse. ", PlayerName(killerid));
					KickLog(string);
				}
		  }
	  	SetPlayerWantedLevelEx(killerid,GetPlayerWantedLevelEx(playerid)+1);
	  }
	}
	return 1;
}
Код:
public OnPlayerSpawn(playerid)
{
	if(gPlayerLogged[playerid])
	{
		  SetPlayerSpawn(playerid);
	    Spawned[playerid] = 1;
	}
	return 1;
}
Код:
public SetPlayerSpawn(playerid)
{
	if(IsPlayerConnected(playerid))
	{
    if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 3 || PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 9)
	  {
	  OnDuty[playerid] = 1;
	  }

	  if(PlayerInfo[playerid][pCrashed])
		{
		  SetPlayerPos(playerid,PlayerInfo[playerid][pCrashX],PlayerInfo[playerid][pCrashY],PlayerInfo[playerid][pCrashZ]);
		  SetPlayerInterior(playerid,PlayerInfo[playerid][pCrashInt]);
			SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pCrashW]);
			PlayerInfo[playerid][pCrashed] = 0;
			GameTextForPlayer(playerid, "~r~Crashed...~n~~g~Returning to previous position.", 7000, 6);

			if(PlayerInfo[playerid][pSex] == 1)
			{
				PlayerLocalMessage(playerid,15.0,"was set back to his previous position.");
			}
			else
			{
			  PlayerLocalMessage(playerid,15.0,"was set back to her previous position.");
			}
			return 1;
		}
	  if(AdminDuty[playerid])
	  {
	  	SetPlayerColor(playerid,COLOR_ADMINDUTY);
			SetPlayerHealth(playerid,99999);
			SetPlayerArmour(playerid,99999);
	  }
	  if(PlayerInfo[playerid][pFaction] != 255)
	  {
			SetPlayerToFactionColor(playerid);
			SetPlayerToFactionSkin(playerid);
			SetPlayerInterior(playerid, 0);
   	}
  		if(PlayerInfo[playerid][pJailed] == 1)
		{
		  SetPlayerVirtualWorld(playerid,2); //BUILDING ID 2, MAKE SURE PD IS ID 2
		  SetPlayerInterior(playerid, 6);
			SetPlayerPos(playerid,263.9933,77.0126,1001.0391);
			SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You havn't finished your jail time!");
			return 1;
		}
	  new house = PlayerInfo[playerid][pHouseKey];
  		if(house != 255)
		{
		  if(PlayerInfo[playerid][pSpawnPoint])
		  {
				SetPlayerInterior(playerid,Houses[house][ExitInterior]);
				SetPlayerPos(playerid, Houses[house][ExitX], Houses[house][ExitY],Houses[house][ExitZ]);
				SetPlayerVirtualWorld(playerid,house);
  			return 1;
			}
		}
 		if(PlayerInfo[playerid][pFaction] != 255)
		{
		  if(PlayerInfo[playerid][pSpawnPoint] == 0)
		  {
				SetPlayerPos(playerid,DynamicFactions[PlayerInfo[playerid][pFaction]][fX],DynamicFactions[PlayerInfo[playerid][pFaction]][fY],DynamicFactions[PlayerInfo[playerid][pFaction]][fZ]);
				SetPlayerInterior(playerid,0);
				SetPlayerVirtualWorld(playerid,0);
        if(PlayerInfo[playerid][pDonateRank] > 0)
			{
				if (PlayerInfo[playerid][pGun1] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun1], PlayerInfo[playerid][pAmmo1]);
					PlayerInfo[playerid][pGun1] = 0; PlayerInfo[playerid][pAmmo1] = 0;
					SetPlayerInterior(playerid, 0);
				}
				if (PlayerInfo[playerid][pGun2] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun2], PlayerInfo[playerid][pAmmo2]);
					PlayerInfo[playerid][pGun2] = 0; PlayerInfo[playerid][pAmmo2] = 0;
					SetPlayerInterior(playerid, 0);
				}
				if (PlayerInfo[playerid][pGun3] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun3], PlayerInfo[playerid][pAmmo3]);
					PlayerInfo[playerid][pGun3] = 0; PlayerInfo[playerid][pAmmo3] = 0;
					SetPlayerInterior(playerid, 0);
				}
				if (PlayerInfo[playerid][pGun4] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun4], PlayerInfo[playerid][pAmmo4]);
					PlayerInfo[playerid][pGun4] = 0; PlayerInfo[playerid][pAmmo4] = 0;
					SetPlayerInterior(playerid, 0);
				}
			}
			else
			{
			  if (PlayerInfo[playerid][pGun1] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun1], PlayerInfo[playerid][pAmmo1]);
					PlayerInfo[playerid][pGun1] = 0; PlayerInfo[playerid][pAmmo1] = 0;
					SetPlayerInterior(playerid, 0);
				}
				if (PlayerInfo[playerid][pGun2] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun2], PlayerInfo[playerid][pAmmo2]);
					PlayerInfo[playerid][pGun2] = 0; PlayerInfo[playerid][pAmmo2] = 0;
					SetPlayerInterior(playerid, 0);
				}
			}
				return 1;
			}
		}
	  else
	  {
		  //====================[Setting Civilian Position]==========================
			SetPlayerPos(playerid,CivilianSpawn[X],CivilianSpawn[Y],CivilianSpawn[Z]);
			SetPlayerVirtualWorld(playerid, CivilianSpawn[World]);
			SetPlayerInterior(playerid, 0);
			SetPlayerFacingAngle(playerid,CivilianSpawn[Angle]);
      if(PlayerInfo[playerid][pDonateRank] > 0)
			{
				if (PlayerInfo[playerid][pGun1] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun1], PlayerInfo[playerid][pAmmo1]);
					PlayerInfo[playerid][pGun1] = 0; PlayerInfo[playerid][pAmmo1] = 0;
				}
				if (PlayerInfo[playerid][pGun2] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun2], PlayerInfo[playerid][pAmmo2]);
					PlayerInfo[playerid][pGun2] = 0; PlayerInfo[playerid][pAmmo2] = 0;
				}
				if (PlayerInfo[playerid][pGun3] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun3], PlayerInfo[playerid][pAmmo3]);
					PlayerInfo[playerid][pGun3] = 0; PlayerInfo[playerid][pAmmo3] = 0;
				}
				if (PlayerInfo[playerid][pGun4] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun4], PlayerInfo[playerid][pAmmo4]);
					PlayerInfo[playerid][pGun4] = 0; PlayerInfo[playerid][pAmmo4] = 0;
				}
			}
			else
			{
			  if (PlayerInfo[playerid][pGun1] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun1], PlayerInfo[playerid][pAmmo1]);
					PlayerInfo[playerid][pGun1] = 0; PlayerInfo[playerid][pAmmo1] = 0;
				}
				if (PlayerInfo[playerid][pGun2] > 0)
				{
					GivePlayerWeapon(playerid, PlayerInfo[playerid][pGun2], PlayerInfo[playerid][pAmmo2]);
					PlayerInfo[playerid][pGun2] = 0; PlayerInfo[playerid][pAmmo2] = 0;
				}
			}
			//=========================================================================
			return 1;
		}
	}
	return 1;
}
Anyone?