SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/03/2018, 04:27 PM   #1
EvgeniyHostel1992
Big Clucker
 
Join Date: Feb 2016
Posts: 53
Reputation: 0
Default goto and gethere

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 Code:
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;} 
__________________
The Godfather 2007 [Roley Play]
EvgeniyHostel1992 is offline   Reply With Quote
Old 21/03/2018, 04:56 PM   #2
kovac
Huge Clucker
 
kovac's Avatar
 
Join Date: Mar 2018
Posts: 280
Reputation: 3
Default Re: goto and gethere

gotopl:
PHP Code:
SetPlayerInterior(playeridGetPlayerInterior(giveplayerid));
SetPlayerVirtualWorld(playeridGetPlayerVirtualWorld(giveplayerid)); 
and vice versa for gethere
kovac is offline   Reply With Quote
Old 21/03/2018, 06:58 PM   #3
EvgeniyHostel1992
Big Clucker
 
Join Date: Feb 2016
Posts: 53
Reputation: 0
Default Re: goto and gethere

I confused >

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


gotow > WORLD and gotoi -INT)) nevertheless thanks
__________________
The Godfather 2007 [Roley Play]
EvgeniyHostel1992 is offline   Reply With Quote
Old 21/03/2018, 07:07 PM   #4
kovac
Huge Clucker
 
kovac's Avatar
 
Join Date: Mar 2018
Posts: 280
Reputation: 3
Default Re: goto and gethere

PHP Code:
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;

kovac is offline   Reply With Quote
Old 22/03/2018, 06:27 AM   #5
Maxandmov
Big Clucker
 
Maxandmov's Avatar
 
Join Date: Feb 2011
Location: Moscow, Russia.
Posts: 126
Reputation: 9
Default Re: goto and gethere

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:
Code:
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:

Code:
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:

Code:
forward OnPlayerTeleported(playerid);
public OnPlayerTeleported(playerid)
{
	TogglePlayerControllable(playerid, 1);
}
Hope that is helpful.
Maxandmov is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] /goto and /gethere command eеe Tutorials 11 13/10/2012 06:17 PM
/goto, /gethere problem Rafa Help Archive 4 26/07/2011 07:00 PM
I need some help with a goto command and gethere Shockey HD Help Archive 6 19/07/2011 07:29 AM


All times are GMT. The time now is 02:41 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.