GetVehicleCount() isn't working ?

Started by MadMax, Jun 29, 2018, 08:39 AM

Previous topic - Next topic

MadMax

Well, so this is the most basic function of VCMP and It's giving me an Error "Wrong Number of parameters" Now even the wiki shares the same code I've written down, and It gives error. Is there an alternative to solve this issue, or am I doing something wrong?

https://s22.postimg.cc/tp84wpild/Screenshot_12.png

BeckzyBoi

#1
That's very strange. It doesn't look like you're doing anything wrong. Are you sure that that's the line of the error?

Edit: Have you tried using it in MessagePlayer and PrivMessage?

MadMax

#2
Yes Of course?  I guess that's an issue with the Plugin @Stormeus . I'm currently using 04rel006, and when I just thought to try the same code back in version 04rel003, It worked great!

rww

I checked it on 04rel006. Your script isn't correct writed, give more code from onPlayerCommand event.
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

MadMax

function onPlayerCommand( player, cmd, text )
{
try
{
 cmd = cmd.tolower();
if(cmd=="vehicles")
{
ClientMessage(" "+ GetVehicleCount() + "",player,255,255,0);
 }
}
catch(e) print( "OnPlayerCommand Error: " + e );

}

BeckzyBoi

Quote from: MadMax on Jun 29, 2018, 09:16 AMfunction onPlayerCommand( player, cmd, text )
{
try
{
 cmd = cmd.tolower();
if(cmd=="vehicles")
{
ClientMessage(" "+ GetVehicleCount() + "",player,255,255,0);
 }
}
catch(e) print( "OnPlayerCommand Error: " + e );

}

Looks fine to me. Try putting player.ID instead of GetVehicleCount() and see what happens. That'll determine whether it's actually GetVehicleCount() causing the error or if it's something else.

rww

In your posted code is everything okey, the mistake must be in another line.

Btw you can do this that.

function onPlayerCommand( player, cmd, text )
{
try
{
cmd = cmd.tolower();
if (cmd == "vehicles") ClientMessage("Veh Count: "+GetVehicleCount(),player,255,255,0);
}
catch(e) print( "OnPlayerCommand Error: " + e );
}
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

MadMax

Quote from: rww on Jun 29, 2018, 09:27 AMIn your posted code is everything okey, the mistake must be in another line.

Btw you can do this that.

function onPlayerCommand( player, cmd, text )
{
try
{
cmd = cmd.tolower();
if (cmd == "vehicles") ClientMessage("Veh Count: "+GetVehicleCount(),player,255,255,0);
}
catch(e) print( "OnPlayerCommand Error: " + e );
}
Same Error


rww

Try to remove some commands and test it, if it still doesn't work, try with another commands. Error in another command, not here.
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

MadMax

Quote from: rww on Jun 29, 2018, 09:32 AMTry to remove some commands and test it, if it still doesn't work, try with another commands. Error in another command, not here.
It's not working I've tried

BeckzyBoi

Quote from: MadMax on Jun 29, 2018, 09:56 AM
Quote from: rww on Jun 29, 2018, 09:32 AMTry to remove some commands and test it, if it still doesn't work, try with another commands. Error in another command, not here.
It's not working I've tried

Remove all commands expect "vehicles" and then try. If it works then it's one of your other commands. You'll then have to remove one-by-one to debug it.

MadMax

Quote from: BeckzyBoi on Jun 29, 2018, 10:03 AM
Quote from: MadMax on Jun 29, 2018, 09:56 AM
Quote from: rww on Jun 29, 2018, 09:32 AMTry to remove some commands and test it, if it still doesn't work, try with another commands. Error in another command, not here.
It's not working I've tried

Remove all commands expect "vehicles" and then try. If it works then it's one of your other commands. You'll then have to remove one-by-one to debug it.
as I said I just tried It! GetObjectCount is working even, btw GetVehicleCount isn't

BeckzyBoi

GetVehicleCount works fine for me on v30 x64. Can you tell me which server version (not release) you're using?

MadMax