SA-MP Forums Archive
How can i do such a command "/goto*teleport-name*" - 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: How can i do such a command "/goto*teleport-name*" (/showthread.php?tid=574602)



How can i do such a command "/goto*teleport-name*" - Metharon - 18.05.2015

I want to create a dynamic system..


To make "/goto"

- If there's a playerid , to go the player.
- If there's a teleportname to go the the teleport.


Do you have any ideas how to do it ? for example if there's no player with that name to search on the teleport names


Re: How can i do such a command "/goto*teleport-name*" - Evocator - 18.05.2015

You can easily use sccanf's u specifier;

Код:
CMD:goto(playerid, params[])
{
	new 
		id;

	if (sscanf(params, "u", id)) {
		return SendClientMessage(playerid, -1, "/goto <name/id>");
	}

	if (!IsPlayerConnected(id)) {
		return SendClientMessage(playerid, -1, "/goto <name/id> - Not online.");
	}

	new 
		Float:Pos[3];

	GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
	SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
	SendClientMessage(playerid, -1, "TPED!");
	SendClientMessage(playerid, -1, "SOMEONE TPED TO YOU!");

	return 1;
}



Re: How can i do such a command "/goto*teleport-name*" - suni - 18.05.2015

Quote:

CMD:goto(playerid, params[])
{
new id;
if(PlayerAcc[playerid][Admin] >= 1) ////your admin level here
{
if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "Goto: /goto (id)");
if(id == INVALID_PLAYER_ID) return ErrorMessages(playerid, 2);
if(id == playerid) return ErrorMessages(playerid, 4);
new Float, Float:y, Float:z;
GetPlayerPos(id, x, y, z);
SetPlayerInterior(playerid, GetPlayerInterior(id));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
if(GetPlayerState(playerid) == 2)
{
SetVehiclePos(GetPlayerVehicleID(playerid), x+3, y, z);
LinkVehicleToInterior(GetPlayerVehicleID(playerid) , GetPlayerInterior(id));
SetVehicleVirtualWorld(GetPlayerVehicleID(playerid ), GetPlayerVirtualWorld(id));
}
else SetPlayerPos(playerid, x+2, y, z);
}
else return ErrorMessages(playerid, 1);
return 1;
}

replace the admin level or remove it