Anyone can use /goto command? (Urgent problem!!!)
#1

Hey guys, what is really annoying me is my /goto command. I added it so admins can only use it, and some SendClientMessage's are in there. The problem is that when I go in-game, anyone can use it, and no messages come up. It is really annoying! Here is my code:

[pawn]CMD:goto(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 2)return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
new ID;
new pn[MAX_PLAYER_NAME];
new an[MAX_PLAYER_NAME];
new str[128];
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /goto [ID]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is not connected");//Same as !IsPlayerAdmin, but instead of "playerid" we put "ID" because it's the targetid
GetPlayerName(playerid, an, MAX_PLAYER_NAME);
GetPlayerName(ID, pn, MAX_PLAYER_NAME);
new Float;
new Float:y;
new Float:z;
GetPlayerPos(ID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z); //This line set the "playerid" position from "ID" position, with some changes(x+1, y+1);
format(str, sizeof(str), "You have been teleported to %s", pn);
SendClientMessage(playerid, 0x00FF00AA, str);
if(IsPlayerInAnyVehicle(playerid)) //Mhh, let's give you a question, what should this callback do?
{
GetPlayerPos(ID, x, y, z);
SetVehiclePos(playerid, x+1, y+1, z);
}
return 1;
}[/pawno]

As you can see, I set it so admins can use it, and some Messages there aswell, but nothing comes up. Please help! Thanks
Reply
#2

pawn Код:
CMD:goto(playerid, params[])
{
if(pInfo[playerid][Adminlevel] >= 2)
{
new ID;
new pn[MAX_PLAYER_NAME];
new an[MAX_PLAYER_NAME];
new str[128];
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, 0xFF0000AA, "USAGE: /goto [ID]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, 0xFF0000AA, "ERROR: This player is not connected");//Same as !IsPlayerAdmin, but instead of "playerid" we put "ID" because it's the targetid
GetPlayerName(playerid, an, MAX_PLAYER_NAME);
GetPlayerName(ID, pn, MAX_PLAYER_NAME);
new Float;
new Float:y;
new Float:z;
GetPlayerPos(ID, x, y, z);
SetPlayerPos(playerid, x+1, y+1, z); //This line set the "playerid" position from "ID" position, with some changes(x+1, y+1);
format(str, sizeof(str), "You have been teleported to %s", pn);
SendClientMessage(playerid, 0x00FF00AA, str);
if(IsPlayerInAnyVehicle(playerid)) //Mhh, let's give you a question, what should this callback do?
{
GetPlayerPos(ID, x, y, z);
SetVehiclePos(playerid, x+1, y+1, z);
}
}
else return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
return 1;
}
i changed this:
pawn Код:
if(pInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
to
pawn Код:
if(pInfo[playerid][Adminlevel] >= 2)
{
// codes here
}
else return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
greets
Reply
#3

I managed to fix it my self. I changed /goto to /pgoto. But the /goto command still exists when I deleted it? Can someone please help!
Reply
#4

Please help someone!
Reply
#5

It's not possible if you've delete so it whould be working ...
Reply
#6

Quote:

You may only bump your thread after 24 hours has passed since the last reply.

My pleasure.
Reply
#7

PHP код:
CMD:goto(playeridparams[])
{
if(
pInfo[playerid][Adminlevel] >= 2)
{
new 
ID;
new 
an[MAX_PLAYER_NAME];
new 
str[128];
if(
sscanf(params"u"ID)) return SendClientMessage(playerid0xFF0000AA"USAGE: /goto [ID]");
if(!
IsPlayerConnected(ID)) return SendClientMessage(playerid0xFF0000AA"ERROR: This player is not connected");//Same as !IsPlayerAdmin, but instead of "playerid" we put "ID" because it's the targetid
GetPlayerName(playeridanMAX_PLAYER_NAME);
new 
FloatxFloatyFloatz;
GetPlayerPos(IDxyz);
SetPlayerPos(playeridxyz); //This line set the "playerid" position from "ID" position, with some changes(x+1, y+1);
format(strsizeof(str), "You have been teleported to %f, %f, %f"z);
SendClientMessage(playerid0x00FF00AAstr);
if(
IsPlayerInAnyVehicle(playerid)) //Mhh, let's give you a question, what should this callback do?
{
GetPlayerPos(IDxyz);
SetVehiclePos(playeridxyz);
}
}
else return 
SendClientMessage(playerid0xFF0000FF"You are not authorised to use this command");
return 
1;

Reply
#8

I've deleted the command, even moved everything in my script to another folder, and it still doesn't work! It happened to me before! Is there a way to block it or something!
Reply
#9

CMD:goto(playerid, params[])
{
new ID;
if(PlayerInfo[playerid][pAdmin] >= 2)
{
if(sscanf(params, "u", ID)) SendClientMessage(playerid, -1, "USAGE: /goto [playerid]");//checks if you have written something after /goto if no it sends error
else if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_GRAD2, "Invalid player specified !");
else if(playerid == ID) return SendClientMessage(playerid, COLOR_GRAD2, "You can't goto yourself !");//checks if the player you are teleporting to is connected or if it is yourself if yes then comes an error
else//ELSE what will happen if no errors
{
new pinterior = GetPlayerInterior(ID);
new Float, Float:y, Float:z;//creates new floats
GetPlayerPos(ID, x, y, z);//gets the player id(which we have entered after /goto position and like saves them into x,y,z defined above as floats
SetPlayerPos(playerid, x+1, y+1, z);//sets the player position the id of that player +1 in x +1 in y and z remains same as it defines height
SetPlayerInterior(playerid, pinterior);
}
}
else return SendClientMessage(playerid, COLOR_GRAD2, NOTADMIN);
return 1;
}
Reply
#10

It still doesn't work? Is there a way to block the command or something! It is really annoying! HELP PLEASE!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)