Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: MadMax on Jun 29, 2018, 08:39 AM

Title: GetVehicleCount() isn't working ?
Post by: MadMax on Jun 29, 2018, 08:39 AM
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)
https://s22.postimg.cc/tp84wpild/Screenshot_12.png
Title: Re: GetVehicleCount() isn't working ?
Post by: BeckzyBoi on Jun 29, 2018, 08:51 AM
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?
Title: Re: GetVehicleCount() isn't working ?
Post by: MadMax on Jun 29, 2018, 08:56 AM
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!
Title: Re: GetVehicleCount() isn't working ?
Post by: rww on Jun 29, 2018, 09:15 AM
I checked it on 04rel006. Your script isn't correct writed, give more code from onPlayerCommand event.
Title: Re: GetVehicleCount() isn't working ?
Post by: MadMax on Jun 29, 2018, 09:16 AM
function onPlayerCommand( player, cmd, text )
{
try
{
 cmd = cmd.tolower();
if(cmd=="vehicles")
{
ClientMessage(" "+ GetVehicleCount() + "",player,255,255,0);
 }
}
catch(e) print( "OnPlayerCommand Error: " + e );

}
Title: Re: GetVehicleCount() isn't working ?
Post by: BeckzyBoi on Jun 29, 2018, 09:26 AM
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.
Title: Re: GetVehicleCount() isn't working ?
Post by: rww on Jun 29, 2018, 09:27 AM
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 );
}
Title: Re: GetVehicleCount() isn't working ?
Post by: MadMax on Jun 29, 2018, 09:28 AM
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
Title: Re: GetVehicleCount() isn't working ?
Post by: BeckzyBoi on Jun 29, 2018, 09:29 AM
Quote from: MadMax on Jun 29, 2018, 09:28 AMSame Error

Did you try what I said?
Title: Re: GetVehicleCount() isn't working ?
Post by: rww on Jun 29, 2018, 09:32 AM
Try to remove some commands and test it, if it still doesn't work, try with another commands. Error in another command, not here.
Title: Re: GetVehicleCount() isn't working ?
Post by: 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
Title: Re: GetVehicleCount() isn't working ?
Post by: 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.
Title: Re: GetVehicleCount() isn't working ?
Post by: MadMax on Jun 29, 2018, 10:12 AM
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
Title: Re: GetVehicleCount() isn't working ?
Post by: BeckzyBoi on Jun 29, 2018, 10:23 AM
GetVehicleCount works fine for me on v30 x64. Can you tell me which server version (not release) you're using?
Title: Re: GetVehicleCount() isn't working ?
Post by: MadMax on Jun 29, 2018, 10:49 AM
VCMP04_server_v22_win32
Title: Re: GetVehicleCount() isn't working ?
Post by: NewK on Jun 29, 2018, 10:56 AM
The latest version is version 30 not 22. Make sure you download it from here (https://forum.vc-mp.org/?topic=5952.msg41223#msg41223)
Title: Re: GetVehicleCount() isn't working ?
Post by: MadMax on Jun 29, 2018, 11:49 AM
Quote from: NewK on Jun 29, 2018, 10:56 AMThe latest version is version 30 not 22. Make sure you download it from here (https://forum.vc-mp.org/?topic=5952.msg41223#msg41223)
It remains the same
Title: Re: GetVehicleCount() isn't working ?
Post by: Stormeus on Jun 29, 2018, 03:51 PM
Quote from: MadMax on Jun 29, 2018, 08:56 AMYes 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!

Did you update the plugin? 04rel004 had major SDK changes that could be causing issues like what you're seeing.
Title: Re: GetVehicleCount() isn't working ?
Post by: kennedyarz on Jun 29, 2018, 04:02 PM
Quote from: Stormeus on Jun 29, 2018, 03:51 PM
Quote from: MadMax on Jun 29, 2018, 08:56 AMYes 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!

Did you update the plugin? 04rel004 had major SDK changes that could be causing issues like what you're seeing.

I'm not doing it. There are many people who do not know what they are doing. I think we have to do examples in videos [ LOL] :/