help teleport
#1

PHP код:
CMD:goto(playeridparams[]) 

    new 
id
    if(
IsPlayerConnected(id)) 
    { 
        if ( 
GetPVarIntplayerid"AdminLevel" ) < 1
            return 
SendClientMessageplayerid, -1"You are not allowed to use this command!"); 
        { 
            if(!
sscanf(params"ui"id)) 
            { 
                new 
string[64]; 
                new 
vehid GetPlayerVehicleID(playerid);; 
                new 
name[MAX_PLAYER_NAME]; 
                new 
Float:xFloat:yFloat:z;
                new 
PlayerName[MAX_PLAYER_NAME]; 
                
GetPlayerPos(id,x,y,z); 
                
GetVehiclePos(vehid,x,y,z); 
                
SetPlayerInterior(playerid,GetPlayerInterior(id)); 
                
GetPlayerName(playeridnamesizeof(name)); 
                
GetPlayerName(idPlayerNamesizeof(PlayerName)); 
                
format(stringsizeof(string), ""ORANGESV"%s {FFFFFF}teleported his self to you."name); 
                
SendClientMessage(id, -1string); 
                
format(stringsizeof(string), "You teleported yourself to "ORANGESV"%s."PlayerName); 
                
SendClientMessage(playerid, -1string); 
                
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id)); 
                
SetPlayerPos(playerid,x+2,y,z); 
                
SetVehiclePos(vehid,x+2,y,z); 
                
PutPlayerInVehicle(playeridvehid0); 
                return 
1
            } 
            else return 
SendClientMessage(playerid, -1"Usage : /goto [id/name]"); 
        } 
    } 
    else return 
SendClientMessage(playerid, -1"Player is not connected."); 

Quote:

C:\Users\cyber\Desktop\New Text Document.txt(3403) : error 036: empty statement
C:\Users\cyber\Desktop\New Text Document.txt(3412) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\cyber\Desktop\New Text Document.txt(3412) : error 017: undefined symbol "ORANGESV"
C:\Users\cyber\Desktop\New Text Document.txt(3412) : error 029: invalid expression, assumed zero
C:\Users\cyber\Desktop\New Text Document.txt(3412) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Reply
#2

remove the second ";"
Код:
new vehid = GetPlayerVehicleID(playerid);;
Make sure that "ORANGESV" is defined, also check that for more help
Reply
#3

PHP Code:
Quote:

CMD:goto(playerid, params[])
{
new id;
if(IsPlayerConnected(id))
{
if ( GetPVarInt( playerid, "AdminLevel" ) < 1)
return SendClientMessage( playerid, -1, "You are not allowed to use this command!");
{
if(!sscanf(params, "ui", id))
{
new string[64];
new vehid = GetPlayerVehicleID(playerid);;
new name[MAX_PLAYER_NAME];
new Float, Float:y, Float:z;
new PlayerName[MAX_PLAYER_NAME];
GetPlayerPos(id,x,y,z);
GetVehiclePos(vehid,x,y,z);
SetPlayerInterior(playerid,GetPlayerInterior(id));
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), ""ORANGESV"%s {FFFFFF}teleported his self to you.", name);
SendClientMessage(id, -1, string);
format(string, sizeof(string), "You teleported yourself to "ORANGESV"%s.", PlayerName);
SendClientMessage(playerid, -1, string);
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWor ld(id));
SetPlayerPos(playerid,x+2,y,z);
SetVehiclePos(vehid,x+2,y,z);
PutPlayerInVehicle(playerid, vehid, 0);
return 1;
}
else return SendClientMessage(playerid, -1, "Usage : /goto [id/name]");
}
}
else return SendClientMessage(playerid, -1, "Player is not connected.");
}
Quote:
C:\Users\cyber\Desktop\New Text Document.txt(3403) : error 036: empty statement
C:\Users\cyber\Desktop\New Text Document.txt(3412) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\cyber\Desktop\New Text Document.txt(3412) : error 017: undefined symbol "ORANGESV"
C:\Users\cyber\Desktop\New Text Document.txt(3412) : error 029: invalid expression, assumed zero
C:\Users\cyber\Desktop\New Text Document.txt(3412) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


