How to fix?
Command:
else if ( cmd == "setmon" )
{
if ( IsNoob( player, cmd ) ) return 0;
else if ( !text ) ePrivMessage( "Syntax, /c " + cmd + " <Nick/ID> <Money> ", player );
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) PrivMessage( "Unknown Player..", player );
else
{
local mon = GetTok( text, " ", 2);
if (!IsNum(mon)) ePrivMessage("Amount Must Be In Numbers..",player);
else
{
PrivMessage(" Admin " + player.Name + " Set Money Of " + plr.Name + " To: " + mon + ".",player);
IncCash( plr, mon.tointeger() );
}
}
}
Erro:
[SCRIPT] OnPlayerCommand Error: parameter 1 has an invalid type 'null' ; expected: 'string'
[SCRIPT] OnPlayerCommand Error: parameter 1 has an invalid type 'string' ; expected: 'instance'
Any specific line in there? For f*s sake people. Do you have any logic? If you can't identify the line at least post a screen shot and make sure to resize the console window to capture the whole error output.
I think this condition was satisfied when you typed that command.
if ( IsNoob( player, cmd ) ) return 0;
The whole problem is here:
PrivMessage(" Admin " + player.Name + " Set Money Of " + plr.Name + " To: " + mon + ".",player);
>>> + mon + <<<
Full Cmd Bug!
Noob function
PrivMessage
else if ( cmd =="setmon" )
{
if (!text) MessagePlayer("Syntax - /setmon <nick/id> <amount>",player);
else
{
local plr = GetPlayer( GetTok(text," ",1)), mon = GetTok(text," ",2);
if (!plr) MessagePlayer("Invalid Player",player);
else if (!mon) MessagePlayer("Money not specified",player);
else if (!IsNum(mon)) MessagePlayer("Money must be in number",player);
else
{
status[plr.ID].Cash += mon.tointeger();
player.Cash = status[plr.ID].Cash;
Message("Admin "+player.Name+" Has given "+mon+" $ to "+plr.Name+"");
}
}
}
Try it Untested
@Beztone you obviously didn't test it, since you didn't define mon anywhere.
Quote from: Thijn on Jul 22, 2015, 05:50 AM@Beztone you obviously didn't test it, since you didn't define mon anywhere.
Ok i tested, its working
Quote from: Beztone on Jul 22, 2015, 06:09 AMQuote from: Thijn on Jul 22, 2015, 05:50 AM@Beztone you obviously didn't test it, since you didn't define mon anywhere.
Ok i tested, its working
Oh of course, I misread that line.
Quote from: Beztone on Jul 22, 2015, 05:36 AMelse if ( cmd =="setmon" )
{
if (!text) MessagePlayer("Syntax - /setmon <nick/id> <amount>",player);
else
{
local plr = GetPlayer( GetTok(text," ",1)), mon = GetTok(text," ",2);
if (!plr) MessagePlayer("Invalid Player",player);
else if (!mon) MessagePlayer("Money not specified",player);
else if (!IsNum(mon)) MessagePlayer("Money must be in number",player);
else
{
status[plr.ID].Cash += mon.tointeger();
player.Cash = status[plr.ID].Cash;
Message("Admin "+player.Name+" Has given "+mon+" $ to "+plr.Name+"");
}
}
}
Try it Untested
Thanks, it worked!