/spawn doesn't load
#1

HI guys I need your help. I have here spawn command which save/load spawn point. It works nice. But the problem after I get disconnect and reconnects again then in spawn it doesn't load the last time I used the command /spawn.. It was like its not triggering the save to load on player connect or on player spawn? what you think?

Код:
CMD:spawn(playerid,params[])
{
	GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
	GetPlayerFacingAngle( playerid, Angle[ playerid ] );
	GetPlayerInterior (playerid);
 	GetPlayerVirtualWorld (playerid);
	GameTextForPlayer(playerid,"~y~Spawn Point ~n~~g~Saved",2000,3);
	return 1;
}
Код:
 INI_WriteFloat( ACCOUNT, "PositionX", PosX[ playerid ] );
	INI_WriteFloat( ACCOUNT, "PositionY", PosY[ playerid ] );
	INI_WriteFloat( ACCOUNT, "PositionZ", PosZ[ playerid ] );
	INI_WriteFloat( ACCOUNT, "Angle", Angle[ playerid ] );
Код:
public OnPlayerDisconnect(playerid, reason)
{

    GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
    GetPlayerFacingAngle( playerid, Angle[ playerid ] );
Код:
public OnPlayerSpawn(playerid)
{

	if ( PosX[ playerid ] != 0 && PosY[ playerid ] != 0 && PosZ[ playerid ] != 0 )
    {
        SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
        SetPlayerFacingAngle( playerid, Angle[ playerid ] );
        SetPlayerInterior( playerid, Interior[ playerid ] );
        SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] );
        SetCameraBehindPlayer(playerid);
    }
    else
    {
   		new Random = random(sizeof(RandomSpawns));
    	SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
        // set the position for those who has not saved
    }
return 1;
}
Reply
#2

First thing, check if the saving works, Go somewhere and type /spawn then check the Ini file,
if the coords are the same, Then the problem will be on the loading not the saving.
Reply
#3

You get the coordinates when the player disconnects but do you save them in the file?
Reply
#4

Deleted :\
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You get the coordinates when the player disconnects but do you save them in the file?
Yes man it saves. I check the scriptfiles and I found this under my user.ini.

Код:
PositionX = -2244.840576
PositionY = 2293.785888
PositionZ = 4.969128
Angle = 136.209747
So basically it does saved the coordinates. So I wonder why it doesn't load. Thanks for the reply looking forward.


EDIT:

I think I missed something here? Yes I get the coordinates but

Код:
public LoginPlayer(playerid, name[], value[])
{
    INI_Int("Level", pInfo[playerid][pLevel]);
    INI_Int("Donator", pInfo[playerid][Donator]);
    INI_Int("Banned", pInfo[playerid][Banned]);
    INI_Int("Kills", pInfo[playerid][Kills]);
    INI_Int("Deaths", pInfo[playerid][Deaths]);
    INI_Int("Muted", pInfo[playerid][Muted]);
    INI_Int("Score", pInfo[playerid][Score]);
    INI_Int("Cash", pInfo[playerid][Cash]);
    INI_Int("Skin", pInfo[playerid][Skin]);
    INI_String("LastLoggedIP", pInfo[playerid][IP], 16);
    INI_Int("TotalSeconds", pInfo[playerid][TotalSecs]);
    INI_Int("Wep0",pInfo[playerid][pWep0]);
    INI_Int("Wep1",pInfo[playerid][pWep1]);
    INI_Int("Wep2",pInfo[playerid][pWep2]);
    INI_Int("Wep3",pInfo[playerid][pWep3]);
    INI_Int("Wep4",pInfo[playerid][pWep4]);
    INI_Int("Wep5",pInfo[playerid][pWep5]);
    INI_Int("Wep6",pInfo[playerid][pWep6]);
    INI_Int("Wep7",pInfo[playerid][pWep7]);
    INI_Int("Wep8",pInfo[playerid][pWep8]);
    INI_Int("Wep9",pInfo[playerid][pWep9]);
    INI_Int("Wep10",pInfo[playerid][pWep10]);
    INI_Int("Wep11",pInfo[playerid][pWep11]);
    INI_Int("Wep12",pInfo[playerid][pWep12]);
    INI_Int("Ammo0",pInfo[playerid][pAmmo0]);
    INI_Int("Ammo1",pInfo[playerid][pAmmo1]);
    INI_Int("Ammo2",pInfo[playerid][pAmmo2]);
    INI_Int("Ammo3",pInfo[playerid][pAmmo3]);
    INI_Int("Ammo4",pInfo[playerid][pAmmo4]);
    INI_Int("Ammo5",pInfo[playerid][pAmmo5]);
    INI_Int("Ammo6",pInfo[playerid][pAmmo6]);
    INI_Int("Ammo7",pInfo[playerid][pAmmo7]);
    INI_Int("Ammo8",pInfo[playerid][pAmmo8]);
    INI_Int("Ammo9",pInfo[playerid][pAmmo9]);
    INI_Int("Ammo10",pInfo[playerid][pAmmo10]);
    INI_Int("Ammo11",pInfo[playerid][pAmmo11]);
    INI_Int("Ammo12",pInfo[playerid][pAmmo12]);
    INI_String("Color",pInfo[playerid][color],11);
    return 1;
}
Can you please arrange this for me?
Reply
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You get the coordinates when the player disconnects but do you save them in the file?
I think yes he did

