SA-MP Forums Archive
/goto help [REP] - 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 help [REP] (/showthread.php?tid=328828)



/goto help [REP] - James Coral - 26.03.2012

I need a command !FOR PLAYER!
that it will teleport player to player

Somebody?


Re: /goto help [REP] - Bogdan1992 - 26.03.2012

cba to add the messages so i'll let you to do it.

pawn Код:
CMD:tp(playerid, params[]){
    new id, id2, Float:x, Float:y, Float:z;
    if(sscanf(params,"uu", id, id2)) return SendClientMessage(playerid, -1, "USAGE: tp [id] to [id2]");
    GetPlayerPos(id2, x, y, z);
    SetPlayerPos(id, x, y, z);
    return 1;
}



Re: /goto help [REP] - doreto - 26.03.2012

and if you wonna to tp to player wich your vehicle
PHP код:
CMD:goto(playeridparams[])
{
    new 
ID;
    if(
sscanf(params"u"ID)) SendClientMessage(playerid, -1"USAGE: /goto [playerid]");
    else if(
IsPlayerConnected(ID) == 0SendClientMessage(playerid, -1"Player is not connected!");
    else
    {
        new 
Float:XFloat:YFloat:ZFloat:Angle;
        if(
IsPlayerInAnyVehicle(ID))GetVehiclePos(GetPlayerVehicleID(ID), XYZ), GetVehicleZAngle(GetPlayerVehicleID(ID), Angle);
        else 
GetPlayerPos(IDXYZ), GetPlayerFacingAngle(playeridAngle);
        if(
IsPlayerInAnyVehicle(playerid))SetVehiclePos(GetPlayerVehicleID(playerid), X+1.0Y+1.0Z), SetVehicleZAngle(GetPlayerVehicleID(playerid), Angle);
        else 
SetPlayerPos(playeridX+1.0Y+1.0Z), SetPlayerFacingAngle(playeridAngle);
    }
    return 
true;




Re: /goto help [REP] - James Coral - 26.03.2012

pawn Код:
C:\Users\eesti\Desktop\SAMP\gamemodes\Dream.pwn(73) : error 017: undefined symbol "params"
C:\Users\eesti\Desktop\SAMP\gamemodes\Dream.pwn(73) : error 001: expected token: ")", but found "return"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.



Re: /goto help [REP] - Rafa - 26.03.2012

pawn Код:
CMD:goto(playerid, params[])
{
        new targetid, Float:x, Float:y, Float:z;
        if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /goto [id]");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "That player is not connected");
        GetPlayerPos(targetid, x, y, z);
        SetPlayerPos(playerid, x, y+0.5, z+0.5);
        return 1;
}



Re: /goto help [REP] - James Coral - 26.03.2012

Quote:
Originally Posted by doreto
Посмотреть сообщение
and if you wonna to tp to player wich your vehicle
PHP код:
CMD:goto(playeridparams[])
{
    new 
ID;
    if(
sscanf(params"u"ID)) SendClientMessage(playerid, -1"USAGE: /goto [playerid]");
    else if(
IsPlayerConnected(ID) == 0SendClientMessage(playerid, -1"Player is not connected!");
    else
    {
        new 
Float:XFloat:YFloat:ZFloat:Angle;
        if(
IsPlayerInAnyVehicle(ID))GetVehiclePos(GetPlayerVehicleID(ID), XYZ), GetVehicleZAngle(GetPlayerVehicleID(ID), Angle);
        else 
GetPlayerPos(IDXYZ), GetPlayerFacingAngle(playeridAngle);
        if(
IsPlayerInAnyVehicle(playerid))SetVehiclePos(GetPlayerVehicleID(playerid), X+1.0Y+1.0Z), SetVehicleZAngle(GetPlayerVehicleID(playerid), Angle);
        else 
SetPlayerPos(playeridX+1.0Y+1.0Z), SetPlayerFacingAngle(playeridAngle);
    }
    return 
true;

wtf: it needs a params when i add #pragma unused params it will give me 2 warnings
WTF?


Re: /goto help [REP] - Bogdan1992 - 26.03.2012

...do you use the default system processor for commands?


EDIT: LOL no one of you didn't understand what he wants.


Re: /goto help [REP] - Zxdsl - 26.03.2012

Код:
CMD:goto(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 1 || IsPlayerAdmin(playerid)) {
	    if(isnull(params)) return SendClientMessage(playerid,red,"USAGE: /goto [playerid]");
	    new player1, string[128];
		if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
	   	else player1 = strval(params);
	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) {
		//	CMDMessageToAdmins(playerid,"GOTO");
			new Float:x, Float:y, Float:z;	GetPlayerPos(player1,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(player1));
			SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));
			if(GetPlayerState(playerid) == 2) {
				SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);	LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player1));
				SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1));
			} else SetPlayerPos(playerid,x+2,y,z);
			format(string,sizeof(string),"You have teleported to \"%s\"", pName(player1));
			return SendClientMessage(playerid,blue,string);
		} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}



Re: /goto help [REP] - James Coral - 26.03.2012

I NEED COMMAND LIKE /GOTO! For all of players!


Re: /goto help [REP] - doreto - 26.03.2012

Quote:
Originally Posted by James Coral
Посмотреть сообщение
wtf: it needs a params when i add #pragma unused params it will give me 2 warnings
WTF?
noone have say that you have to "add #progma unset params" you just need sscanf2 include lol i test wichout that and work fine