GetChaRespawnPoint is declared to return a String, and takes only 1 argument which is a pointer to the main character, you're not passing the second param at all
also why this approach? I'd go with the current declaration you only need a pointer to the player
1- Get char's current map if the map is "CTF" continue parsing else return
2- get the side (you already did)
3- respawn the character on the correct side.
so I'd do the following:
g_CParser.DoString("GetChaRespawnPoint", enumSCRIPT_RETURN_STRING, 1, enumSCRIPT_PARAM_LIGHTUSERDATA, 1, pCMainCha, DOSTRING_PARAM_END)
szSpawn = g_CParser.GetReturnString(0);
if (!strcmp(szSpawn, "")) // you should return an empty string to indicate normal flow, i.e execute the default action for spawning/re-spawning
{
pSBirthP = GetRandBirthPoint(GetLogName(), szSpawn); // get coords from birth_conf
pCMainCha->SwitchMap(pCMap, szSpawn, pSBirthP->x * 100,pSBirthP->y * 100, false, chSwitchType, lMapCpyNO); // coords multiplied by 100 if you're using arbitrary coords i.e coords drawn on the GUI "Map Interface", and it is the case for all maps saved in "birth\birth_conf.lua"
return; // we're done, exit the function
}
else
{
if (!szCityName || !strcmp(szCityName, ""))
pCMainCha->ResetBirthInfo();
else
{
SBirthPoint *pSBirthP;
pSBirthP = GetRandBirthPoint(GetLogName(), szCityName);
SetBirthMap(pSBirthP->szMapName);
SetPos(pSBirthP->x * 100, pSBirthP->y * 100);
}
pCMainCha->SwitchMap(pCMap, pCMainCha->GetBirthMap(), pCMainCha->GetPos().x, pCMainCha->GetPos().y, false, chSwitchType, lMapCpyNO);
}
function GetChaRespawnPoint(Player)
local ret = ""
if GetChaMapName(Player) == "CTF" then
local SideID = GetChaSideID(Player)
if (SideID == 1) then
ret = CTF.Spawns[2].Spawn -- I'd assume that those are defined in your current lua file which lead to similiar declarations in your birth_conf.lua
else
ret = CTF.Spawns[1].Spawn
end
return ret
end