Spawn error
#1

Hello.

I have an error in my code: when I spawn, I have a message: "Stay Within The world boundries" and a white screen, basically a big bug.

Here is my code to connect:

Код:
	SendClientMessage(playerid, SUCCESS, "The password is correctly !");
				//pLoadData(playerid);
				pData[playerid][isLogged] = 1;
				new date[126], annee, mois, jour, heure, minute, seconde, pIp[126];
				getdate(annee, mois, jour);
				gettime(heure, minute, seconde);
				format(date, 126, "the %s/%s/%s - %s:%s:%s", jour, mois, annee, heure, minute, seconde);
				GetPlayerIp(playerid, pIp, 126);
				format(query, 400, "UPDATE `members` SET last_connection_date = '%s', last_connection_ip = '%s' WHERE pseudo = '%s'", date, pIp, playerName);
				mysql_query(query);
The pre-spawn:

Код:
public OnPlayerRequestSpawn(playerid)
{
	if(pData[playerid][isLogged] == 1)
	{
		return 1;
	}
	else
	{
	    SendClientMessage(playerid, ERROR, " ");
     	SendClientMessage(playerid, ERROR, "Vous devez кtre inscrit et connectй pour pouvoir Spawn !");
      	SendClientMessage(playerid, ERROR, " ");
		return 0;
	}
}
And OnPlayerSpawn:

Код:
SetPlayerPos(playerid, -1333.1995,483.5709,12.1750);
	SetPlayerFacingAngle(playerid, 179.9017);
	SetPlayerInterior(playerid,0);
	TogglePlayerClock(playerid,1);


	ResetPlayerMoney(playerid);
	GivePlayerMoney(playerid, pData[playerid][argent]);
	SetPlayerScore(playerid, pData[playerid][score]);
	SetPlayerSkin(playerid, pData[playerid][skin]);
	
	switch(pData[playerid][TTteam]) {
	    case 1 : SetPlayerColor(playerid, GREEN);
	    case 2 : SetPlayerColor(playerid, YELLOW);
	    case 3 : SetPlayerColor(playerid, BLUE);
	}
	
	if(pData[playerid][isSpec] == 1) {
	    pData[playerid][isSpec] = 0;
		SetPlayerPos(playerid, pData[playerid][sX], pData[playerid][sY], pData[playerid][sZ]);
	}
The positions are correct, I checked and I even do a AddPlayerClass with the same positions in the GM init.

Thank you!
Reply
#2

I'm pretty damn sure you didn't call ' AddPlayerClass ' at least once.
Reply
#3

In the OnGameModeInit :

Код:
AddPlayerClass(287, -1333.1995,483.5709,12.1750, 187, 24, 199, 25, 250, 29, 999);
Reply
#4

public OnPlayerRequestClass(playerid, classid)
i think u dont use it
Reply
#5

No, because i've just one class...
Reply
#6

Try this:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if( pData[playerid][isLogged] == 0 )
    {
        SendClientMessage(playerid, ERROR, " ");
        SendClientMessage(playerid, ERROR, "Vous devez кtre inscrit et connectй pour pouvoir Spawn !");
        SendClientMessage(playerid, ERROR, " ");
        return 0;
    }
    return 1;
}
Reply
#7

It does not work.

It also gave me the bug before I add the OnPlayerRequestSpawn!
Reply
#8

Up...
Reply
#9

Debug your code then see where the debug ends..

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    print("Debug1");
    if( pData[playerid][isLogged] == 0 )
    {
        print("Debug2");
        SendClientMessage(playerid, ERROR, " ");
        print("Debug3");
        SendClientMessage(playerid, ERROR, "Vous devez кtre inscrit et connectй pour pouvoir Spawn !");
        print("Debug4");
        SendClientMessage(playerid, ERROR, " ");
        print("Debug5");
        return 0;
        print("Debug6");
    }
    print("Debug of OPRS is finished.");
    return 1;
}
Reply
#10

What happens is that the OnPlayerSpawn is never called: /
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)