SA-MP Forums Archive
/goto player help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /goto player help (/showthread.php?tid=350150)



/goto player help - KiiD - 11.06.2012

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;
}



Re: /goto player help - JhnzRep - 11.06.2012

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]");



Re: /goto player help - KiiD - 11.06.2012

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!



Re: /goto player help - JhnzRep - 11.06.2012

Did you GMX?


Re: /goto player help - KiiD - 11.06.2012

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


Re: /goto player help - JhnzRep - 11.06.2012

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?


Re: /goto player help - KiiD - 11.06.2012

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.


Re: /goto player help - JhnzRep - 11.06.2012

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


Re: /goto player help - KiiD - 11.06.2012

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


Re: /goto player help - JhnzRep - 11.06.2012

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;
}