/goto /enablegoto /disablegoto +REP -
[SU]Spartan - 14.09.2014
Hello,
I wanna make a /goto [ID] cmd and which you can tele to other players.Well for example I type /goto 2 and ID 2 has typed /disablegotos . a message will come saying "This player has disabled goto" and if ID 2 types /enablegotos , I wil be able to tele to him. I wil rep
Re: /goto /enablegoto /disablegoto +REP -
IceBilizard - 14.09.2014
pawn Код:
new DisableGoto[MAX_PLAYERS];//On top of script
CMD:disablegoto(playerid,params[])
{
DisableGoto[playerid] = 1;
}
CMD:enablegoto(playerid,params[])
{
DisableGoto[playerid] = 0;
}
CMD:goto(playerid,params[])
{
if(IsPlayerAdmin(playerid))//Is Player Rcon Admin
{
new player1;
if(sscanf(params, "u", player1)) return
SendClientMessage(playerid, COLOR_WHITE, "Usage: /goto [PlayerID]") &&
SendClientMessage(playerid, COLOR_ORANGE, "Function: Will teleport you to a specified player");
if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
{
new TeleporterName[MAX_PLAYER_NAME], ToPlayer[MAX_PLAYER_NAME], string3[128], string4[128];
new Float:tX, Float:tY, Float:tZ;
if(DisableGoTo[player1] == 1) return SendClientMessage(playerid,-1,"This player has disabled goto");
GetPlayerPos(player1, tX, tY, tZ);
GetPlayerName(player1, ToPlayer, sizeof(ToPlayer));
GetPlayerName(playerid, TeleporterName, sizeof(TeleporterName));
SetPlayerInterior(playerid,GetPlayerInterior(player1));
format(string3, sizeof(string3), "You have teleported to %s's position.", ToPlayer);
format(string4, sizeof(string4), "An Admin has Teleported to your position.");
SendClientMessage(playerid, -1, string3);
SendClientMessage(player1, -1, string4);
if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new VehicleID = GetPlayerVehicleID(playerid);
SetVehiclePos(VehicleID, tX, tY+2, tZ);
}
else
{
SetPlayerPos(playerid, tX, tY+2, tZ);
}
return 1;
}
else return 0;
}else return 0;
}
Re: /goto /enablegoto /disablegoto +REP -
Gogeta101 - 14.09.2014
Here i didint test it but might work.
pawn Код:
new gotostatus[MAX_PLAYERS];
//Global Variables.
CMD:gotoON(playerid, params[])
{
gotostatus[playerid] = 1
SendClientMessage(playerid,-1,"[SERVER]:Players can teleport to you now");
return 1;
}
CMD:gotoOFF(playerid, params[])
{
gotostatus[playerid] = 0
SendClientMessage(playerid,-1,"[SERVER]:Players can teleport to you now");
return 1;
}
CMD:goto(playerid, params[])
{
if(gotostatus == 1)
{
new Float:X,Float:Y,Float:Z;
new targetid;
if(sscanf(params,"ui",targetid)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]/goto [PlayerID]");
GetPlayerPos(targetid,X,Y,Z);
SetPlayerPos(playerid,X,Y,Z);
}
else
{
SendClientMessage(playerid,-1,"Tell your friend to /gotoON ");
}
return 1;
}
Re: /goto /enablegoto /disablegoto +REP -
[SU]Spartan - 14.09.2014
i get many errors on both sides -_-
Re: /goto /enablegoto /disablegoto +REP -
Abagail - 14.09.2014
pawn Код:
#include a_samp
#include zcmd
#include sscanf2
new GotoTog[MAX_PLAYERS];
CMD:toggoto(playerid, params[])
{
if(!GotoTog[playerid])
{
GotoTog[playerid] = 1;
SendClientMessage(playerid, -1, "People can no longer TP to you.");
return true;
}
else
{
GotoTog[playerid] = 0;
SendClientMessage(playerid, -1, "You can now be TP'ed to again!");
return true;
}
}
CMD:goto(playerid, params[])
{
new giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, -1, "USAGE: /goto [player]");
if(IsPlayerConnected(playerid))
{
if(GotoTog[playerid]==0)
{
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(playerid, X, Y, Z+1);
return true;
}
else return SendClientMessage(playerid, -1, "That person has teleportation disabled.");
}
else return SendClientMessage(playerid, -1, "That player isn't connected.");
}
Untested.
Re: /goto /enablegoto /disablegoto +REP -
Affan - 14.09.2014
pawn Код:
new status[MAX_PLAYERS]; // Change it if you want
// Put status[playerid] = 1 on gamemode
CMD:toggoto(playerd)
{
if(status[playerid] == 1)
{
SendClientMessage(playerid, -1, "You have disabled goto");
status[playerid] = 0;
}
else
{
SendClientMessage(playerid, -1, "You have enabled goto");
status[playerid] = 1;
}
return 1;
}
CMD:goto(playerid, params[])
{
new id, Float:X,Float:Y,Float:Z;
if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "USAGE: /goto <playerid/name>");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "The player is offline");
if(status[id] == 0) return SendClientMessage(playerid, -1, "The player has goto disabled!");
new Interior = GetPlayerInterior(id);
SetPlayerInterior(playerid,Interior);
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
GetPlayerPos(id,X,Y,Z);
if(IsPlayerInAnyVehicle(playerid))
{
SetVehiclePos(GetPlayerVehicleID(playerid), X+ 1, Y+ 1, Z);
LinkVehicleToInterior(GetPlayerVehicleID(playerid),Interior);
}
else SetPlayerPos(playerid, X+ 1,Y+ 1, Z);
return 1;
}
Re: /goto /enablegoto /disablegoto +REP -
Ricagor - 14.09.2014
pawn Код:
if(strcmp(cmdtext, "/goto", true) == 0)
{
new targetid;
if(sscanf(cmdtext[6], "u", targetid))//since in strcmp we cannot use params so i added this cmdtext[6]
{
return SendClientMessage(playerid, COLOR_GRAY, "Usage: /goto [playerid]");
}
else if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "Invalid player specified.");
else if(targetid == playerid) return SendClientMessage(playerid, -1, "You cannot use this command on yourself!");
else if(gototog[targetid] == 1) return SendClientMessage(playerid, -1, "That player has disabled players from going to them");
new Float: pos[3];
GetPlayerPos(targetid, pos[0], pos[1], pos[2]);
SetPlayerInterior(playerid, GetPlayerInterior(targetid));
SetPlayerPos(playerid, pos[0], pos[1], pos[2]);
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));
return 1;
}
if(strcmp(cmdtext, "/toggoto", true) == 0)
{
if(gototog[playerid] == 0)
{
gototog[playerid] = 1;
SendClientMessage(playerid, -1, "Other players may not teleport to you now!");
}
else if(gototog[playerid] == 1)
{
gototog[playerid] = 0;
SendClientMessage(playerid, -1, "Other players may teleport to you now!");
}
return 1;
}
+REP if i helped you.