/goto player help
#1

Having some trouble with my admin side of the script. Maybe someone can point out what I'm doing wrong? thanks in advance
Код:
CMD:goto(playerid, params[])
{
	if(PlayerInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command ");
	new targetid, string[128];
	if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /goto [PlayerID/PartOfName]");
	if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]: Player not connected!");
	else
	{
		new pName[24];
		GetPlayerName(targetid,pName,128);
		format(string, sizeof(string), ""#COL_YELLOW"[ADMIN]"#GREEN" You succesfully teleported to [%d] %s.",targetid, pName);
		SendClientMessage(playerid,COLOR_RED,string);
		SetPlayerInterior(playerid,GetPlayerInterior(targetid));
		new Float:TPX, Float:TPY, Float:TPZ;
		GetPlayerPos(targetid, TPX, TPY, TPZ);
		SetPlayerPos(playerid, TPX, TPY, TPZ+1);
	}
	return 1;
}
Reply
#2

Change this:
pawn Код:
if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /goto [PlayerID/PartOfName]");
to:
pawn Код:
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /goto [PlayerID/PartOfName]");
Reply
#3

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
Change this:
pawn Код:
if(sscanf(params, "uz", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /goto [PlayerID/PartOfName]");
to:
pawn Код:
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /goto [PlayerID/PartOfName]");
Still says in-game:
Код:
[ERROR]: Player not connected!
Reply
#4

Did you GMX?
Reply
#5

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
Did you GMX?
Yeah.
Reply
#6

pawn Код:
CMD:goto(playerid, params[])
{
    if(PlayerInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command ");
    new targetid, string[128];
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /goto [PlayerID/PartOfName]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]: Player not connected!");
    new pName[24];
    GetPlayerName(targetid,pName,128);
    format(string, sizeof(string), ""#COL_YELLOW"[ADMIN]"#GREEN" You succesfully teleported to [%d] %s.",targetid, pName);
    SendClientMessage(playerid,COLOR_RED,string);
    SetPlayerInterior(playerid,GetPlayerInterior(targetid));
    new Float:TPX, Float:TPY, Float:TPZ;
    GetPlayerPos(targetid, TPX, TPY, TPZ);
    SetPlayerPos(playerid, TPX, TPY, TPZ+1);
    return 1;
}
Uhh, is there a player online testing this with you?
Reply
#7

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
pawn Код:
CMD:goto(playerid, params[])
{
    if(PlayerInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command ");
    new targetid, string[128];
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /goto [PlayerID/PartOfName]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]: Player not connected!");
    new pName[24];
    GetPlayerName(targetid,pName,128);
    format(string, sizeof(string), ""#COL_YELLOW"[ADMIN]"#GREEN" You succesfully teleported to [%d] %s.",targetid, pName);
    SendClientMessage(playerid,COLOR_RED,string);
    SetPlayerInterior(playerid,GetPlayerInterior(targetid));
    new Float:TPX, Float:TPY, Float:TPZ;
    GetPlayerPos(targetid, TPX, TPY, TPZ);
    SetPlayerPos(playerid, TPX, TPY, TPZ+1);
    return 1;
}
Uhh, is there a player online testing this with you?
Yeah, someone is testing with me.
Reply
#8

Uhh, remove the IsPlayerConnected line, in this day and age with commands like that it's not needed.
Reply
#9

That teleports me, but under the map out into LV I think it is.
Reply
#10

pawn Код:
CMD:goto(playerid, params[])
{
    if(PlayerInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]: You are not authorized to use this command ");
    new targetid, string[128];
    if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_SYNTAX, "[SYNTAX]: /goto [PlayerID/PartOfName]");
    if(IsPlayerConnected(targetid))
    {
        new pName[24];
        GetPlayerName(targetid,pName,128);
        format(string, sizeof(string), ""#COL_YELLOW"[ADMIN]"#GREEN" You succesfully teleported to [%d] %s.",targetid, pName);
        SendClientMessage(playerid,COLOR_RED,string);
        SetPlayerInterior(playerid,GetPlayerInterior(targetid));
        new Float:TPX, Float:TPY, Float:TPZ;
        GetPlayerPos(targetid, TPX, TPY, TPZ);
        SetPlayerPos(playerid, TPX, TPY, TPZ+1);
    }
    else return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]: Player not connected!");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)