SetGrav cmd prob

Started by [VM_U]Spectra.PhantoM^, Feb 07, 2016, 07:22 AM

Previous topic - Next topic

[VM_U]Spectra.PhantoM^

i developed setgravity cmd  it works but..... i used text.tointeger but it read's integer values not float values for ex: 0.256 or 0.0008
any way i can make it read both integer and float values?

thanx
Wanna Talk To Me? Come At Irc #Jugo@LUNet

KAKAN

oh no

Xmair

#2
function onPlayerCommand ( player , cmd , text )
{
if ( cmd == "setgrav" )
{
try
{
if ( !text ) MessagePlayer("/setgrav { Gravity }" ,player );
else
{
text = text.tofloat();
SetGravity ( text );
Message( player.Name + " has set the gravity to " + text + ". " );
}
}
catch ( e ) MessagePlayer("Text must be float / integer." , player); // Used this since isnum contains '.' .
}
}
Update: Tested, works.

Credits to Boystang!

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