OnPlayerDeath - Forced SkinSelection problem.
#1

Hello there.

After working on my server, i've stumbled upon a weird, but annoying problem.

Basicly, if you die, you get forced into the "SkinSelection" menu, but the wierd problem is; The script does not force you into this menu.

It's also not caused by the OnPlayerDeath function, as this does almost nothing as you can see below;

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	GetPlayerWeaponData(playerid, 1, Player[playerid][Weapon1], Player[playerid][Weapon1a]);
	GetPlayerWeaponData(playerid, 2, Player[playerid][Weapon2], Player[playerid][Weapon2a]);
	GetPlayerWeaponData(playerid, 3, Player[playerid][Weapon3], Player[playerid][Weapon3a]);
	GetPlayerWeaponData(playerid, 4, Player[playerid][Weapon4], Player[playerid][Weapon4a]);
	GetPlayerWeaponData(playerid, 5, Player[playerid][Weapon5], Player[playerid][Weapon5a]);
	GetPlayerWeaponData(playerid, 6, Player[playerid][Weapon6], Player[playerid][Weapon6a]);
	GetPlayerWeaponData(playerid, 7, Player[playerid][Weapon7], Player[playerid][Weapon7a]);
	GetPlayerWeaponData(playerid, 8, Player[playerid][Weapon8], Player[playerid][Weapon8a]);
	playerdied[playerid] = 1;
	//Debug MSG
	SendClientMessageToAll(GREY, "Debug: OnPlayerDeath called.");
 	return 1;
}
As you can see there, nothing is wrong with the function as the only thing it does, is save the current weapons that player had before they died, and to add a variable, to put them into the hospital later at "OnPlayerSpawn", but that's where the problem comes in...

Before the "OnPlayerSpawn" function gets called, you get forced into the SkinSelection screen, if you click spawn, you'll be put in the hospital, but eventually will have the CJ Skin.

Here's the screenshot of what I mean. Screenshot

I have already asked countless of people, but they also don't seem to know whats going on, so here I am.
Asking the SA:MP Community.

Regards,
Tessa.
Reply
#2

I think it has something to do with

pawn Код:
public OnPlayerRequestClass(playerid, classid)
Maybe try adding some variable like:

pawn Код:
enum pInfo {

bool:FirstSpawn,

}

new Player[MAX_PLAYERS][pInfo];
Then

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
         if(Player[playerid][FirstSpawn] == 1)
         {
               //Your code here
         }
         else if(Player[playerid][FirstSpawn] == 0)
         {
               //Your code here
          }
          return 1;
}

On your register dialog, Just add

pawn Код:
Player[playerid][FirstSpawn] = 1;
Reply
#3

Well, I tried looking into that aswell, but I don't have the "Public OnPlayerRequestClass" function in my script, I removed it as I don't use it.

However, I do already use the FirstSpawn, and that all works like it should.
The forced Class selection, only occurs when a player dies.
Reply
#4

Alright, so after some playing around, I tought I fixed it but, it was only a temporary solution wich doesn't seem to fix it.

Код:
public OnPlayerRequestClass(playerid, classid)
{
		  SpawnPlayer(playerid);
		  SetPlayerSkin(playerid, Player[playerid][Clothes1]);
          return 1;
}
The player now doesn't have to click the spawn button in order to continue playing, but this also creates more trouble.
As known by default, it sometimes gives player random objects when using SpawnPlayer and secondly...
I have an option, if you have a weapon license that you recieve your weapons after you get tossed out of the hospital. This worked before and now, this also no longer works due to the error said in my first post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)