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(playerid, params[]){
new giveplayerid,gotow,gotoi;
if(sscanf(params,"u", giveplayerid))return send(playerid, COLOR_GRAD1, "USAGE: /gotopl [id/name]");
gotow = GetPlayerInterior(giveplayerid);
gotoi = GetPlayerVirtualWorld(giveplayerid);
GetPlayerPos(giveplayerid, posx, posy, posz);
setint(playerid,gotoi);
setworld(playerid,gotow);
setpos(playerid, posx,posy+1,posz);
return 1;}
CMD:gethere(playerid, params[]){
new giveplayerid,gotow1,gotoi1;
if(sscanf(params,"u", giveplayerid))return send(playerid, COLOR_GRAD1, "USAGE: /gethere [id/name]");
gotow1 = GetPlayerInterior(playerid);
gotoi1 = GetPlayerVirtualWorld(playerid);
GetPlayerPos(playerid, posx, posy, posz);
setint(giveplayerid,gotoi1);
setworld(giveplayerid,gotow1);
setpos(giveplayerid, posx,posy+1,posz);
return 1;}
Re: goto and gethere -
kovac - 21.03.2018
gotopl:
PHP код:
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(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(playerid, params[])
{
new targetid;
if(sscanf(params,"u", targetid))return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /gotopl [id/name]");
new Float:x, Float:y, Float:z;
GetPlayerPos(targetid, x, y, z);
SetPlayerPos(playerid, x, y+1.0, z);
SetPlayerInterior(playerid, GetPlayerInterior(targetid));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));
return 1;
}
CMD:gethere(playerid, params[])
{
new targetid;
if(sscanf(params,"u", targetid))return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /gethere [id/name]");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
SetPlayerPos(targetid, x, y+1.0, z);
SetPlayerInterior(targetid, GetPlayerInterior(playerid));
SetPlayerVirtualWorld(targetid, GetPlayerVirtualWorld(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.