Quote:
pawn Код:
INI_WriteFloat( ACCOUNT, "PositionX", PosX[ playerid ] );
    INI_WriteFloat( ACCOUNT, "PositionY", PosY[ playerid ] );
    INI_WriteFloat( ACCOUNT, "PositionZ", PosZ[ playerid ] );
    INI_WriteFloat( ACCOUNT, "Angle", Angle[ playerid ] );
Reply
#7

Quote:
Originally Posted by kbalor
Посмотреть сообщение
EDIT:

I think I missed something here?

Код:
public LoginPlayer(playerid, name[], value[])
{
    INI_Int("Level", pInfo[playerid][pLevel]);
    INI_Int("Donator", pInfo[playerid][Donator]);
    INI_Int("Banned", pInfo[playerid][Banned]);
    INI_Int("Kills", pInfo[playerid][Kills]);
    INI_Int("Deaths", pInfo[playerid][Deaths]);
    INI_Int("Muted", pInfo[playerid][Muted]);
    INI_Int("Score", pInfo[playerid][Score]);
    INI_Int("Cash", pInfo[playerid][Cash]);
    INI_Int("Skin", pInfo[playerid][Skin]);
    INI_String("LastLoggedIP", pInfo[playerid][IP], 16);
    INI_Int("TotalSeconds", pInfo[playerid][TotalSecs]);
    INI_Int("Wep0",pInfo[playerid][pWep0]);
    INI_Int("Wep1",pInfo[playerid][pWep1]);
    INI_Int("Wep2",pInfo[playerid][pWep2]);
    INI_Int("Wep3",pInfo[playerid][pWep3]);
    INI_Int("Wep4",pInfo[playerid][pWep4]);
    INI_Int("Wep5",pInfo[playerid][pWep5]);
    INI_Int("Wep6",pInfo[playerid][pWep6]);
    INI_Int("Wep7",pInfo[playerid][pWep7]);
    INI_Int("Wep8",pInfo[playerid][pWep8]);
    INI_Int("Wep9",pInfo[playerid][pWep9]);
    INI_Int("Wep10",pInfo[playerid][pWep10]);
    INI_Int("Wep11",pInfo[playerid][pWep11]);
    INI_Int("Wep12",pInfo[playerid][pWep12]);
    INI_Int("Ammo0",pInfo[playerid][pAmmo0]);
    INI_Int("Ammo1",pInfo[playerid][pAmmo1]);
    INI_Int("Ammo2",pInfo[playerid][pAmmo2]);
    INI_Int("Ammo3",pInfo[playerid][pAmmo3]);
    INI_Int("Ammo4",pInfo[playerid][pAmmo4]);
    INI_Int("Ammo5",pInfo[playerid][pAmmo5]);
    INI_Int("Ammo6",pInfo[playerid][pAmmo6]);
    INI_Int("Ammo7",pInfo[playerid][pAmmo7]);
    INI_Int("Ammo8",pInfo[playerid][pAmmo8]);
    INI_Int("Ammo9",pInfo[playerid][pAmmo9]);
    INI_Int("Ammo10",pInfo[playerid][pAmmo10]);
    INI_Int("Ammo11",pInfo[playerid][pAmmo11]);
    INI_Int("Ammo12",pInfo[playerid][pAmmo12]);
    INI_String("Color",pInfo[playerid][color],11);
    return 1;
}
You do not load the coordinates.

