SA-MP Forums Archive
goto and gethere - 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)
+--- Thread: goto and gethere (/showthread.php?tid=651513)



goto and gethere - EvgeniyHostel1992 - 21.03.2018

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;} 



Re: goto and gethere - kovac - 21.03.2018

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


Re: goto and gethere - EvgeniyHostel1992 - 21.03.2018

I confused >

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


gotow > WORLD and gotoi -INT)) nevertheless thanks


Re: goto and gethere - kovac - 21.03.2018

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;




Re: goto and gethere - Maxandmov - 22.03.2018

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.