[HELP] SpawnPlayer not working
#1

Hey guys, i want to disable f4 then i must insert SpawnPlayer(); inside OnPlayerRequestClass, but SpawnPlayer isn't called why?

Код:
public OnPlayerRequestClass(playerid, classid)
{
    if (IsPlayerNPC(playerid))
	    return 1;

	if (!PlayerData[playerid][pAccount])
	{
 		new
	        time[3];

        gettime(time[0], time[1], time[2]);
		SetPlayerTime(playerid, time[0], time[1]);

        TogglePlayerSpectating(playerid, 1);
        TogglePlayerControllable(playerid, 0);

		new ORM:ormid = PlayerData[playerid][ORM_ID] = orm_create("Users", g_Handle);

		orm_addvar_int(ormid, PlayerData[playerid][pID], "ID");
		orm_addvar_string(ormid, PlayerData[playerid][pUsername], MAX_PLAYER_NAME, "Username");
		orm_addvar_string(ormid, PlayerData[playerid][pPassword], 129, "Password");
		orm_addvar_float(ormid, PlayerData[playerid][pPos][0], "PosX");
		orm_addvar_float(ormid, PlayerData[playerid][pPos][1], "PosY");
		orm_addvar_float(ormid, PlayerData[playerid][pPos][2], "PosZ");
		orm_addvar_int(ormid, PlayerData[playerid][pSkin], "Skin");
		orm_addvar_int(ormid, PlayerData[playerid][pMoney], "Money");
		orm_setkey(ormid, "Username");

		orm_load(ormid, "OnPlayerDataLoaded", "dd", playerid, g_MysqlRaceCheck[playerid]);

        PlayerData[playerid][pAccount] = 1;
	}
	else
	{
		SpawnPlayer(playerid);
	}
	return 1;
}
Images:
Before, my skin id is 1 and here is first position, ( im forget the ss ), then i press F4, /kill and it look like Image 1., when i press spawn, it spawn me to blueberry lol . . .
Image 1.

Image 2.
Reply
#2

Sorry for my bad english, please help me
Reply
#3

Show us Onplayerspawn.
Reply
#4

public OnPlayerSpawn(playerid)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerData[playerid][pMoney]);
return 1;
}
Reply
#5

Quote:
Originally Posted by RaeF
Посмотреть сообщение
public OnPlayerSpawn(playerid)
{
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, PlayerData[playerid][pMoney]);
return 1;
}
If that is all that is in your OnPlayerSpawn then I assume your AddPlayerClass Coordinates or SetSpawnInfo is pointing at coordinates 0.00,0.00,0.00 or something similar, as those coordinates are located in blueberry. Try adding something like this under OnPlayerSpawn.
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, 1722.2124,-1610.8375,13.5469);
    SetPlayerFacingAngle(playerid, 357.7353);
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid,0);
    SetCameraBehindPlayer(playerid);
    return 1;
}
See what it does when you do SpawnPlayer now.
Reply
#6

Ok, thanks for helping +1
Quote:
Originally Posted by Banana_Ghost
Посмотреть сообщение
If that is all that is in your OnPlayerSpawn then I assume your AddPlayerClass Coordinates or SetSpawnInfo is pointing at coordinates 0.00,0.00,0.00 or something similar, as those coordinates are located in blueberry. Try adding something like this under OnPlayerSpawn.
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid, 1722.2124,-1610.8375,13.5469);
    SetPlayerFacingAngle(playerid, 357.7353);
    SetPlayerInterior(playerid, 0);
    SetPlayerVirtualWorld(playerid,0);
    SetCameraBehindPlayer(playerid);
    return 1;
}
See what it does when you do SpawnPlayer now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)