/************|TRY THIS|**************/
#define ORANGESV
CMD:goto(playerid, params[])
{
new id;
if(IsPlayerConnected(id))
{
if ( GetPVarInt( playerid, "AdminLevel" ) < 1)
return SendClientMessage( playerid, -1, "You are not allowed to use this command!");
{
if(!sscanf(params, "ui", id))
{
new string[64];
new vehid = GetPlayerVehicleID(playerid);;
new name[MAX_PLAYER_NAME];
new Float, Float:y, Float:z;
new PlayerName[MAX_PLAYER_NAME];
GetPlayerPos(id,x,y,z);
GetVehiclePos(vehid,x,y,z);
SetPlayerInterior(playerid,GetPlayerInterior(id));
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(id, PlayerName, sizeof(PlayerName));
format(string, sizeof(string), ""ORANGESV"%s {FFFFFF}teleported his self to you.", name);
SendClientMessage(id, -1, string);
format(string, sizeof(string), "You teleported yourself to "ORANGESV"%s.", PlayerName);
SendClientMessage(playerid, -1, string);
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWor ld(id));
SetPlayerPos(playerid,x+2,y,z);
SetVehiclePos(vehid,x+2,y,z);
PutPlayerInVehicle(playerid, vehid, 0);
return 1;
}
else return SendClientMessage(playerid, -1, "Usage : /goto [id/name]");
}
}
else return SendClientMessage(playerid, -1, "Player is not connected.");
}
Reply
#4

Use php code
Reply
#5

Wrong, will repost in a second.
Reply
#6

Try this:
PHP код:
CMD:goto(playeridparams[])
{
    new 
id;
    if(
IsPlayerConnected(id))
    {
        if ( 
GetPVarIntplayerid"AdminLevel" ) < 1)
            return 
SendClientMessageplayerid, -1"You are not allowed to use this command!");
        {
            if(!
sscanf(params"ui"id))
            {
                new 
string[64];
                new 
vehid GetPlayerVehicleID(playerid);
                new 
name[MAX_PLAYER_NAME];
                new 
Float:xFloat:yFloat:z;
                new 
PlayerName[MAX_PLAYER_NAME];
                
GetPlayerPos(id,x,y,z);
                
GetVehiclePos(vehid,x,y,z);
                
SetPlayerInterior(playerid,GetPlayerInterior(id));
                
GetPlayerName(playeridnamesizeof(name));
                
GetPlayerName(idPlayerNamesizeof(PlayerName));
                
format(stringsizeof(string), "{FF4500}%s {FFFFFF}teleported his self to you."name);
                
SendClientMessage(id, -1string);
                
format(stringsizeof(string), "You teleported yourself to {FF4500}%s."PlayerName);
                
SendClientMessage(playerid, -1string);
                
SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(id));
                
SetPlayerPos(playerid,x+2,y,z);
                
SetVehiclePos(vehid,x+2,y,z);
                
PutPlayerInVehicle(playeridvehid0);
                return 
1;
            }
            else return 
SendClientMessage(playerid, -1"Usage : /goto [id/name]");
        }
    }
    else return 
SendClientMessage(playerid, -1"Player is not connected.");

If it's not the correct color for ORANGESV, you need to get the hex code and put it inside these brackets: {COLORCODE} so, for e.g: ****** Orange Hex Code and just get the code and do this, {FF4500}.

Reply
#7

Reworked how you processed the entire command because it was very sloppy, in my opinion.

Neaten up the code while you create things. It will help in the future for reading over, editing, and passing along code to others.

Plus, you were grabbing and setting variables that aren't always going to be true, therefore, narrow it down.

Hopefully this suffices your needs, if not, let me know.

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

	new id;

	if ( GetPVarInt( playerid, "AdminLevel" ) < 1 )
			return SendClientMessage( playerid, -1, "You are not allowed to use this command!" );

	if ( sscanf( params, "u", id ) )
			return SendClientMessage( playerid, -1, "Usage : /goto [id/name]" );

	if ( IsPlayerConnected( id ) ) {

		new
			adminName[MAX_PLAYER_NAME],
			playerName[MAX_PLAYER_NAME],
			string[64],
			vehid,
			Float:x,
			Float:y,
			Float:z
		;

		GetPlayerPos( id, x, y, z );
		GetPlayerName( playerid, adminName, sizeof( adminName ) );
		GetPlayerName( id, playerName, sizeof( playerName ) );

		SetPlayerVirtualWorld( playerid, GetPlayerVirtualWorld( id ) );
		SetPlayerInterior( playerid, GetPlayerInterior( id ) );

		if ( IsPlayerInAnyVehicle( playerid ) ) {

			vehid = GetPlayerVehicleID( playerid );
			SetVehiclePos( vehid, x + 2, y, z );

		} else {

			SetPlayerPos( playerid, x + 2, y, z );

		}

		format( string, sizeof( string ), "{FF4500}'%s' {FFFFFF}has teleported to you.", adminName );
		SendClientMessage( id, -1, string );

		format( string, sizeof( string ), "You teleported yourself to {FF4500}'%s'.", playerName );
		SendClientMessage( id, -1, string );


	} else {

		return SendClientMessage( playerid, -1, "Player is not connected." );

	}

	return 1;

}
Код:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
Reply
#8

if without admin, i try before but it give a lot of error
Reply
#9

Quote:
Originally Posted by asri
Посмотреть сообщение
if without admin, i try before but it give a lot of error
I don't understand what you're saying here.

What do you mean? Post the errors you're getting.
Reply
#10

fix.how to make command that close/open goto command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)