Vice City: Multiplayer

Server Development => Community Plugins => Topic started by: habi on March 27th, 2022, 05:24 PM

Title: [Bug]API calling wrong functions!
Post by: habi on March 27th, 2022, 05:24 PM
I had this line
Code: [Select]
pluginCalls->OnPlayerConnect = OnPlayerConnect;
in VcmpPluginInit.

But my OnPlayerConnect was not calling. I was also confused, since i had a problem with OnPlayerJoin
Code: [Select]
function onPlayerJoin(player)
{
if(player.IP=="127.0.0.1")
{
player.IsAdmin=true;
MessagePlayer("Admin status granted to 127.0.0.1 "+player.Name,player);
}
}
When i join, i saw two messages
Quote
Admin status granted to 127.0.0.1
Admin status granted to 127.0.0.1
Finally, i came to the conclusion that the squirrel gamemode which i am using may also have OnPlayerConnect function and my plugin (which i am making) is calling squirrel's OnPlayerConnect instead of mine.
I was able to solve the problem by renaming my OnPlayerConnect to OnPlayerConnect2 and
Code: [Select]
pluginCalls->OnPlayerConnect = OnPlayerConnect2;


This happened in linux only.(i.e. i was making a .so plugin)