AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   cant teleport without writing VALUE (https://forums.alliedmods.net/showthread.php?t=342798)

Fuck For Fun 05-17-2023 04:05

cant teleport without writing VALUE
 
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

Fuck For Fun 05-31-2023 14:28

Re: cant teleport without writing VALUE
 
any?

lexzor 05-31-2023 16:16

Re: cant teleport without writing VALUE
 
i don't understand your question. so you want to teleport yourself to.... yourself?

expecting you wanted to write !teleport myname anotherplayername

check if the player is alive, use get_user_origin to get his origin and set your origin to player origin.

fysiks 05-31-2023 23:28

Re: cant teleport without writing VALUE
 
You really need to work on making your posts more understandable. Maybe simply write something to the effect of: "I want this plugin to do X". Also, please just post the whole plugin (if it's already on the forum you merely need to post a link to it). If you modified an existing plugin, post the link as well as your version of the plugin (attach .sma file).

Fuck For Fun 06-02-2023 05:37

Re: cant teleport without writing VALUE
 
Quote:

Originally Posted by lexzor (Post 2805342)
i don't understand your question. so you want to teleport yourself to.... yourself?

expecting you wanted to write !teleport myname anotherplayername

check if the player is alive, use get_user_origin to get his origin and set your origin to player origin.

Quote:

Originally Posted by fysiks (Post 2805351)
You really need to work on making your posts more understandable. Maybe simply write something to the effect of: "I want this plugin to do X". Also, please just post the whole plugin (if it's already on the forum you merely need to post a link to it). If you modified an existing plugin, post the link as well as your version of the plugin (attach .sma file).

Sorry posted by phone, I try to write as quickly as I can well I edited the post EDIT above if it's still not clear of understandable I'll write again.

Link Code: https://forums.alliedmods.net/showpo...70&postcount=5


All times are GMT -4. The time now is 11:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.