View Single Post
Author Message
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-17-2023 , 04:05   cant teleport without writing VALUE
Reply With Quote #1

AMX Mod X version 1.9.0.5294
Exe build: 19:52:19 Aug 3 2020 (8684)

I will explain myself again: I have CMD ADMIN As you can see in the code I have
@all,target and more that the beginning of the command is !teleport
for example:
!teleport @all cheezpuff > This makes everyone teleported to me
But if for example I do
!teleport cheezpuff cheezpuff (without writing ORIGIN number)
It makes me teleported to a small screen as if I've been tricked into myself. I want it to block the option
But if I do !teleport cheezpuff 200 200 > It teleported me to Origin 0 on the map
!teleport chee 200 200 200 > That Origin will work
!teleport name name
The problem is that if I do these command without writing origin the player will still be teleported to a certain place (random origin), how can this be blocked

PHP Code:
// Command: Teleport.
CmdTeleport(clientparam[])
{
    
// check param[] is none.
    
if (!CheckUsage(clientTELEPORTparam))
        return;

    
// Split parameter.
    
new fromTarget[32], toTarget[32];
    
argbreak(paramfromTargetcharsmax(fromTarget), toTargetcharsmax(toTarget));

    new 
players[32];
    new 
fPlayer;
    new 
tPlayer;
    new 
pnum 0;
    new 
Float:origin[3], Float:vAngle[3];
    new 
cOriginX[5],cOriginY[5],cOriginZ[5];
    if (
parse(toTargetcOriginXcharsmax(cOriginX), cOriginYcharsmax(cOriginY), cOriginZcharsmax(cOriginZ)) == 3)
    {
        
origin[0] = str_to_float(cOriginX);
        
origin[1] = str_to_float(cOriginY);
        
origin[2] = str_to_float(cOriginZ);
    } else
    {
        
// Get <To:target> player
        
if (GetSingleTargetPlayer(clienttoTargettPlayerfalseALIVE_ONLY))
        {
            
// Get <To:target> player location
            
GetTeleportLocation(tPlayeroriginvAngle);
        }
    }

    
// Get <from:@xxx> player
    
if (GetMultiTargetPlayers(clientfromTargetplayerspnumtrueALIVE_ONLY))
    {
        
// Teleporting <from:@xxx>
        
for(new 0pnumi++)
        {
            if (
is_user_alive(players[i]))
                
doTeleport(players[i], originvAngle);
        }

        
// Print
        
if (pnum)
            
PrintTeleport(0fromTargettPlayerorigin);

        
// End
        
return;
    }

    
// Get <from:target> player
    
if (GetSingleTargetPlayer(clientfromTargetfPlayertrueALIVE_ONLY))
    {
        
// Teleporting <from:target> player
        
if (is_user_alive(fPlayer))
        {
            
doTeleport(fPlayeroriginvAngle);
            
// Print
            
PrintTeleport(0fromTargettPlayerorigin);
        }
        
// End
        
return;
    }
}

//    Teleporting.
doTeleport(id, const Float:origin[3], const Float:vAngle[3])
{
    new 
Float:toVector[3];

    
// Check Stuck.
    
FindEmptyLocation(origintoVector100.0);

    
// Teleport.
    
engfunc(EngFunc_SetOriginidtoVector);
    
set_pev(idpev_v_anglevAngle);
    
set_pev(idpev_fixangle1);

    
UTIL_UnstickPlayer(idSTART_DISTANCEMAX_ATTEMPTS);

EDIT: Now this way blocked me the only Command !teleport name (without writing value)
HTML Code:
	if (parse(toTarget, cOriginX, charsmax(cOriginX), cOriginY, charsmax(cOriginY), cOriginZ, charsmax(cOriginZ)) == 3)
	{
		origin[0] = str_to_float(cOriginX);
		origin[1] = str_to_float(cOriginY);
		origin[2] = str_to_float(cOriginZ);
	} else
	{
		// Get <To:target> player
		if (GetSingleTargetPlayer(client, toTarget, tPlayer, false, ALIVE_ONLY))
		{
			// Get <To:target> player location
			GetTeleportLocation(tPlayer, origin, vAngle);
		}
		else
		{
			client_print_color(client, print_team_default, "Error: Missing or invalid destination target.");
			return;
		}
	}
It's tp myself to the same place
CONSOLE CHAT: print my name when used !teleport name
Quote:
player
player : !teleport player player

Last edited by Fuck For Fun; 06-02-2023 at 05:46.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun