Raised This Month: $51 Target: $400
 12% 

cant teleport without writing VALUE


Post New Thread Reply   
 
Thread Tools Display Modes
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
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 05-31-2023 , 14:28   Re: cant teleport without writing VALUE
Reply With Quote #2

any?
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-31-2023 , 16:16   Re: cant teleport without writing VALUE
Reply With Quote #3

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.
lexzor is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-31-2023 , 23:28   Re: cant teleport without writing VALUE
Reply With Quote #4

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).
__________________
fysiks is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 06-02-2023 , 05:37   Re: cant teleport without writing VALUE
Reply With Quote #5

Quote:
Originally Posted by lexzor View Post
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 View Post
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

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



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:44.


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