if(GotoStatus[targetid] == 1)
{
//Apply your /goto cmd here (The teleports etc)
}
else if(GotoStatus[targetid] == 0) return 0;
new gotost[MAX_PLAYERS];
public OnPlayerConnect(playerid) {
gotost[playerid] = 0; // 0 by default
return 1;
}
CMD:togglegoto(playerid, params[]) {
if(gotost[playerid] == 1) {
SendClientMessage(playerid, -1, "Players can no longer teleport to you.");
gotost[playerid] = 0;
}
else {
SendClientMessage(playerid, -1, "Players can now teleport to you.");
gotost[playerid] = 1;
}
return 1;
}
if(gotost[id] == 1) {
// teleport code
}
else SendClientMessage(playerid, -1, "You cannot teleport to this player.");
pawn Код:
pawn Код:
|
if(gotost[id] == 1) {
dcmd_goto(playerid,params[]) {
if(PlayerInfo[playerid][Level] >= 0 || IsPlayerAdmin(playerid)) {
if(gotost[id] == 1) {
if(!strlen(params)) return SendClientMessage(playerid,red,"{FF0000}Use{FFFFFF}: /Goto [PlayerID]");
new player1, string[128];
if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
else player1 = strval(params);
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) {
CMDMessageToAdmins(playerid,"GOTO");
new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(player1));
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));
if(GetPlayerState(playerid) == 2) {
SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z); LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player1));
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1));
} else SetPlayerPos(playerid,x+2,y,z);
format(string,sizeof(string),"{FFFFFF}You have teleported to {FF0000}\"%s\"", pName(player1));
return SendClientMessage(playerid,blue,string);
else SendClientMessage(playerid, -1, "You cannot teleport to yourself.");
} else return SendClientMessage(playerid, red, "{FF0000}Player is not connected.");
} else return SendClientMessage(playerid,red,"{FF0000}Error{FFFFFF}: This command is only for Members");
}
if(gotost[id] == 1) {
dcmd_goto(playerid,params[]) {
if(!strlen(params)) return SendClientMessage(playerid,red,"{FF0000}Use{FFFFFF}: /Goto [PlayerID]");
new player1, string[128];
if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
else player1 = strval(params);
if(gotost[player1] == 0 && PlayerInfo[playerid][Level] < 1) return SendClientMessage(playerid, red, "Error: you can't teleport to this player right now.");
if(!IsPlayerConnected(player1) || player1 == INVALID_PLAYER_ID || player1 == playerid) return SendClientMessage(playerid, red, "Player is either not connected or is you.");
CMDMessageToAdmins(playerid,"GOTO");
new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(player1));
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));
if(GetPlayerState(playerid) == 2) {
SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);
LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player1));
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1));
}
else SetPlayerPos(playerid,x+2,y,z);
format(string,sizeof(string),"{FFFFFF}You have teleported to {FF0000}\"%s\"", pName(player1));
return SendClientMessage(playerid,blue,string);
}
dcmd_igoto(playerid,params[]) {
#pragma unused params
if(gotost[playerid] == 1) {
SendClientMessage(playerid, -1, "Players can no longer teleport to you.");
gotost[playerid] = 0;
}
else {
SendClientMessage(playerid, -1, "Players can now teleport to you.");
gotost[playerid] = 1;
}
return 1;
}
Edited my previous post, use that goto.
About the warning: pawn Код:
|