SetFriendlyFire

FinchDon

  • Sr. Member
  • Posts: 252
SetFriendlyFire
« on September 28th, 2015, 11:19 AM »
Why its not working?

Code: [Select]
friendlyfire <- [ "true", "false"];

Command

Code: [Select]
if ( cmd == "friendlyfire")
{
local ff = friendlyfire[rand()% friendlyfire.len()]
if ( GetLevel( player ) < 2 ) PrivMessage( player, "No!");
else
{
   Error here >>>>> SetFriendlyFire(ff);
Message( " " + player.Name + " set Friendly Fire " + ff + ".");
}
}
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

Xmair

  • Wiki Contributor
  • Posts: 930
Re: SetFriendlyFire
« Reply #1, on September 28th, 2015, 01:34 PM »
.....
Code: [Select]
if ( cmd == "friendlyfire")
{
local ff = random(1,2)
if ( GetLevel( player ) < 2 ) PrivMessage(player,"No!")
else if ( ff == 1 )
{
SetFriendlyFire(true)
Message(player.Name+" has set friendly fire true!");
}
else if ( ff == 2 )
{
SetFriendlyFire(false)
Message(player.Name+" has set friendly fire false!");
}
}
function random(start, finish)
{
 local ran = ((rand() % (finish - start)) + start);
 return ran;
}
Untested...
VU Full Member | VCCNR Developer | KTB Developer | EAD Ex-Scripter

FinchDon

  • Sr. Member
  • Posts: 252
Re: SetFriendlyFire
« Reply #2, on September 28th, 2015, 01:38 PM »
Is There any other way?
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

MacTavish

  • Hero Member
  • Nicks( Kusanagi, Beztone, RATHORE )
  • Posts: 809
Re: SetFriendlyFire
« Reply #3, on September 28th, 2015, 02:27 PM »
This could be made directly without random function

Code: [Select]
if ( cmd == "friendlyfire")
{
local ff = rand() % 2;
if ( GetLevel( player ) < 2 ) PrivMessage(player,"No!")
else if ( ff == 1 )
{
SetFriendlyFire(true)
Message(player.Name+" has set friendly fire true!");
}
else if ( ff == 2 )
{
SetFriendlyFire(false)
Message(player.Name+" has set friendly fire false!");
}
}


If you want it togle then use this

Code: [Select]
if ( cmd == "friendlyfire")
{
if ( GetLevel( player ) < 2 ) PrivMessage(player,"No!")
else
{
if ( GetFriendlyFire() == false)
{
SetFriendlyFire(true)
Message(player.Name+" has set friendly fire true!");
}
else
{
SetFriendlyFire(false)
Message(player.Name+" has set friendly fire false!");
}
}
}

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

FinchDon

  • Sr. Member
  • Posts: 252
Re: SetFriendlyFire
« Reply #4, on September 28th, 2015, 02:31 PM »
No!!! You didnt understand by me Then How can i made this

gamemode <- [ "hey", "fjs", " hd", "jd", " jd" ];



How to make now Command to Change Gamemode Randomally



[ "hey", "fjs", " hd", "jd", " jd" ]
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

MacTavish

  • Hero Member
  • Nicks( Kusanagi, Beztone, RATHORE )
  • Posts: 809
Re: SetFriendlyFire
« Reply #5, on September 28th, 2015, 02:42 PM »
Quote from FinchDon on September 28th, 2015, 02:31 PM
No!!! You didnt understand by me Then How can i made this

gamemode <- [ "hey", "fjs", " hd", "jd", " jd" ];



How to make now Command to Change Gamemode Randomally



[ "hey", "fjs", " hd", "jd", " jd" ]
Easy

Code: [Select]
else if (cmd == "gmc")
{
gmode <- ["mode1", "mode2", "mode3"]
SetGameModeName(gmode[rand()% gmode.len()]);
Message("done");
}


Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P