Skins keep spawning into CJ.
#1

Alright, me and a friend are making an roleplay mode, completly from scratch.. For some reason when they /register and spawn it takes them to CJ skin, Any ideas..?
Reply
#2

We hardly have any information to work with. Did you attempt a skin saving function? Did you create different classes at all?
Reply
#3

In most cases, the skin is being set before it's being loaded from a file. That may be your problem.
Reply
#4

it's my script as well, i set the enum PlayerInfo[playerid][pSkin] to = 22; then I use a self created function called SetSpawnParameters(playerid), which does SetSpawnInfo(playerid,0,PlayerInfo[playerid][pSkin],blah,blah,blah) and when I finish that with SpawnPlayer(playerid) he spawns as CJ
Reply
#5

what happens if you replace PlayerInfo[playerid][pSkin] with 22?
Reply
#6

The solution you use to give players skin they want should work logically, if there isn't any problem with SA-MPs own code.
Try adding this to the start of your SetSpawnParameters function:
Код:
printf("Skin: %i", PlayerInfo[playerid][pSkin]);
( Or you can also use SendClientMessage(ToAll) or something. But it's good to get used with debuging in console, there are problems that crash the server, DC you etc. so you know what to do in every case )
If this returns correct skin to console (22 in your case), it is probably SA-MPs bug and you should find another method to do what you need.
However if it returns 0, then the problem is elsewhere. You need to check the code where you assign value to PlayerInfo[playerid][pSkin].

If PlayerInfo[playerid][pSkin] is assigned correctly and it still doesn't work you need to think about other possible solutions. for example:
Код:
public OnPlayerSpawn(playerid)
{
	SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
	return 1;
}
Reply
#7

Does it save your skin?
Reply
#8

Код:
dcmd_register(playerid,params[])
{
 new file[MAX_NAME],pass[15];
 pName = GetPlayerNameEx(playerid);
 format(file, sizeof(file), "%s.ini", pName);
 if(dini_Exists(file)) return SendClientMessage(playerid,COLOR_GREY,"SERVER: This account is already registered!");
 else if(sscanf(params,"s",pass)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /register [password]");
 else
 {
	dini_Create(file);
	format(str, MAX_STRING,"SERVER: You have registered the name %s with the password %s, you may now login", pName, pass);
  SendClientMessage(playerid, COLOR_GREY, str);
  PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
  PlayerInfo[playerid][pAdmin] = 0;
	PlayerInfo[playerid][pPhone] = 0;
	PlayerInfo[playerid][pPhonebook] = 0;
	PlayerInfo[playerid][pKills] = 0;
	PlayerInfo[playerid][pDeaths] = 0;
	PlayerInfo[playerid][pSuicides] = 0;
	PlayerInfo[playerid][pCash] = 0;
	PlayerInfo[playerid][pSkin] = 22;
	PlayerInfo[playerid][pTeam] = 0;
	PlayerInfo[playerid][pRank] = 0;
	PlayerInfo[playerid][pCked] = 0;
	PlayerInfo[playerid][pDrugs] = 0;
	PlayerInfo[playerid][pMuted] = 0;
  dini_Set(file,"Password", pass);
  dini_IntSet(file,"Cash",PlayerInfo[playerid][pCash]);
  dini_IntSet(file,"Kills",PlayerInfo[playerid][pKills]);
  dini_IntSet(file,"Deaths",PlayerInfo[playerid][pDeaths]);
  dini_IntSet(file,"AdminLevel",PlayerInfo[playerid][pAdmin]);
  dini_IntSet(file,"Phone",PlayerInfo[playerid][pPhone]);
  dini_IntSet(file,"Phonebook",PlayerInfo[playerid][pPhonebook]);
  dini_IntSet(file,"Suicides",PlayerInfo[playerid][pSuicides]);
  dini_IntSet(file,"Skin",PlayerInfo[playerid][pSkin]);
  dini_IntSet(file,"Team",PlayerInfo[playerid][pTeam]);
  dini_IntSet(file,"Drugs",PlayerInfo[playerid][pDrugs]);
  dini_IntSet(file,"Rank",PlayerInfo[playerid][pRank]);
  dini_IntSet(file,"Muted",PlayerInfo[playerid][pMuted]);
  dini_IntSet(file,"Cked",PlayerInfo[playerid][pCked]);
  return 1;
 }
}
dcmd_login(playerid,params[])
{
 new file[128],pass[128],rPass[128];
 pName = GetPlayerNameEx(playerid);
 if(sscanf(params,"s",pass)) return SendClientMessage(playerid,COLOR_GREY,"USAGE: /login [password]");
 else if(PlayerInfo[playerid][pLogged] == 1) return SendClientMessage(playerid,COLOR_GREY,"SERVER: You are already logged in !");
 format(rPass, 128, "%s", dini_Get(file, "Password"));
 if(strcmp(rPass,pass,false) != 0) return SendClientMessage(playerid,COLOR_GREY,"SERVER: The password you specified is wrong.");
 else
 {
	PlayerInfo[playerid][pLogged] = 1;
	PlayerInfo[playerid][pCash] = dini_Int(file,"Cash");
  PlayerInfo[playerid][pKills] = dini_Int(file,"Kills");
  PlayerInfo[playerid][pDeaths] = dini_Int(file,"Deaths");
  PlayerInfo[playerid][pAdmin] = dini_Int(file,"AdminLevel");
  PlayerInfo[playerid][pPhone] = dini_Int(file,"Phone");
  PlayerInfo[playerid][pPhonebook] = dini_Int(file,"Phonebook");
  PlayerInfo[playerid][pSuicides] = dini_Int(file,"Suicides");
  PlayerInfo[playerid][pSkin] = dini_Int(file,"Skin");
  PlayerInfo[playerid][pTeam] = dini_Int(file,"Team");
  PlayerInfo[playerid][pDrugs] = dini_Int(file,"Drugs");
  PlayerInfo[playerid][pRank] = dini_Int(file,"Rank");
  PlayerInfo[playerid][pMuted] = dini_Int(file,"Muted");
  PlayerInfo[playerid][pCked] = dini_Int(file,"Cked");
  SendClientMessage(playerid,COLOR_GREY,"SERVER: You have sucessfully logged in!");
  SetPlayerSpawnParams(playerid);
  SpawnPlayer(playerid);
  return 1;
 }
}
and my SetPlayerSpawnParams

Код:
stock SetPlayerSpawnParams(playerid)
{
 if(PlayerInfo[playerid][pTeam] == 0)
 {
	SetSpawnInfo(playerid,0,PlayerInfo[playerid][pSkin],2231.0486,-1169.2207,25.7749,0,0,0,0,0,0,0);
 }
 else if(PlayerInfo[playerid][pTeam] == 1)
 {
  SetSpawnInfo(playerid,1,PlayerInfo[playerid][pSkin],2231.0486,-1169.2207,25.7749,0,0,0,0,0,0,0);
 }
 else if(PlayerInfo[playerid][pTeam] == 2)
 {
  SetSpawnInfo(playerid,2,PlayerInfo[playerid][pSkin],2231.0486,-1169.2207,25.7749,0,0,0,0,0,0,0);
 }
 else if(PlayerInfo[playerid][pTeam] == 3)
 {
  SetSpawnInfo(playerid,3,PlayerInfo[playerid][pSkin],2231.0486,-1169.2207,25.7749,0,0,0,0,0,0,0);
 }
 else if(PlayerInfo[playerid][pTeam] == 4)
 {
  SetSpawnInfo(playerid,1,PlayerInfo[playerid][pSkin],2231.0486,-1169.2207,25.7749,0,0,0,0,0,0,0);
 }
 else if(PlayerInfo[playerid][pTeam] == 5)
 {
  SetSpawnInfo(playerid,5,PlayerInfo[playerid][pSkin],2231.0486,-1169.2207,25.7749,0,0,0,0,0,0,0);
 }
 return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)