Auto-Spawning to last position issue
#1

Код:
public OnPlayerConnect(playerid)
{
    if(pInfo[playerid][AutoLogin] == 1)
    {
        SetSpawnInfo( playerid, 0, 0, whatever, whatever, whatever, 0, 0, 0, 0, 0, 0, 0);
        SpawnPlayer(playerid);
    }
}
Can that be done ?, If yes then It's not working, I get this
Reply
#2

Bumb
Reply
#3

i think the x,y,z is not right re add the x,y,z
Reply
#4

Use

pawn Код:
SetCameraBehindPlayer(playerid);
This will set the camera behind player , this might work ...
Reply
#5

Don't use OnPlayerConnect.
Try placing it under OnPlayerSpawn
Reply
#6

Quote:
Originally Posted by ethhackerman
Посмотреть сообщение
i think the x,y,z is not right re add the x,y,z
They are right, I checked them multiple times also it's working on the login dialog.

Quote:
Originally Posted by -=Dar[K]Lord=-
Посмотреть сообщение
Use

pawn Код:
SetCameraBehindPlayer(playerid);
This will set the camera behind player , this might work ...
Tried it before and it Didn't work, Thanks anyway

Quote:
Originally Posted by dannyk0ed
Посмотреть сообщение
Don't use OnPlayerConnect.
Try placing it under OnPlayerSpawn
It's called when player connect, How can I put it under on player spawn, Here is the full code
also I wanna different spawn coords for other stuff, Like when player dies or in minigames
Код:
public OnPlayerConnect(playerid)
{
    if(!fexist(Jfile))
    {
        format(Jstring, sizeof(Jstring),"Nick name \"%s\" isn't registered\nEnter the password:", JGetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Register an account!", Jstring, "Register", "Kick");
    }
    else
    {
        pInfo[playerid][Registered] = 1;
	format(Jfile, 100, ACCOUNTS_PATH, JGetName(playerid));
	INI_ParseFile(Jfile, "GetPlayerInfo", .bExtra = true, .extra = playerid);
        if(pStat[playerid][pAutoLogin] == 1 && (!strcmp(pIP, pInfo[playerid][IP],true)))
	{
            format(Jfile, 100, ACCOUNTS_PATH, JGetName(playerid));
            INI_ParseFile(Jfile, "LoginPlayer", .bExtra = true, .extra = playerid);
            SendClientMessage(playerid,orange,"You have been automatically logged In, Type /Autologin to disable it.");
	    pInfo[playerid][Logged] = 1;
			
	    //SetCameraBehindPlayer(playerid); Tried before and didn't work
   	    //TogglePlayerSpectating(playerid, 0); ^^
	    SetSpawnInfo( playerid, 0, 0, PosX[playerid], PosY[playerid], PosZ[playerid], Angle[playerid], 0, 0, 0, 0, 0, 0);
	    SpawnPlayer(playerid);
        }
}
Reply
#7

Bump..
Reply
#8

Use your code in OnPlayerRequestClass instead, in OnPlayerConnect will not work.
Reply
#9

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Use your code in OnPlayerRequestClass instead, in OnPlayerConnect will not work.
It worked, Thanks.
Reply
#10

Another problem I'm having, I want to send a message when player enters specific vehicle, Here's the codes

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    {
		switch(GetPlayerVehicleID(playerid))
		{
    		case 523, 427, 490, 528, 596, 598, 597, 599, 432, 601: //Police Cars..
    		{
		    SendClientMessage(playerid, blue, "You entered a police car");
    		}
		}
	}
	if(oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER)
	{
		switch(GetPlayerVehicleID(playerid))
		{
    		case 523, 427, 490, 528, 596, 598, 597, 599, 432, 601: //Police Cars..
    		{
		    SendClientMessage(playerid, blue, "You exited a police car");
    		}
    	    	
    	}
	}
}

CMD:start(playerid, params[])
{
    new vehicleid = GetPlayerVehicleID(playerid);
	if( vehicleid == 596 )
	{
            SendClientMessage(playerid, blue, "You started...");
	}
	else return SendClientMessage(playerid, blue, "You're not in a police car...");
}
It's not showing anything when i enter the vehicle, Also /start Shows You're not in a police car...
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)