I can't spawn on my new server
#1

[spoiler][/spoiler]

I have just created a RP server, extracting the register system from some tutorials, registration works well and players are saved in "Users" folder. But when I write the password successfully, my body is strange and my character doesn't appear at the Airport, what could the reason be?
Reply
#2

Why dont you show us your onplayerspawn code...
Reply
#3

Код:
public OnPlayerSpawn(playerid)
{
    TogglePlayerSpectating(playerid, 0);
    AddPlayerClass(PlayerInfo[playerid][Skin], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z] + 0.15, 0, 0, 0, 0, 0, 0, 0);
    SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
    if(PlayerInfo[playerid][Certificated] == 1) // if it's the first connection of the new player, previously a certificator created his account
    {
    SetPlayerPos(playerid, 1642.4110, -2335.0168, -2.6797); // ls airport
    PlayerInfo[playerid][Certificated] = 2; // he won't respawn at the airport anymore, now in hist last position
    }
    SetPlayerPos(playerid, PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
    TogglePlayerControllable(playerid, 1);
	return 1;
}
Reply
#4

Delete the first line qns try again.
Reply
#5

PHP код:
TogglePlayerSpectating(playerid0); 
after you logged in.
Reply
#6

BloodyRP, what do you mean? Sorry

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Delete the first line qns try again.
it doesn't work yet
Reply
#7

I got it! I put "TogglePlayerSpectating(playerid, 0);" on a callback called LoginAccount but there still is a problem, my character appears in Blueberry instead of airport.

