[Help] Login before spawn problem
#1

Ok, so I have a problem with my current login system.
Let's take the userfile Samp.dudb as an example:
Код:
Password_Hash = xxxxx
Money = 491059
Skin = 105
Now, when I go in-game and I type '/login xxxxx' it will say 'Access granted' or something - but then I have to spawn by pushing SHIFT.
When I push shift I spawn with CJ's skin because of this:
pawn Код:
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
If I want the character to have skinID 105 I will have to spawn before I log in, but I don't want to have it like that. I want to be able to do '/login xxxxx' and then spawn without pushing SHIFT because I'll then have skinID 105.
How can I make something like this?
Reply
#2

After your login command you can use SpawnPlayer(playerid); to spawn them out of the character selection screen.

I think that's what your asking. If not, please reply.
Reply
#3

Spawning Without pressing "shift"?
try to do something
public OnPlayerRequestSpawn(playerid)
Reply
#4

Quote:
Originally Posted by borisblat
Spawning Without pressing "shift"?
try to do something
public OnPlayerRequestSpawn(playerid)
OnPlayerRequestSpawn(playerid) is called when the player presses shift. An example use is so if they are not logged in, it will deny them from spawning with shift. However if you want to spawn someone as soon as they login which is what I believe he is saying, you must use SpawnPlayer(playerid);
Reply
#5

Thank you, SpawnPlayer did work to spawn the logged in character, but it still won't change the skinID to 105, it's still CJ's skin.
pawn Код:
dcmd_login(playerid,params[]) {
  if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"Already authed.");
  if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account doesn't exist, please use '/register password'.");
  if (strlen(params)==0) return SystemMsg(playerid,"Correct usage: '/login password'");
  if (udb_CheckLogin(PlayerName(playerid),params)) {
    SpawnPlayer(playerid); <-- HERE'S SPAWNPLAYER
    GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
    SetPlayerSkin(playerid,dUserINT(PlayerName(playerid)).("skin"));
    PLAYERLIST_authed[playerid]=true;
    return SystemMsg(playerid,"Successfully authed!");
  }
  return SystemMsg(playerid,"Login failed!");
}
What's wrong here?
Reply
#6

Anyone who are able to help me out?
Reply
#7

you will probably have to make a skin purcasheing system with commands for example /buyskin id /sellskin id then /wearskin /unwearskin.
Reply
#8

Take out SpawnPlayer(playerid);

And go into OnPlayerRequestSpawn

add this under it,

pawn Код:
if(PLAYERLIST_authed[playerid] == 0)
{
SendClientMesssage(playerid,COLOR_RED,"You need to login before you spawn ! Use '/login <password>'");
return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)