SA-MP Forums Archive
EnsurePlayerSpawn(playerid,x,y,z); - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: EnsurePlayerSpawn(playerid,x,y,z); (/showthread.php?tid=102523)



EnsurePlayerSpawn(playerid,x,y,z); - Enzo_Ferrari_V12 - 16.10.2009

I keep getting...

Код:
C:\Users\ASUS\Desktop\gta.sa\GTA San Andreas\samp\gamemodes\Ensure.pwn(34) : warning 213: tag mismatch
C:\Users\ASUS\Desktop\gta.sa\GTA San Andreas\samp\gamemodes\Ensure.pwn(34 -- 44) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Warnings.
I'm making a thing that gets a players position 1.5 seconds after he is set somewhere. If it is below the required z coordinate then he keeps getting reset to the required z coord. This is so if objects don't load he will keep respawning until they load. Here is wut I have...

Код:
//top
new Float:x2,y2,z2,angle2;
forward MINZCHECK(playerid);

stock EnsurePlayerSpawn(playerid,Float:x,Float:y,Float:z,Float:angle)
{
    SetPlayerPos(playerid,x,y,z);
    SetplayerFacingAngle(playerid,angle);
    SetTimer("MINZCHECK", 1500, 1);
    Float:x == x2
	  Float:y == y2
	  Float:z == z2
	  Float:angle == angle2;
    
}

public MINZCHECK(playerid)
{
	new Float:tempx,tempy,tempz;
	GetPlayerPos(playerid,tempx,tempy,tempz);
	if(tempz<z2)
	{
	  SetPlayerPos(playerid,x2,y2,z2);
		return 1;
	}
	else if(tempz>=z2)
	{
		KillTimer(MINZCHECK(playerid));
	}
	return 1;
}



Re: EnsurePlayerSpawn(playerid,x,y,z); - ilikepie2221 - 16.10.2009

pawn Код:
new
   Float:x2,
   Float:y2,
   Float:z2,
   Float:angle2;
Try that. And yes, you do have to do this long shit, lol.


Re: EnsurePlayerSpawn(playerid,x,y,z); - Enzo_Ferrari_V12 - 16.10.2009

Still get the same error


Re: EnsurePlayerSpawn(playerid,x,y,z); - CracK - 16.10.2009

You can actually freeze players for 1-2 seconds when they are teleported to the place, where your custom objects are.
Top of the script:
pawn Код:
forward ToggleControl(playerid);
Where you need to freeze:
pawn Код:
TogglePlayerControllable(playerid,0);
SetTimerEx("ToggleControl", 1500, 0, "i", playerid);
Somewhere:
pawn Код:
public ToggleControl(playerid)
{
  TogglePlayerControllable(playerid,1);
}



Re: EnsurePlayerSpawn(playerid,x,y,z); - Enzo_Ferrari_V12 - 16.10.2009

I'm aware BUT sometimes objects don't laod fast enough for some players this is why I made this. So any help?


Re: EnsurePlayerSpawn(playerid,x,y,z); - CracK - 16.10.2009

pawn Код:
//top
new Float:x2,y2,z2,angle2;
forward MINZCHECK(playerid);

stock EnsurePlayerSpawn(playerid,Float:x,Float:y,Float:z,Float:angle)
{
    SetPlayerPos(playerid,x2,y2,z2);
    SetplayerFacingAngle(playerid,angle2);
    SetTimer("MINZCHECK", 1500, 1);  
}

public MINZCHECK(playerid)
{
    new Float:tempx,tempy,tempz;
    GetPlayerPos(playerid,tempx,tempy,tempz);
    if(tempz<z2)
    {
      SetPlayerPos(playerid,x2,y2,z2);
        return 1;
    }
    else if(tempz>=z2)
    {
        KillTimer(MINZCHECK(playerid));
    }
    return 1;
}



Re: EnsurePlayerSpawn(playerid,x,y,z); - Extremo - 16.10.2009

Small info about Crack's post. This are the value types defined in it:

Код:
Floats:  x2, x, y, z, angle, tempx, tempy, tempz
Integer: y2, z2, angle2
If you wanted to assign y2, z2 and angle2 a float-number, it would give you a "tag mismatch". Thats like placing an apple onto a orange. Doesn't really fit together.


Re: EnsurePlayerSpawn(playerid,x,y,z); - CracK - 16.10.2009

Sorry, my mistake:
pawn Код:
//top
new Float:x2,Float:y2,Float:z2,Float:angle2;
forward MINZCHECK(playerid);

stock EnsurePlayerSpawn(playerid,Float:x,Float:y,Float:z,Float:angle)
{
    SetPlayerPos(playerid,x2,y2,z2);
    SetPlayerFacingAngle(playerid,angle2);
    SetTimer("MINZCHECK", 1500, 1);  
}

public MINZCHECK(playerid)
{
new Float:tempx,tempy,tempz;
GetPlayerPos(playerid,tempx,tempy,tempz);
if(tempz<z2)
{
  SetPlayerPos(playerid,x2,y2,z2);
return 1;
}
else if(tempz>=z2)
{
KillTimer(MINZCHECK(playerid));
}
return 1;
}



Re: EnsurePlayerSpawn(playerid,x,y,z); - Sergei - 16.10.2009

And it's SetPlayerFacingAngle not SetplayerFacingAngle.


Re: EnsurePlayerSpawn(playerid,x,y,z); - Extremo - 16.10.2009

Quote:
Originally Posted by $ЂЯĢ
And it's SetPlayerFactionAngle not SetplayerFacingAngle.
Uhm what? Its SetPlayerFacingAngle... you should of background checked that one.

EDIT: Have a look here: SetPlayerFacingAngle