Skin Load Problem
#1

I don't know why, but I can explain this problem.

I have a saving for skin. After I choose a skin from /skin command then it spawn the skin that I've chosen. Then I /q or quit to the server. Now I tried to change a different name on the tab Name: where you put your name. So basically it created a new account. Now after I spawned with a new account and it loads the skin of the old registered account (The one that I used earlier). Why?

Код:
public OnPlayerSpawn
{
    SetPlayerSkin(playerid, pInfo[playerid][Skin]);
    ///some codes here
}
Код:
public OnPlayerRequestSpawn(playerid)
{
	SetPlayerSkin(playerid, pInfo[playerid][Skin]);
        //some coes here
}
Код:
INI_WriteInt(ACCOUNT, "Skin", pInfo[playerid][Skin]);
Код:
INI_Int("Skin", pInfo[playerid][Skin]);
Reply
#2

Reset the variables in OnOlayerConnect.

pawn Код:
public OnPlayerConnect(playerid)
{
    pInfo[playerid][Skin] = 0;
    // code
    return 1;
}
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Reset the variables in OnOlayerConnect.

pawn Код:
public OnPlayerConnect(playerid)
{
    pInfo[playerid][Skin] = 0;
    // code
    return 1;
}
Hi my friend glad it worked!

how about this? how do I reset variable?

Код:
	INI_WriteFloat(ACCOUNT, "PositionX", PosX[playerid]);
	INI_WriteFloat(ACCOUNT, "PositionY", PosY[playerid]);
	INI_WriteFloat(ACCOUNT, "PositionZ", PosZ[playerid]);
	INI_WriteFloat(ACCOUNT, "Angle", Angle[playerid]);
	INI_WriteInt( ACCOUNT, "Interior", GetPlayerInterior( playerid ) );
like what you have given me?

Код:
CMD:spawn(playerid,params[])
{
	if(pInfo[playerid][Registered] == 1 && pInfo[playerid][Logged] == 1)
    {
		GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
		GetPlayerFacingAngle(playerid, Angle[playerid]);
	 	GetPlayerInterior(playerid);
		GameTextForPlayer(playerid,"~y~Spawn Point ~n~~g~Saved",2000,3);
		return 1;
	}
	else return SendClientMessage(playerid, white,"{FF0000}>> You must register first before using this command");
}
I wanted to reset the variable to the following random spawn.
Код:
			new Random = random(sizeof(RandomSpawns));
 		   	SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
The problem: When I do /spawn

Код:
CMD:spawn(playerid,params[])
{
	if(pInfo[playerid][Registered] == 1 && pInfo[playerid][Logged] == 1)
    {
		GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
		GetPlayerFacingAngle(playerid, Angle[playerid]);
	 	GetPlayerInterior(playerid);
		GameTextForPlayer(playerid,"~y~Spawn Point ~n~~g~Saved",2000,3);
		return 1;
	}
	else return SendClientMessage(playerid, white,"{FF0000}>> You must register first before using this command");
}
and after I do /q or quit.

Код:
	
Under onplayerdisconnect

if(pInfo[playerid][Registered] == 1 && pInfo[playerid][Logged] == 1)
	{
		if ( PosX[ playerid ] != 0 && PosY[ playerid ] != 0 && PosZ[ playerid ] != 0 )
		{
		    GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
		    GetPlayerFacingAngle( playerid, Angle[ playerid ] );
		}
		else return 1;
	}
Then after I reconnect and spawn. It spawn me on the last position where I used /q NOT where I use /spawn.
Reply
#4

Quote:
Originally Posted by gotwarzone
Посмотреть сообщение
Hi my friend glad it worked!

how about this? how do I reset variable?

Код:
	INI_WriteFloat(ACCOUNT, "PositionX", PosX[playerid]);
	INI_WriteFloat(ACCOUNT, "PositionY", PosY[playerid]);
	INI_WriteFloat(ACCOUNT, "PositionZ", PosZ[playerid]);
	INI_WriteFloat(ACCOUNT, "Angle", Angle[playerid]);
	INI_WriteInt( ACCOUNT, "Interior", GetPlayerInterior( playerid ) );
like what you have given me?
pawn Код:
//Inside OnPlayerConnect
PosX[playerid] = 0, PosY[playerid] = 0,
PosZ[playerid] = 0, Angle[playerid] = 0;
Reply
#5

Quote:
Originally Posted by pds2k12
Посмотреть сообщение
pawn Код:
//Inside OnPlayerConnect
PosX[playerid] = 0, PosY[playerid] = 0,
PosZ[playerid] = 0, Angle[playerid] = 0;
I will try this. But can you help me with this one too?

First I do /spawn, e.g: let say im outside cj's house then I do /spawn. Now my position was saved. So now I walk from cj house to Abandoned airport. Then I /q or quit. Basically it will close my gta.

Now when I logged back to the server. After I spawn it spawned me in Abandoned Airport not where I used /spawn in cj house outside.

So basically my position saved when I do /q or quit. why?

Here are my codes.

Код:
CMD:spawn(playerid,params[])
{
	if(pInfo[playerid][Registered] == 1 && pInfo[playerid][Logged] == 1)
    {
		GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
		GetPlayerFacingAngle(playerid, Angle[playerid]);
	 	GetPlayerInterior(playerid);
		GameTextForPlayer(playerid,"~y~Spawn Point ~n~~g~Saved",2000,3);
		return 1;
	}
	else return SendClientMessage(playerid, white,"{FF0000}>> You must register first before using this command");
}
Код:
	
Under onplayerdisconnect

if(pInfo[playerid][Registered] == 1 && pInfo[playerid][Logged] == 1)
	{
		if ( PosX[ playerid ] != 0 && PosY[ playerid ] != 0 && PosZ[ playerid ] != 0 )
		{
		    GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
		    GetPlayerFacingAngle( playerid, Angle[ playerid ] );
		}
		else return 1;
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)