04.02.2009, 14:24
Bring Player To You
Change a few variables and you got teleport.
And I'm a 100% sure yopu could have found this if you looked for it cus so many did it in so many different ways i did that a year ago.
pawn Код:
dcmd_bp(playerid, params[])
{
new idx, iString[255], strSend[128];
iString = strtok(params, idx);
if(!strlen(iString))
{
return SendClientMessage(playerid, 0xFF2B2BFF, ":ERR: Correct usage: /bp [id]");
}
else
{
new eid = strval(iString);
if(IsPlayerConnected(eid) && eid != playerid)
{
new Float:px, Float:py, Float:pz, pi;
GetPlayerPos(playerid, px, py, pz);
pi = GetPlayerInterior(playerid);
SetPlayerInterior(eid, pi);
SetPlayerPos(eid, px+1, py+1, pz);
format(strSend, 128, ":SNX: You've been brought to Id:[%d]", playerid);
SendClientMessage(eid, 0xFFFF00AA, strSend);
format(strSend, 128, ":SNX: You brought Id:[%d] to you.", eid);
return SendClientMessage(playerid, 0xFFFF00AA, strSend);
}
else return SendClientMessage(playerid, 0xFF2B2BFF, ":ERR: Invalid Player ID");
}
}
pawn Код:
dcmd_tp(playerid, params[])
{
new idx, iString[255], strSend[128];
iString = strtok(params, idx);
if(!strlen(iString))
{
return SendClientMessage(playerid, 0xFF2B2BFF, ":ERR: Correct usage: /tp [id]");
}
else
{
new eid = strval(iString);
if(IsPlayerConnected(eid) && eid != playerid)
{
new Float:px, Float:py, Float:pz, pi;
GetPlayerPos(eid, px, py, pz);
pi = GetPlayerInterior(eid);
SetPlayerInterior(playerid, pi);
SetPlayerPos(playerid, px+1, py+1, pz);
format(strSend, 128, ":SNX: Id:[%d] has teleported to you.", playerid);
SendClientMessage(eid, 0xFFFF00AA, strSend);
format(strSend, 128, ":SNX: You teleported to Id:[%d].", eid);
return SendClientMessage(playerid, 0xFFFF00AA, strSend);
}
else return SendClientMessage(playerid, 0xFF2B2BFF, ":ERR: Invalid Player ID");
}
}