pawn Код:
INI_Float( "PositionX", PosX[ playerid ] );
INI_Float( "PositionY", PosY[ playerid ] );
INI_Float( "PositionZ", PosZ[ playerid ] );
INI_Float( "Angle", Angle[ playerid ] );
Reply
#8

You missed the loading of the positions..

pawn Код:
public LoginPlayer(playerid, name[], value[])
{
    INI_Int("Level", pInfo[playerid][pLevel]);
    INI_Int("Donator", pInfo[playerid][Donator]);
    INI_Int("Banned", pInfo[playerid][Banned]);
    INI_Int("Kills", pInfo[playerid][Kills]);
    INI_Int("Deaths", pInfo[playerid][Deaths]);
    INI_Int("Muted", pInfo[playerid][Muted]);
    INI_Int("Score", pInfo[playerid][Score]);
    INI_Int("Cash", pInfo[playerid][Cash]);
    INI_Int("Skin", pInfo[playerid][Skin]);
    INI_String("LastLoggedIP", pInfo[playerid][IP], 16);
    INI_Int("TotalSeconds", pInfo[playerid][TotalSecs]);
    INI_Int("Wep0",pInfo[playerid][pWep0]);
    INI_Int("Wep1",pInfo[playerid][pWep1]);
    INI_Int("Wep2",pInfo[playerid][pWep2]);
    INI_Int("Wep3",pInfo[playerid][pWep3]);
    INI_Int("Wep4",pInfo[playerid][pWep4]);
    INI_Int("Wep5",pInfo[playerid][pWep5]);
    INI_Int("Wep6",pInfo[playerid][pWep6]);
    INI_Int("Wep7",pInfo[playerid][pWep7]);
    INI_Int("Wep8",pInfo[playerid][pWep8]);
    INI_Int("Wep9",pInfo[playerid][pWep9]);
    INI_Int("Wep10",pInfo[playerid][pWep10]);
    INI_Int("Wep11",pInfo[playerid][pWep11]);
    INI_Int("Wep12",pInfo[playerid][pWep12]);
    INI_Int("Ammo0",pInfo[playerid][pAmmo0]);
    INI_Int("Ammo1",pInfo[playerid][pAmmo1]);
    INI_Int("Ammo2",pInfo[playerid][pAmmo2]);
    INI_Int("Ammo3",pInfo[playerid][pAmmo3]);
    INI_Int("Ammo4",pInfo[playerid][pAmmo4]);
    INI_Int("Ammo5",pInfo[playerid][pAmmo5]);
    INI_Int("Ammo6",pInfo[playerid][pAmmo6]);
    INI_Int("Ammo7",pInfo[playerid][pAmmo7]);
    INI_Int("Ammo8",pInfo[playerid][pAmmo8]);
    INI_Int("Ammo9",pInfo[playerid][pAmmo9]);
    INI_Int("Ammo10",pInfo[playerid][pAmmo10]);
    INI_Int("Ammo11",pInfo[playerid][pAmmo11]);
    INI_Int("Ammo12",pInfo[playerid][pAmmo12]);
    INI_String("Color",pInfo[playerid][color],11);
    INI_Int("PositionX", PosX[playerid];
    INI_Int("PositionY", PosY[playerid];
    INI_Int("PositionZ", PosZ[playerid];
    INI_Int("Angle", Angle[playerid]);
    return 1;
}
Reply
#9

Quote:
Originally Posted by xVIP3Rx
Посмотреть сообщение
You missed the loading of the positions..

pawn Код:
public LoginPlayer(playerid, name[], value[])
{
    INI_Int("Level", pInfo[playerid][pLevel]);
    INI_Int("Donator", pInfo[playerid][Donator]);
    INI_Int("Banned", pInfo[playerid][Banned]);
    INI_Int("Kills", pInfo[playerid][Kills]);
    INI_Int("Deaths", pInfo[playerid][Deaths]);
    INI_Int("Muted", pInfo[playerid][Muted]);
    INI_Int("Score", pInfo[playerid][Score]);
    INI_Int("Cash", pInfo[playerid][Cash]);
    INI_Int("Skin", pInfo[playerid][Skin]);
    INI_String("LastLoggedIP", pInfo[playerid][IP], 16);
    INI_Int("TotalSeconds", pInfo[playerid][TotalSecs]);
    INI_Int("Wep0",pInfo[playerid][pWep0]);
    INI_Int("Wep1",pInfo[playerid][pWep1]);
    INI_Int("Wep2",pInfo[playerid][pWep2]);
    INI_Int("Wep3",pInfo[playerid][pWep3]);
    INI_Int("Wep4",pInfo[playerid][pWep4]);
    INI_Int("Wep5",pInfo[playerid][pWep5]);
    INI_Int("Wep6",pInfo[playerid][pWep6]);
    INI_Int("Wep7",pInfo[playerid][pWep7]);
    INI_Int("Wep8",pInfo[playerid][pWep8]);
    INI_Int("Wep9",pInfo[playerid][pWep9]);
    INI_Int("Wep10",pInfo[playerid][pWep10]);
    INI_Int("Wep11",pInfo[playerid][pWep11]);
    INI_Int("Wep12",pInfo[playerid][pWep12]);
    INI_Int("Ammo0",pInfo[playerid][pAmmo0]);
    INI_Int("Ammo1",pInfo[playerid][pAmmo1]);
    INI_Int("Ammo2",pInfo[playerid][pAmmo2]);
    INI_Int("Ammo3",pInfo[playerid][pAmmo3]);
    INI_Int("Ammo4",pInfo[playerid][pAmmo4]);
    INI_Int("Ammo5",pInfo[playerid][pAmmo5]);
    INI_Int("Ammo6",pInfo[playerid][pAmmo6]);
    INI_Int("Ammo7",pInfo[playerid][pAmmo7]);
    INI_Int("Ammo8",pInfo[playerid][pAmmo8]);
    INI_Int("Ammo9",pInfo[playerid][pAmmo9]);
    INI_Int("Ammo10",pInfo[playerid][pAmmo10]);
    INI_Int("Ammo11",pInfo[playerid][pAmmo11]);
    INI_Int("Ammo12",pInfo[playerid][pAmmo12]);
    INI_String("Color",pInfo[playerid][color],11);
    INI_Int("PositionX", PosX[playerid];
    INI_Int("PositionY", PosY[playerid];
    INI_Int("PositionZ", PosZ[playerid];
    INI_Int("Angle", Angle[playerid]);
    return 1;
}
The below warning was from what you added
Код:
 error 017: undefined symbol "INI_Int"
warning 202: number of arguments does not match definition
error 001: expected token: ",", but found ";"
error 017: undefined symbol "INI_Int"
warning 202: number of arguments does not match definition
 error 001: expected token: ",", but found ";"
error 017: undefined symbol "INI_Int"
warning 202: number of arguments does not match definition
error 001: expected token: ",", but found ";"
warning 213: tag mismatch
EDIT: I've added ")" from each now the warning is only number of arguments does not match definition.

and maybe beause it was float? not int?
Reply
#10

Quote:
Originally Posted by kbalor
Посмотреть сообщение
The below warning was from what you added
Код:
 error 017: undefined symbol "INI_Int"
warning 202: number of arguments does not match definition
error 001: expected token: ",", but found ";"
error 017: undefined symbol "INI_Int"
warning 202: number of arguments does not match definition
 error 001: expected token: ",", but found ";"
error 017: undefined symbol "INI_Int"
warning 202: number of arguments does not match definition
error 001: expected token: ",", but found ";"
warning 213: tag mismatch
EDIT: I've added ")" from each now the warning is only number of arguments does not match definition.
Oh my bad, Missed some ")"'s
pawn Код:
INI_Int("PositionX", PosX[playerid]);
    INI_Int("PositionY", PosY[playerid]);
    INI_Int("PositionZ", PosZ[playerid]);
    INI_Int("Angle", Angle[playerid]);
Edit:
Can you show us where did you add PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)