SA-MP Forums Archive
Player ID bugs - 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: Player ID bugs (/showthread.php?tid=496280)



Player ID bugs - mixmadamich - 21.02.2014

when I try to teleport to someone ( /gotoid ) It says teleported but it doesn't teleport to somebody its just teleporting to my self.

It is same for everything /givemoney /makeadmin /makehelper its just making me helper giveing me money and making me admin!

Thanks!

Код:
CMD:gotoid(playerid, params[])
{
	new giveplayerid;
	if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid]");

	new Float:plocx,Float:plocy,Float:plocz;
	if (IsPlayerConnected(giveplayerid))
	{
		if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
		if (PlayerInfo[playerid][pAdmin] >= 2)
		{
			if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
			{
				SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone.");
				return 1;
			}
			if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
			{
				SendClientMessageEx(playerid, COLOR_GRAD2, "You can not do this while spectating.");
				return 1;
			}
			GetPlayerPos(giveplayerid, plocx, plocy, plocz);
			SetPlayerVirtualWorld(playerid, PlayerInfo[giveplayerid][pVW]);
			Streamer_UpdateEx(playerid, plocx, plocy, plocz);

			if (GetPlayerState(playerid) == 2)
			{
				new tmpcar = GetPlayerVehicleID(playerid);
				SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
				TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
			}
			else
			{
				SetPlayerPos(playerid,plocx,plocy+2, plocz);
				SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
				SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
			}

			SendClientMessageEx(playerid, COLOR_GRAD1, "   You have been teleported!");
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
		}

	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
	return 1;
}



Re: Player ID bugs - Ryan_Undering - 21.02.2014

Quote:
Originally Posted by mixmadamich
Посмотреть сообщение
when I try to teleport to someone ( /gotoid ) It says teleported but it doesn't teleport to somebody its just teleporting to my self.

It is same for everything /givemoney /makeadmin /makehelper its just making me helper giveing me money and making me admin!

Thanks!
Make sure that you're acquiring the TARGET ID not the PLAYER ID -- Provide an example of code and maybe someone can fix it for you.


Re: Player ID bugs - mixmadamich - 21.02.2014

Quote:

Make sure that you're acquiring the TARGET ID not the PLAYER ID -- Provide an example of code and maybe someone can fix it for you.

What do you mean with TARGET ID?

this is the /gotoid command

Код:
CMD:gotoid(playerid, params[])
{
	new giveplayerid;
	if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid]");

	new Float:plocx,Float:plocy,Float:plocz;
	if (IsPlayerConnected(giveplayerid))
	{
		if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
		if (PlayerInfo[playerid][pAdmin] >= 2)
		{
			if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
			{
				SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone.");
				return 1;
			}
			if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
			{
				SendClientMessageEx(playerid, COLOR_GRAD2, "You can not do this while spectating.");
				return 1;
			}
			GetPlayerPos(giveplayerid, plocx, plocy, plocz);
			SetPlayerVirtualWorld(playerid, PlayerInfo[giveplayerid][pVW]);
			Streamer_UpdateEx(playerid, plocx, plocy, plocz);

			if (GetPlayerState(playerid) == 2)
			{
				new tmpcar = GetPlayerVehicleID(playerid);
				SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
				TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
			}
			else
			{
				SetPlayerPos(playerid,plocx,plocy+2, plocz);
				SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
				SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
			}

			SendClientMessageEx(playerid, COLOR_GRAD1, "   You have been teleported!");
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
		}

	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
	return 1;
}



Re: Player ID bugs - Necip - 21.02.2014

Show us the code, then we will be able to help you.


Re: Player ID bugs - mixmadamich - 21.02.2014

Quote:

Show us the code, then we will be able to help you.

Код:
CMD:gotoid(playerid, params[])
{
	new giveplayerid;
	if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /gotoid [playerid]");

	new Float:plocx,Float:plocy,Float:plocz;
	if (IsPlayerConnected(giveplayerid))
	{
		if(PlayerInfo[playerid][pAdminDuty] == 0) return SendClientMessage(playerid, -1, "You must be on Admin Duty to use this Command!");
		if (PlayerInfo[playerid][pAdmin] >= 2)
		{
			if(GetPlayerState(giveplayerid) == PLAYER_STATE_SPECTATING)
			{
				SendClientMessageEx(playerid, COLOR_GRAD2, "That player is spectating someone.");
				return 1;
			}
			if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)
			{
				SendClientMessageEx(playerid, COLOR_GRAD2, "You can not do this while spectating.");
				return 1;
			}
			GetPlayerPos(giveplayerid, plocx, plocy, plocz);
			SetPlayerVirtualWorld(playerid, PlayerInfo[giveplayerid][pVW]);
			Streamer_UpdateEx(playerid, plocx, plocy, plocz);

			if (GetPlayerState(playerid) == 2)
			{
				new tmpcar = GetPlayerVehicleID(playerid);
				SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
				TelePos[playerid][0] = 0.0;TelePos[playerid][1] = 0.0;
			}
			else
			{
				SetPlayerPos(playerid,plocx,plocy+2, plocz);
				SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
				SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
			}

			SendClientMessageEx(playerid, COLOR_GRAD1, "   You have been teleported!");
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
		}

	}
	else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
	return 1;
}



Re: Player ID bugs - ACI - 21.02.2014

Instead of "u", try it with "r".


Re: Player ID bugs - mixmadamich - 21.02.2014

Quote:

Instead of "u", try it with "r".

Doesn't work :P


Re: Player ID bugs - zola0311 - 21.02.2014

upgrade your sscanf plugin and include


Re: Player ID bugs - Beckett - 21.02.2014

What happens, it teleports you to yourself? (ur XYZ + +2) ??


Re: Player ID bugs - mixmadamich - 21.02.2014

Quote:

What happens, it teleports you to yourself? (ur XYZ + +2) ??

Yes it does