Scripting Bug
#1

Hello, I have set up a moving camera on my login screen and i have scripted it to where in theory it should not be doing as it preforms. I have added under
pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gPlayerLogged[playerid] == 0)
    {
        SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: You must Register/Login before you Spawn !");
        printf("OnPlayerSpawn Kick: %d",playerid);
        KickPlayer[playerid] = 1;
        return 1;
    }
    if(PlayerInfo[playerid][pClothes] != 0)
    {
        SetPlayerSkin(playerid, PlayerInfo[playerid][pClothes]);
    }
    else
    {
        SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
    }
    if(!gPlayerAnimLibsPreloaded[playerid])
    {
        PreloadAnimLib(playerid,"BOMBER");
        PreloadAnimLib(playerid,"RAPPING");
        PreloadAnimLib(playerid,"SHOP");
        PreloadAnimLib(playerid,"BEACH");
        PreloadAnimLib(playerid,"SMOKING");
        PreloadAnimLib(playerid,"FOOD");
        PreloadAnimLib(playerid,"ON_LOOKERS");
        PreloadAnimLib(playerid,"DEALER");
        PreloadAnimLib(playerid,"CRACK");
        PreloadAnimLib(playerid,"CARRY");
        PreloadAnimLib(playerid,"COP_AMBIENT");
        PreloadAnimLib(playerid,"PARK");
        PreloadAnimLib(playerid,"INT_HOUSE");
        PreloadAnimLib(playerid,"FOOD");
        PreloadAnimLib(playerid,"PED");
        PreloadAnimLib(playerid,"GANGS");
        gPlayerAnimLibsPreloaded[playerid] = 1;
    }
    TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date);
    SetPlayerWeather(playerid, GlobalWeather);
    SetPlayerWeapons(playerid);
    SetPlayerSpawn(playerid);
    PlayerFixRadio(playerid);
    gPlayerSpawned[playerid] = 1;
    SetCameraBehindPlayer(playerid);
    KillTimer( SpawnCam[playerid][SpawnTimer] );
    return 1;
}
The "SetCameraBehindPlayer(playerid);" which set the camera behind the player. This callback is for when the player spawns. Now my moving camera code.
pawn Код:
public OnPlayerConnect(playerid)
{
    //Spawn Camera
    new rand = random(sizeof(RequestCamera));
    cordinatex = RequestCamera[rand][0];
    cordinatey = RequestCamera[rand][1];
    cordinatez = RequestCamera[rand][2];
    cordinateangle = RequestCamera[rand][3];
    PlayerPlaySound(playerid, 1185, cordinatex, cordinatey, cordinatez);
    SetPlayerFacingAngle(playerid, cordinateangle);
    SetPlayerCameraPos(playerid,cordinatex+(10*floatsin(-cordinateangle,degrees)),cordinatey+(10*floatcos(-cordinateangle,degrees)),cordinatez);//0.8 is a test
    SetPlayerCameraLookAt(playerid, cordinatex,cordinatey,cordinatez);
    SpawnCam[playerid][SpawnTimer] = SetTimerEx("MoveCamera", 50, true, "i", playerid);// 2 to reduce lagg change if wanted
    SetCameraBehindPlayer(playerid);
Now i only uploaded the part of it that deals with the camera. But what happens is when the player spawn the camera stays in the sky moving. Now sometimes this happens and sometimes it does not. Also one thing that happens is the camera speeds up. Would this classify as a bug?
Reply
#2

Probably a scripting problem. Post that in Scripting Discussion.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)