showing same name

Started by Cool, May 23, 2016, 08:48 PM

Previous topic - Next topic

Cool

when i ban/kick/drown some one its shows same for example
KAKAN drown KAKAN not showing the admin name why thats problem in all commands
i will show u 1 cmds and function
function Drown( player, admin, reason )
{
    Message( " [#4682B4][Info][#FFFFFF]Drown:[ " + player.Name + " ] by Admin:[ " + admin + " ] Reason:[ " + reason + " ]" );
player.Pos = Vector( -597.7496,-1858.9531,28.1291 );
    player.Health = 0;
}
else if ( cmd == "drown" )
{
if ( !text ) MessagePlayer( " [#4682B4][Syntax][#FFFFFF], /" + cmd + " <Nick/ID> <Reason>", player );
local player = GetPlayer( GetTok( text, " ", 1 ) );
if ( !player ) MessagePlayer( " [#4682B4][Error][#FFFFFF]Unknown Player..", player );
else
{
   local reason = GetTok( text, " ", 2, NumTok( text, " " ) );
   if ( reason == null ) reason = "None";
   Drown( player, player, reason );
}
}

aXXo

Are you trying to script only for an educational experience, or do you plan to launch a server?

Cool

Quote from: aXXo on May 23, 2016, 09:07 PMAre you trying to script only for an educational experience, or do you plan to launch a server?
dude i love to learn scripting and its launched but announced by my brother soon i will announce by myself he did not designed well :D

KAKAN

Quote from: Hercules on May 23, 2016, 09:11 PM
Quote from: aXXo on May 23, 2016, 09:07 PMAre you trying to script only for an educational experience, or do you plan to launch a server?
dude i love to learn scripting and its launched but announced by my brother soon i will announce by myself he did not designed well :D
Why so noob english?

Well, you repeat the same player instance using local, that's the problem.
Change the local player to plr and accordingly do all the shits :P
oh no

Xmair

function Drown( player, admin, reason )
{
    Message( " [#4682B4][Info][#FFFFFF]Drown:[ " + player.Name + " ] by Admin:[ " + admin + " ] Reason:[ " + reason + " ]" );
player.Pos = Vector( -597.7496,-1858.9531,28.1291 );
    player.Health = 0;
}
else if ( cmd == "drown" )
{
if ( !text ) MessagePlayer( " [#4682B4][Syntax][#FFFFFF], /" + cmd + " <Nick/ID> <Reason>", player );
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( " [#4682B4][Error][#FFFFFF]Unknown Player..", player );
else
{
   local reason = GetTok( text, " ", 2, NumTok( text, " " ) );
   if ( reason == null ) reason = "None";
   Drown( plr, player, reason );
}
}

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

Anik

Quote from: Hercules on May 23, 2016, 08:48 PMlocal player = GetPlayer( GetTok( text, " ", 1 ) );
 Drown( player, player, reason );
That's where you made a mistake. Replace those lines with these two lines
local plr = GetPlayer( GetTok( text, " ", 1 ) );
Drown( plr, player, reason );