SetFriendlyFire

Started by FinchDon, Sep 28, 2015, 10:19 AM

Previous topic - Next topic

FinchDon

Why its not working?

friendlyfire <- [ "true", "false"];
Command

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

.....
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...

Credits to Boystang!

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

FinchDon

Is There any other way?
For any help and support Join #s-s at IRC for Help in Scripting
( For Newbies )

MacTavish

This could be made directly without random function

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

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

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

Quote from: FinchDon on Sep 28, 2015, 01:31 PMNo!!! 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

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