/goto Command
#1

How would I do it? I am confused at how I get the other players co-ords and the whole command basically..
Reply
#2

Ok, so you want to go to a location or a player?
Reply
#3

well it's easy, we will use zcmd
pawn Код:
CMD:goto(playerid,params[])
{
//first we define the targetid
new targetid;
//we will use sscanf too if the player didn't write the right command
if(sscanf(params,"u",targetid)) return SendClientMessage(playerid,GetPlayerColor(playerid),"[ERROR]/goto [playerid]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,GetPlayerColor(playerid),"[ERROR]player not connected");//if the player is not connected it will send a message to the playerid (which is you) telling that that player is invalid or not connected
if(playerid == targetid) return SendClientMessage(playerid,GetPlayerColor(playerid),"You Can't teleport to yourself");//if the playerid is the targetid
//x,y,z of the targetid
new Float:x,Float:y,Float:z;
GetPlayerPos(targetid,x,y,z);//get the pos of targetid
SetPlayerPos(playerid,x,y,z);//set the pos of the playerid to the targetid
return 1;
}
Reply
#4

I did all that, but I have 3 errors on the first line:
error 029: invalid expression, assumed zero
error 017: undefined symbol "cmd_goto"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line
Reply
#5

Include zcmd or y_commands.
Reply
#6

I have
Reply
#7

Do this
PHP код:
#include <a_samp>
#include <zcmd>  // Write this <----
// At top of your script under
// And make sure that zcmd.inc is at your include folder. 
Reply
#8

Quote:
Originally Posted by DragoA
Посмотреть сообщение
I have
check the lines above that code, you must be missing "{" in the portion above CMD:goto
Reply
#9

warning 201: redefinition of constant/macro (symbol "CMD:%0(%1)")
warning 201: redefinition of constant/macro (symbol "COMMAND")
undefined symbol "@yC_tp"
undefined symbol "@yC_tp"
error 017: undefined symbol "i"
fatal error 107: too many error messages on one line

I am getting this..
Reply
#10

maybe this code needs an some thing well try this


Код:
{
	if(IsLogged[playerid] != 1) return SendClientMessage(playerid,-1,"You are not logged in");
	if(dini_Int(pFile(playerid),"AdminLevel") >= 1)
	{
     if(AdminLogin[playerid] != 1) return SendClientMessage(playerid,COLOR_GREY,"Error: You are not logged in as Administrator!");
		new player1;
	    if(sscanf(params, "u", player1)) return
		SendClientMessage(playerid, COLOR_WHITE, "Usage: /goto [PlayerID]") &&
		SendClientMessage(playerid, COLOR_ORANGE, "Function: Will teleport you to a specified player");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
            	new TeleporterName[MAX_PLAYER_NAME], ToPlayer[MAX_PLAYER_NAME], string3[128], string4[128];
				new Float:tX, Float:tY, Float:tZ;
				GetPlayerPos(player1, tX, tY, tZ);
				GetPlayerName(player1, ToPlayer, sizeof(ToPlayer));
    			        GetPlayerName(playerid, TeleporterName, sizeof(TeleporterName));
				SetPlayerInterior(playerid,GetPlayerInterior(player1));
				format(string3, sizeof(string3), "You have teleported to %s's position.", ToPlayer);
				format(string4, sizeof(string4), "An Admin has Teleported to your position.");
				SendClientMessage(playerid, COLOR_SYSTEM, string3);
				SendClientMessage(player1, COLOR_ORANGE, string4);
				if (GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
				{
					new VehicleID = GetPlayerVehicleID(playerid);
					SetVehiclePos(VehicleID, tX, tY+2, tZ);
				}
				else
				{
					SetPlayerPos(playerid, tX, tY+2, tZ);
				}
				return 1;
	    }
		else return ErrorMessages(playerid, 2);
	}else return 0;
}
you can edit if you want!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)