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