Код:
public LoginAccount(playerid,password[])
{
    new string2[64];
	new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
	format(string2, sizeof(string2), "Users/%s.ini", playername2);
	new File: UserFile = fopen(string2, io_read);
	if ( UserFile )
	{
	    new PassData[256];
	    new keytmp[256], valtmp[256];
	    fread( UserFile , PassData , sizeof( PassData ) );
	    keytmp = ini_GetKey( PassData );
	    if( strcmp( keytmp , "Password" , true ) == 0 )
		{
			valtmp = ini_GetValue( PassData );
			strmid(PlayerInfo[playerid][Password], valtmp, 0, strlen(valtmp)-1, 255);
		}
		if(strcmp(PlayerInfo[playerid][Password],password, true ) == 0 )
		{
            new key[ 256 ] , val[ 256 ];
            new Data[ 256 ];
            while ( fread( UserFile , Data , sizeof( Data ) ) )
		    {
		        key = ini_GetKey( Data );
		        if( strcmp( key , Certificated" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Certificated] = strval( val ); }
	    	    if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Bank] = strval( val ); }
	    	    if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Money] = strval( val ); }
    	        if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Level] = strval( val ); }
	    	    if( strcmp( key , "Hoursplayed" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Hoursplayed] = strval( val ); }
	    	    if( strcmp( key , "Sex" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Sex] = strval( val ); }
	    	    if( strcmp( key , "Age" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Age] = strval( val ); }
	    	    if( strcmp( key , "Pos_x" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPos_x] = floatstr( val ); }
                if( strcmp( key , "Pos_y" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPos_y] = floatstr( val ); }
	            if( strcmp( key , "Pos_z" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPos_z] = floatstr( val ); }
	            if( strcmp( key , "Interior" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Interior] = strval( val ); }
	            if( strcmp( key , "Vw" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Vw] = strval( val ); }
	            if( strcmp( key , "Skin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Skin] = strval( val ); }
	            if( strcmp( key , "Job" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Job] = strval( val ); }
	            if( strcmp( key , "Vk" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Vk] = strval( val ); }
	            if( strcmp( key , "Vk2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][Vk2] = strval( val ); }
                }
                fclose(UserFile);
           }
      else
	  {
                new loginstring[128];
				new loginname[64];
				GetPlayerName(playerid,loginname,sizeof(loginname));
				format(loginstring,sizeof(loginstring),"Wrong password\nYou can try it again",loginname);
				ShowPlayerDialog(playerid,3,DIALOG_STYLE_PASSWORD,"Send",loginstring,"Send","Exit");
				PasswordAttemps[playerid] += 1;
				if(PasswordAttemps[playerid] == 3) { Kick(playerid); }
	        return 1;
		}
	TogglePlayerSpectating(playerid, 0);
   SpawnPlayer(playerid);
   SetPlayerColor(playerid,PLAYER_COLOR);
   SetPlayerScore(playerid,PlayerInfo[playerid][Level]);
   GivePlayerMoney(playerid,PlayerInfo[playerid][Money]);
   SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 100);
   SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 100);
        PreloadAnimLib(playerid,"AIRPORT");
        PreloadAnimLib(playerid,"ATTRACTORS");
        PreloadAnimLib(playerid,"BAR");
		PreloadAnimLib(playerid,"BASEBALL");
		PreloadAnimLib(playerid,"BD_FIRE");
		PreloadAnimLib(playerid,"BEACH");
		PreloadAnimLib(playerid,"BENCHPRESS");
		PreloadAnimLib(playerid,"BF_INJECTION");
		PreloadAnimLib(playerid,"BIKED");
		PreloadAnimLib(playerid,"BIKEH");
		PreloadAnimLib(playerid,"BIKELEAP");
		PreloadAnimLib(playerid,"BIKES");
		PreloadAnimLib(playerid,"BIKEV");
		PreloadAnimLib(playerid,"BIKE_DBZ");
		PreloadAnimLib(playerid,"BMX");
		PreloadAnimLib(playerid,"BOMBER");
		PreloadAnimLib(playerid,"BOX");
		PreloadAnimLib(playerid,"BSKTBALL");
		PreloadAnimLib(playerid,"BUDDY");
		PreloadAnimLib(playerid,"BUS");
		PreloadAnimLib(playerid,"CAMERA");
		PreloadAnimLib(playerid,"CAR");
		PreloadAnimLib(playerid,"CARRY");
		PreloadAnimLib(playerid,"CAR_CHAT");
		PreloadAnimLib(playerid,"CASINO");
		PreloadAnimLib(playerid,"CHAINSAW");
		PreloadAnimLib(playerid,"CHOPPA");
		PreloadAnimLib(playerid,"CLOTHES");
		PreloadAnimLib(playerid,"COACH");
		PreloadAnimLib(playerid,"COLT45");
		PreloadAnimLib(playerid,"COP_AMBIENT");
		PreloadAnimLib(playerid,"COP_DVBYZ");
		PreloadAnimLib(playerid,"CRACK");
		PreloadAnimLib(playerid,"CRIB");
		PreloadAnimLib(playerid,"DAM_JUMP");
		PreloadAnimLib(playerid,"DANCING");
		PreloadAnimLib(playerid,"DEALER");
		PreloadAnimLib(playerid,"DILDO");
        PreloadAnimLib(playerid,"DODGE");
		PreloadAnimLib(playerid,"DOZER");
		PreloadAnimLib(playerid,"DRIVEBYS");
		PreloadAnimLib(playerid,"FAT");
		PreloadAnimLib(playerid,"FIGHT_B");
		PreloadAnimLib(playerid,"FIGHT_C");
		PreloadAnimLib(playerid,"FIGHT_D");
		PreloadAnimLib(playerid,"FIGHT_E");
		PreloadAnimLib(playerid,"FINALE");
		PreloadAnimLib(playerid,"FINALE2");
		PreloadAnimLib(playerid,"FLAME");
		PreloadAnimLib(playerid,"FLOWERS");
		PreloadAnimLib(playerid,"FOOD");
		PreloadAnimLib(playerid,"FREEWEIGHTS");
		PreloadAnimLib(playerid,"GANGS");
		PreloadAnimLib(playerid,"GHANDS");
		PreloadAnimLib(playerid,"GHETTO_DB");
		PreloadAnimLib(playerid,"GOGGLES");
		PreloadAnimLib(playerid,"GRAFFITI");
		PreloadAnimLib(playerid,"GRAVEYARD");
		PreloadAnimLib(playerid,"GRENADE");
		PreloadAnimLib(playerid,"GYMNASIUM");
		PreloadAnimLib(playerid,"HAIRCUTS");
		PreloadAnimLib(playerid,"HEIST9");
		PreloadAnimLib(playerid,"INT_HOUSE");
		PreloadAnimLib(playerid,"INT_OFFICE");
		PreloadAnimLib(playerid,"INT_SHOP");
		PreloadAnimLib(playerid,"JST_BUISNESS");
		PreloadAnimLib(playerid,"KART");
		PreloadAnimLib(playerid,"KISSING");
		PreloadAnimLib(playerid,"KNIFE");
		PreloadAnimLib(playerid,"LAPDAN1");
		PreloadAnimLib(playerid,"LAPDAN2");
		PreloadAnimLib(playerid,"LAPDAN3");
		PreloadAnimLib(playerid,"LOWRIDER");
		PreloadAnimLib(playerid,"MD_CHASE");
		PreloadAnimLib(playerid,"MD_END");
		PreloadAnimLib(playerid,"MEDIC");
		PreloadAnimLib(playerid,"MISC");
		PreloadAnimLib(playerid,"MTB");
		PreloadAnimLib(playerid,"MUSCULAR");
		PreloadAnimLib(playerid,"NEVADA");
		PreloadAnimLib(playerid,"ON_LOOKERS");
		PreloadAnimLib(playerid,"OTB");
		PreloadAnimLib(playerid,"PARACHUTE");
		PreloadAnimLib(playerid,"PARK");
		PreloadAnimLib(playerid,"PAULNMAC");
		PreloadAnimLib(playerid,"PED");
		PreloadAnimLib(playerid,"PLAYER_DVBYS");
		PreloadAnimLib(playerid,"PLAYIDLES");
		PreloadAnimLib(playerid,"POLICE");
		PreloadAnimLib(playerid,"POOL");
		PreloadAnimLib(playerid,"POOR");
		PreloadAnimLib(playerid,"PYTHON");
		PreloadAnimLib(playerid,"QUAD");
		PreloadAnimLib(playerid,"QUAD_DBZ");
		PreloadAnimLib(playerid,"RAPPING");
		PreloadAnimLib(playerid,"RIFLE");
		PreloadAnimLib(playerid,"RIOT");
		PreloadAnimLib(playerid,"ROB_BANK");
		PreloadAnimLib(playerid,"ROCKET");
		PreloadAnimLib(playerid,"RUSTLER");
		PreloadAnimLib(playerid,"RYDER");
		PreloadAnimLib(playerid,"SCRATCHING");
		PreloadAnimLib(playerid,"SHAMAL");
		PreloadAnimLib(playerid,"SHOP");
		PreloadAnimLib(playerid,"SHOTGUN");
		PreloadAnimLib(playerid,"SILENCED");
		PreloadAnimLib(playerid,"SKATE");
		PreloadAnimLib(playerid,"SMOKING");
		PreloadAnimLib(playerid,"SNIPER");
		PreloadAnimLib(playerid,"SPRAYCAN");
		PreloadAnimLib(playerid,"STRIP");
		PreloadAnimLib(playerid,"SUNBATHE");
		PreloadAnimLib(playerid,"SWAT");
		PreloadAnimLib(playerid,"SWEET");
		PreloadAnimLib(playerid,"SWIM");
		PreloadAnimLib(playerid,"SWORD");
		PreloadAnimLib(playerid,"TANK");
		PreloadAnimLib(playerid,"TATTOOS");
		PreloadAnimLib(playerid,"TEC");
		PreloadAnimLib(playerid,"TRAIN");
		PreloadAnimLib(playerid,"TRUCK");
		PreloadAnimLib(playerid,"UZI");
		PreloadAnimLib(playerid,"VAN");
		PreloadAnimLib(playerid,"VENDING");
		PreloadAnimLib(playerid,"VORTEX");
		PreloadAnimLib(playerid,"WAYFARER");
		PreloadAnimLib(playerid,"WEAPONS");
		PreloadAnimLib(playerid,"WUZI");
		PreloadAnimLib(playerid,"WOP");
		PreloadAnimLib(playerid,"GFUNK");
		PreloadAnimLib(playerid,"RUNNINGMAN");
   }
   return 1;
}
Reply
#8

U need to put "else" after u spawn in LS Airport. Cuz you try to SetPlayerPos some1 in LS airport and after that u move them to pPosX Y Z.

And u need to set pPosX Y Z somewhere to use SetPlayerPos to them.

Get this:

PHP код:
public OnPlayerSpawn(playerid)
{
    
SetPlayerSkin(playeridPlayerInfo[playerid][Skin]);
    if(
PlayerInfo[playerid][Certificated] == 1// if it's the first connection of the new player, previously a certificator created his account
    
{
        
SetPlayerPos(playerid1642.4110, -2335.0168, -2.6797); // ls airport
        
PlayerInfo[playerid][Certificated] = 2// he won't respawn at the airport anymore, now in hist last position
    
}
    else 
SetPlayerPos(playeridPlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
    return 
true;

Reply
#9

Thank you to everyone.

I gave y'all reputation points, you guys really deserve 'em.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)