PDA

View Full Version : onplayerclickplayer teleport


MathijsS
10/12/2011, 04:02 PM
Hi, today i made a teleport 'command' on the callback 'onplayerclickplayer'.
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(DM[playerid] == 1) return SendClientMessage(playerid,COLOR_MGREEN,"[Info] Je kan dit commando nu niet gebruiken");
if(DM[clickedplayerid] == 1) return SendClientMessage(playerid,COLOR_MGREEN,"[Info] Deze persoon is in een DM-Zone");
new Float: X, Float: Y, Float: Z;
GetPlayerPos(clickedplayerid,X,Y,Z);
SetPlayerPos(playerid, X,Y,Z+2);
new string[128], name[MAX_PLAYER_NAME], clickedname[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
GetPlayerName(playerid,clickedname,MAX_PLAYER_NAME );
format(string,sizeof string,"[Tele] %s is naar teleporteert %s",name, clickedname);
SendClientMessageToAll(COLOR_MBLUE,string);
return 1;
}
everyting works, exept the message, it says 'mathijs teleported to mathijs' butt i did'nt teleport to myself.
Whats wrong?

MathijsS

sansko
10/12/2011, 04:02 PM
clickedname is pointing to playerid which has to be clickedplayerid
(de tweede GetPlayerName)

Flyfishes
10/12/2011, 04:08 PM
clickedname is pointing to playerid which has to be clickedplayerid
(de tweede GetPlayerName)

Which means in easier words that the second GetPlayerName should instead of having playerid it should be clickedplayerid.

suhrab_mujeeb
10/12/2011, 04:13 PM
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(DM[playerid] == 1) return SendClientMessage(playerid,COLOR_MGREEN,"[Info] Je kan dit commando nu niet gebruiken");
if(DM[clickedplayerid] == 1) return SendClientMessage(playerid,COLOR_MGREEN,"[Info] Deze persoon is in een DM-Zone");
new Float: X, Float: Y, Float: Z;
GetPlayerPos(clickedplayerid,X,Y,Z);
SetPlayerPos(playerid, X,Y,Z+2);
new string[128], name[MAX_PLAYER_NAME], clickedname[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,MAX_PLAYER_NAME);
GetPlayerName(clickedplayerid,clickedname,MAX_PLAY ER_NAME);
format(string,sizeof string,"[Tele] %s is naar teleporteert %s",name, clickedname);
SendClientMessageToAll(COLOR_MBLUE,string);
return 1;
}

GetPlayerName(playerid,clickedname,MAX_PLAYER_NAME );
replaced with
GetPlayerName(clickedplayerid,clickedname,MAX_PLAY ER_NAME);