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(client, param[])
{
// check param[] is none.
if (!CheckUsage(client, TELEPORT, param))
return;
// Split parameter.
new fromTarget[32], toTarget[32];
argbreak(param, fromTarget, charsmax(fromTarget), toTarget, charsmax(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(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);
}
}
// Get <from:@xxx> player
if (GetMultiTargetPlayers(client, fromTarget, players, pnum, true, ALIVE_ONLY))
{
// Teleporting <from:@xxx>
for(new i = 0; i < pnum; i++)
{
if (is_user_alive(players[i]))
doTeleport(players[i], origin, vAngle);
}
// Print
if (pnum)
PrintTeleport(0, fromTarget, tPlayer, origin);
// End
return;
}
// Get <from:target> player
if (GetSingleTargetPlayer(client, fromTarget, fPlayer, true, ALIVE_ONLY))
{
// Teleporting <from:target> player
if (is_user_alive(fPlayer))
{
doTeleport(fPlayer, origin, vAngle);
// Print
PrintTeleport(0, fromTarget, tPlayer, origin);
}
// End
return;
}
}
// Teleporting.
doTeleport(id, const Float:origin[3], const Float:vAngle[3])
{
new Float:toVector[3];
// Check Stuck.
FindEmptyLocation(origin, toVector, 100.0);
// Teleport.
engfunc(EngFunc_SetOrigin, id, toVector);
set_pev(id, pev_v_angle, vAngle);
set_pev(id, pev_fixangle, 1);
UTIL_UnstickPlayer(id, START_DISTANCE, MAX_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
|