Jump to content

Teleport către jucator prin TAB


N1kS

Recommended Posts

Salutare prieteni, am decis sa vă arăt o modalitate foarte simplă pentru a vă teleporta către jucatori prin TAB.

Sper să fie de folos!

 

Pentru început adăugăm în public OnPlayerClickPlayer(playerid, clickedplayerid, source):

new String[64], Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
SetPVarInt(clickedplayerid, "Teleport", playerid);
format(String, sizeof(String), "%s vrea sa se teleporteze catre tine", Name);
ShowPlayerDialog(clickedplayerid, 1, DIALOG_STYLE_MSGBOX, "Teleport", String, "Da", "Nu");

Și rămâne să adăugăm în public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]):

//if(dialogid == 1)
//switch(dialogid)
//{
	case 1:
	{
		if(!response) return 1;
		new Float: Coord[3];
		GetPlayerPos(playerid, Coord[0], Coord[1], Coord[2]);
		SetPlayerPos(GetPVarInt(playerid,"Teleport"), Coord[0], Coord[1], Coord[2]);
		DeletePVar(playerid, "Teleport");
	}

În final primim:

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
    new String[54], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    SetPVarInt(clickedplayerid, "Teleport", playerid);
    format(String, sizeof(String), "%s vrea sa se teleporteze catre tine", Name);
    ShowPlayerDialog(clickedplayerid, 1, DIALOG_STYLE_MSGBOX, "Teleport", String, "Da", "Nu");
    return 1;
} 

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	switch(dialogid)
	{
		case 1:
		{
			if(!response) return 1;
			new Float: Coord[3];
			GetPlayerPos(playerid, Coord[0], Coord[1], Coord[2]);
			SetPlayerPos(GetPVarInt(playerid,"Teleport"), Coord[0], Coord[1], Coord[2]);
			DeletePVar(playerid, "Teleport");
		}
	}
    return 1;
}

 

Link to comment
Share on other sites

O sa va propun o metoda proprie legat de acest sistem

 

#define SendClientMessage SCM
#define playerid pi

public 
  OnPlayerClickPlayer(playerid, clickedplayerid, source) {
	
	new Float:x,
		Float:y,
  		Float:z; 
	
  	GetPlayerPos(clickedplayerid,x,y,z);
  
    SetPlayerPos(playerid,
  		x,y+5,z);
  
	SetPlayerInterior(playerid,
		GetPlayerInterior(clickedplayerid));
  
	SetPlayerVirtualWorld(playerid,
	GetPlayerVirtualWorld(clickedplayerid));
	SCM(pi, -1, 
  		!"Te-ai teleportat cu succes la acest jucator");
	return 1; }

 

 

 

Edited by Khain Developer
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.