28.01.2013, 15:09
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
[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