OnPlayerClickPlayer - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerClickPlayer (
/showthread.php?tid=433247)
OnPlayerClickPlayer -
DarkB0y - 26.04.2013
pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(Teleport[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "You can't teleport in class section");
return 1;
}
if(indeathmatch[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "Exit the DM first");
return 1;
}
new Float: X,Float:Y, Float:Z, string[70];
GetPlayerPos(clickedplayerid, X,Y,Z);
SetPlayerPos(playerid, X,Y,Z);
format(string, sizeof(string), "You have teleported to ID: %i", clickedplayerid);
return 1;
}
Thats the code its dont have errors but i need help with 2 things with it
Player can enable it and disable it. So if he dont need any one to teleport to him he disable it and if he need he enable it
The other thing that the player can teleport to the another player The another player is in dm how to make the player can't teleport inDm players
Thx
Re: OnPlayerClickPlayer -
RaZzZzoR - 26.04.2013
Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(Teleport[playerid] == 1 || indeathmatch[playerid] == 1)
{
SendClientMessage(playerid, COLOR_RED, "Exit the DM first");
return 1;
}
else
{
new Float: X,Float:Y, Float:Z, string[70];
GetPlayerPos(clickedplayerid, X,Y,Z);
SetPlayerPos(playerid, X,Y,Z);
format(string, sizeof(string), "You have teleported to ID: %i", clickedplayerid);
}
if(Teleport[playerid] == 0 || indeathmatch[playerid] == 0)
{
//Stuff here
}
return 1;
}
Re: OnPlayerClickPlayer -
DarkB0y - 26.04.2013
Thx but i need a command for the player to enable it and disable it
EDIT : Player still teleport to some one in death match
Re: OnPlayerClickPlayer -
Pottus - 26.04.2013
This should work.
pawn Код:
#define TELEPORT_XOFFSET 2.0
#define TELEPORT_YOFFSET 2.0
new bool:AllowClickTeleport[MAX_PLAYERS] = { true, ... };
CMD:ctele(playerid, arg[])
{
if(AllowClickTeleport[playerid])
{
AllowClickTeleport[playerid] = false;
SendClientMessage(playerid, COLOR_RED, "You have disabled teleport clicking");
}
else
{
AllowClickTeleport[playerid] = true;
SendClientMessage(playerid, COLOR_RED, "You have enabled teleport clicking");
}
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
if(Teleport[playerid] == 1 || indeathmatch[playerid] == 1) SendClientMessage(playerid, COLOR_RED, "Exit the DM first");
else
{
if(Teleport[playerid] == 1 || indeathmatch[playerid] == 1) SendClientMessage(playerid, COLOR_RED, "That player is in a DM");
else
{
if(AllowClickTeleport[clickedplayerid])
{
new Float: X,Float:Y, Float:Z, string[70];
GetPlayerPos(clickedplayerid, X,Y,Z);
SetPlayerPos(playerid, X+TELEPORT_XOFFSET,Y+TELEPORT_YOFFSET,Z);
format(string, sizeof(string), "You have teleported to ID: %i", clickedplayerid);
}
else SendClientMessage(playerid, COLOR_RED, "That player has teleporting disabled");
}
}
return 1;
}