How can i do such a command "/goto*teleport-name*"
#1

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
Reply
#2

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;
}
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)