goto and gethere
#1

When the player's teleport and the teleport to the player, the interior does not load. the character falls into the texture. If the interior (street) - everything is okay

PHP код:
CMD:gotopl(playeridparams[]){
new 
giveplayerid,gotow,gotoi;
if(
sscanf(params,"u"giveplayerid))return send(playeridCOLOR_GRAD1"USAGE: /gotopl [id/name]");
gotow GetPlayerInterior(giveplayerid);
gotoi GetPlayerVirtualWorld(giveplayerid);
GetPlayerPos(giveplayeridposxposyposz);
setint(playerid,gotoi);
setworld(playerid,gotow);
setpos(playeridposx,posy+1,posz);
return 
1;}
CMD:gethere(playeridparams[]){
new 
giveplayerid,gotow1,gotoi1;
if(
sscanf(params,"u"giveplayerid))return send(playeridCOLOR_GRAD1"USAGE: /gethere [id/name]");
gotow1 GetPlayerInterior(playerid);
gotoi1 GetPlayerVirtualWorld(playerid);
GetPlayerPos(playeridposxposyposz);
setint(giveplayerid,gotoi1);
setworld(giveplayerid,gotow1);
setpos(giveplayeridposx,posy+1,posz);
return 
1;} 
Reply
#2

gotopl:
PHP код:
SetPlayerInterior(playeridGetPlayerInterior(giveplayerid));
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(giveplayerid)); 
and vice versa for gethere
Reply
#3

I confused >

gotow = GetPlayerInterior(giveplayerid);
gotoi = GetPlayerVirtualWorld(giveplayerid);


gotow > WORLD and gotoi -INT)) nevertheless thanks
Reply
#4

PHP код:
CMD:gotopl(playeridparams[])
{
    new 
targetid;
    if(
sscanf(params,"u"targetid))return SendClientMessage(playeridCOLOR_GRAD1"USAGE: /gotopl [id/name]");
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(targetidxyz);
    
SetPlayerPos(playeridxy+1.0z);
    
SetPlayerInterior(playeridGetPlayerInterior(targetid));
    
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(targetid));
    return 
1;
}
CMD:gethere(playeridparams[])
{
    new 
targetid;
    if(
sscanf(params,"u"targetid))return SendClientMessage(playeridCOLOR_GRAD1"USAGE: /gethere [id/name]");
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(playeridxyz);
    
SetPlayerPos(targetidxy+1.0z);
    
SetPlayerInterior(targetidGetPlayerInterior(playerid));
    
SetPlayerVirtualWorld(targetidGetPlayerVirtualWorld(playerid));
    return 
1;

Reply
#5

In case you use dynamic objects from Streamer Plugin (as far as I understand, since you can't fall through original interiors even if an interior or vw is set wrong) you might want to freeze the player for the time being, letting the objects load. I had this problem a lot, so I came up with this:

Let's say you teleport someone somewhere, so upon teleportation, you have to freeze him:
Код:
TogglePlayerControllable(playerid, 0);
SetLoadObjectsTimer(playerid);//And also set the timer for unfreezing
As for SetLoadObjectsTimer, I take the ping into consideration, making sure the player won't fall through even after the freeze. As of these unfreeze timers, they might not be accurate, and you should verify if they allow the required portion of the interior to stream in properly:

Код:
stock SetLoadObjectsTimer(playerid)
{
    new ping = GetPlayerPing(playerid);
	if(ping < 100) SetTimerEx("OnPlayerTeleported", 2000, false, "d", playerid);
	else if(ping < 150) SetTimerEx("OnPlayerTeleported", 3000, false, "d", playerid);
	else if(ping < 200) SetTimerEx("OnPlayerTeleported", 4000, false, "d", playerid);
	else SetTimerEx("OnPlayerTeleported", 5000, false, "d", playerid);
}
And, finally, OnPlayerTeleported:

Код:
forward OnPlayerTeleported(playerid);
public OnPlayerTeleported(playerid)
{
	TogglePlayerControllable(playerid, 1);
}
Hope that is helpful.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)