Bug on pause.inc
#1

Whenever i use the pause.inc
My OnPlayerConnect doesn't work fine.

I think pause.inc OnPlayerConnect is messing up with my OnPlayerConnect

on this part?

pawn Код:
public OnPlayerConnect(playerid)
{
    PlayerPauseInfo[playerid][Paused] = false;
    PlayerPauseInfo[playerid][Timer] = SetTimerEx("CheckPausedPlayer", 500, 1, "i",playerid);
    return 1;
}

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect Pause_OnPlayerConnect
forward Pause_OnPlayerConnect(playerid);
I can't even spawn because i have a block system for non-register/login players.
To spawn i need to /login.

Please can someone tell me whats going on?
Reply
#2

Oh and here is my code OnPlayerConnect, OnPlayerPaused and OnPlayerUnpaused

pawn Код:
public OnPlayerPaused(playerid)
{
    new str[128], Float:Pos[3];
    format(str, sizeof(str), "%s(%d) is now ESC Away from his Keyboard", GetpName(playerid), playerid);
    SendClientMessageToAll(COLOR_YELLOW, str);
    SendClientMessage(playerid, COLOR_RED, "*** You are now ESC Away from your Keyboard ***");
    TogglePlayerControllable(playerid, 0);
    PlayerPlaySound(playerid, 1085, 0, 0, 0);
    SetPlayerHealth(playerid, 99999999.0);
    SetPVarFloat(playerid, "PosX", Pos[0]);
    SetPVarFloat(playerid, "PosY", Pos[1]);
    SetPVarFloat(playerid, "PosZ", Pos[2]);
    SetPlayerVirtualWorld(playerid, 3);
    SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]+5);
    pData[playerid][pAFK] = 1;
    return 1;
}

public OnPlayerUnpaused(playerid)
{
    new str[128];
    format(str, sizeof(str), "%s(%d) is now Back from his Keyboard", GetpName(playerid), playerid);
    SendClientMessageToAll(COLOR_YELLOW, str);
    SendClientMessage(playerid, COLOR_WHITE, "*** You are now Back from your Keyboard ***");
    TogglePlayerControllable(playerid, 1);
    PlayerPlaySound(playerid, 1085, 0, 0, 0);
    SetPlayerHealth(playerid, 100.0);
    SetPlayerVirtualWorld(playerid, 0);
    SetPlayerPos(playerid, GetPVarFloat(playerid, "PosX"), GetPVarFloat(playerid, "PosY"), GetPVarFloat(playerid, "PosZ"));
    pData[playerid][pAFK] = 0;
    return 1;
}

public OnPlayerConnect(playerid)
{
    new str[300], query[93];
    GetPlayerIp(playerid, IP, 16);

    CreatePlayer3DTextLabel(playerid, "We are sorry if we remove the\nmemorial bridge, the The Matrix™ Stuntings© - Unlimited \nManagement leader Romel order to demolish\nthe memorial bridge\nWe are verry sorry\nRegards: Demolish Team", COLOR_RED, -1796.7467,489.6346,26.0247, 50.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, -1);
    pData[playerid][Login] = 0; pData[playerid][Warn] = 0; pData[playerid][LastPM] = -1; pData[playerid][Hide] = 0;
    pData[playerid][Duty] = 0; pData[playerid][God] = 0; pData[playerid][Jetpack] = 0; pData[playerid][bLog] = 0;
    gPlayerUsingLoopingAnim[playerid] = 0; gPlayerAnimLibsPreloaded[playerid] = 0; pData[playerid][DM] = 0;
    pData[playerid][Killstreak] = 0; IsBeingSpeced[playerid] = 0; InitFly(playerid);
    pData[playerid][Tazed] = 0; group[playerid][gid] = -1; group[playerid][invited] = -1;
    group[playerid][attemptjoin] = -1; pData[playerid][Flag2] = 0;
    for (new i = 0; i < sizeof(CountryNames); i++)
    format(str, sizeof(str), "%s~n~~n~~w~%s", CountryNames[i][String], CountryNames[i][Name]);
    TextDrawSetString(TDFlag, str);

    format(query, sizeof(query), "SELECT banlength FROM bans WHERE ip = '%s' OR name = '%s'", IP, DB_Escape(GetpName(playerid)));
    new
        DBResult: qHandle = db_query(BanData, query);

    for(new i = 0; i < 100; i++)
    SendClientMessage(playerid, -1, " ");

    if(IsPlayerNPC(playerid)) { return 1; }
    SetTimerEx("Record", 5000, false, "d", playerid);

    RemoveBuildingForPlayer(playerid, 10777, -1724.1953, 547.0859, 32.3203, 0.25);
    RemoveBuildingForPlayer(playerid, 11375, -1724.1953, 547.0859, 32.3203, 0.25);
    if(!gPlayerAnimLibsPreloaded[playerid]) {
        PreloadAnimLib(playerid,"BOMBER");
        PreloadAnimLib(playerid,"DANCING");
        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");
        gPlayerAnimLibsPreloaded[playerid] = 1;
    }
    TextDrawShowForPlayer(playerid, Textdraw0);
    TextDrawShowForPlayer(playerid, Textdraw1);
    TextDrawShowForPlayer(playerid, Textdraw2);
    TextDrawShowForPlayer(playerid, Textdraw3);
    TextDrawShowForPlayer(playerid, Textdraw4);
    PlayAudioStreamForPlayer(playerid, "http://scfire-ntc-aa04.stream.aol.com:80/stream/1093");
    SendClientMessage(playerid, -1, "Server client playing the Energy 98...");

    new file[256];
    format(file, sizeof(file), "Server/TuneVeh/%s.ini", GetpName(playerid));
    if(dini_Isset(file,"ID") && dini_Isset(file,"X")  && dini_Isset(file,"Y") && dini_Isset(file,"Z") && dini_Isset(file,"ROT") && dini_Isset(file,"COLOR1") && dini_Isset(file,"COLOR2"))
    {
        PlayerVehicle[playerid] = CreateVehicle(dini_Int(file,"ID"), dini_Int(file,"X"), dini_Int(file,"Y"), dini_Int(file,"Z"), dini_Int(file,"ROT"), dini_Int(file,"COLOR1"), dini_Int(file,"COLOR2"), 100);
        AddVehicleComponent(PlayerVehicle[playerid], dini_Int(file,"COMPONENT1"));
        AddVehicleComponent(PlayerVehicle[playerid], dini_Int(file,"COMPONENT2"));
        AddVehicleComponent(PlayerVehicle[playerid], dini_Int(file,"COMPONENT3"));
        AddVehicleComponent(PlayerVehicle[playerid], dini_Int(file,"COMPONENT4"));
        AddVehicleComponent(PlayerVehicle[playerid], dini_Int(file,"COMPONENT5"));
        AddVehicleComponent(PlayerVehicle[playerid], dini_Int(file,"COMPONENT6"));
        AddVehicleComponent(PlayerVehicle[playerid], dini_Int(file,"COMPONENT7"));
        AddVehicleComponent(PlayerVehicle[playerid], dini_Int(file,"COMPONENT8"));
        AddVehicleComponent(PlayerVehicle[playerid], dini_Int(file,"COMPONENT9"));
        ChangeVehiclePaintjob(PlayerVehicle[playerid], dini_Int(file,"PAINTJOB"));
        arendaveh[PlayerVehicle[playerid]] = playerid;
        isarenda[PlayerVehicle[playerid]] = 1;
    }

    ResetPlayerCash(playerid);
    SpecP[playerid] = TextDrawCreate(211.000000, 360.000000, " ");
    TextDrawBackgroundColor(SpecP[playerid], 255);
    TextDrawFont(SpecP[playerid], 3);
    TextDrawLetterSize(SpecP[playerid], 0.360000, 1.299998);
    TextDrawColor(SpecP[playerid], -1);
    TextDrawSetOutline(SpecP[playerid], 0);
    TextDrawSetProportional(SpecP[playerid], 1);
    TextDrawSetShadow(SpecP[playerid], 1);
    InfoP[playerid] = TextDrawCreate(13.000000,427.000000," ");
    TextDrawBackgroundColor(InfoP[playerid],0x000000ff);
    TextDrawFont(InfoP[playerid],3);
    TextDrawLetterSize(InfoP[playerid],0.799999,1.900000);
    TextDrawColor(InfoP[playerid], COLOR_WHITE);
    TextDrawSetOutline(InfoP[playerid],1);
    TextDrawSetShadow(InfoP[playerid],1);
   
    if(db_num_rows(qHandle) > 0)
    {
        new
            szDump[32],
            iDump;

        db_get_field_assoc(qHandle, "banlength", szDump, sizeof(szDump));
        iDump = strval(szDump);

        if(iDump-gettime() < 0)
        {
            format(str, sizeof(str), "*** Your ban expired %d seconds ago, Welcome back ***", gettime()-iDump);
            SendClientMessage(playerid, COLOR_YELLOW, str);

            format(query, sizeof(query), "DELETE FROM bans WHERE name = '%s'", DB_Escape(GetpName(playerid)));
            db_free_result(db_query(BanData, query));
        }
        else
        {
            format(str, sizeof(str), "*** Your ban will expire in %d seconds ***", iDump-gettime());
            SendClientMessage(playerid, COLOR_RED, "*** You're temporarily banned from this server ***");
            SendClientMessage(playerid, COLOR_RED, str);
            Kick(playerid);
        }
    }
    db_free_result(qHandle);
    if(dini_Int(DataPath(playerid), "Banned") == 1)
    {
        SetTimerEx("OnPlayerKick", 5000, false, "d", playerid);
        return 0;
    }
    if(strfind(GetpName(playerid), "Jellal", false) != - 1)
    {
        SetPlayerColor(playerid, COLOR_BLUE);
    }
    else
    {
        new colour = random(5);
        switch(colour)
        {
            case 0: SetPlayerColor(playerid, COLOR_PURPLE);
            case 1: SetPlayerColor(playerid, COLOR_WHITE);
            case 2: SetPlayerColor(playerid, COLOR_YELLOW);
            case 3: SetPlayerColor(playerid, COLOR_GREY);
            case 4: SetPlayerColor(playerid, COLOR_ORANGE);
        }
        SendClientMessage(playerid, COLOR_YELLOW, "Make sure you read /rulebook to avoid breaking the rules (Register/Login first in order to use it!)");
    }
    format(str, sizeof(str), "Current Registered Players: "white"%d", sData[AccID]);
    SendClientMessage(playerid, COLOR_YELLOW, str);
    SendClientMessage(playerid, COLOR_RED, "*** Server created by Romel");
    SendClientMessage(playerid, -1, "To check The Matrix Stuntings - Unlimited command, Please type /cmds");
    SendClientMessage(playerid, COLOR_YELLOW, "Moding is now allowed!, But Hacking is not allowed!");

    if(fexist(DataPath(playerid)))
    {
        if(dini_Int(DataPath(playerid), "VIP") >= 1)
        {
            format(str, sizeof(str), "^* VIP Member %s(%d) has connected the server", GetpName(playerid), playerid);
            SendClientMessageToAll(COLOR_LIGHTBLUE, str);
            SetPlayerColor(playerid, COLOR_LIGHTBLUE);
        }
        if(strcmp(IP, dini_Get(DataPath(playerid), "IP"), true) == 0)
        {
            format(pData[playerid][Name], 25, "%s", dini_Get(DataPath(playerid), "Name"));
            pData[playerid][Skin] = dini_Int(DataPath(playerid), "Skin");
            pData[playerid][Score] = dini_Int(DataPath(playerid), "Score");
            pData[playerid][Cookies] = dini_Int(DataPath(playerid), "Cookies");
            pData[playerid][Cash] = dini_Int(DataPath(playerid), "Cash");
            pData[playerid][Admin] = dini_Int(DataPath(playerid), "Admin");
            pData[playerid][VIP] = dini_Int(DataPath(playerid), "VIP");
            pData[playerid][Kills] = dini_Int(DataPath(playerid), "Kills");
            pData[playerid][Deaths] = dini_Int(DataPath(playerid), "Deaths");
            if(dini_Int(DataPath(playerid), "NoPM") == 0) SendClientMessage(playerid, COLOR_GREY, "Your PM Receiving System is enable, use /nopm to disable");
            else if(dini_Int(DataPath(playerid), "NoPM") == 1) SendClientMessage(playerid, COLOR_GREY, "Your PM Receiving System is disable, use /nopm to enable");
            GivePlayerCash(playerid, pData[playerid][Cash]);
            SetPlayerScore(playerid, pData[playerid][Score]);
            if(pData[playerid][Skin] == -1)
            format(str, sizeof(str), "You've sucessfully login\nAdmin: %d\nVIP: %d\nScore: %d\nCookies: %d\nCash: $%i\nKills: %d\nDeaths: %d", pData[playerid][Admin], pData[playerid][VIP], pData[playerid][Score], pData[playerid][Cookies], pData[playerid][Cash],
            pData[playerid][Kills], pData[playerid][Deaths]);
            if(pData[playerid][Skin] >= 0)
            format(str, sizeof(str), "You've sucessfully login\nSkin: %d\nAdmin: %d\nVIP: %d\nScore: %d\nCookies: %d\nCash: $%i\nKills: %d\nDeaths: %d", pData[playerid][Skin], pData[playerid][Admin], pData[playerid][VIP], pData[playerid][Score], pData[playerid][Cookies], pData[playerid][Cash],
            pData[playerid][Kills], pData[playerid][Deaths]);
            ShowPlayerDialog(playerid, STATS2, DIALOG_STYLE_MSGBOX, "Successfully Login:", str, "OK", "");
            SetPlayerName(playerid, pData[playerid][Name]);
            pData[playerid][Login] = 1;
            SendClientMessage(playerid, COLOR_YELLOW, "*** You've automaticlly login to your player acc! ***");
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "*** Your player acc has been found in our database ***");
            format(str, sizeof(str), "Welcome back, %s(%d) to\nThe Matrix™ Stuntings© - Unlimited  [0.3e], Please login in order\nto play in the server", GetpName(playerid), playerid);
            ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, "Login", str, "Login", "Quit");
        }
    }
    else if(!fexist(DataPath(playerid)))
    {
        SendClientMessage(playerid, COLOR_RED, "*** You do not have player acc in The Matrix™ Stuntings© - Unlimited  [0.3e] yet ***");
        format(str, sizeof(str), "Welcome %s(%d) to\nThe Matrix™ Stuntings© - Unlimited  [0.3e] Please register in order\nto play in the server", GetpName(playerid), playerid);
        ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_INPUT, "Register", str, "Register", "Quit");
    }
    return 1;
}
Reply
#3

you forgot to add the "CallLocalFunction":
pawn Код:
public OnPlayerConnect(playerid)
{
    PlayerPauseInfo[playerid][Paused] = false;
    PlayerPauseInfo[playerid][Timer] = SetTimerEx("CheckPausedPlayer", 500, 1, "i",playerid);
    return CallLocalFunction("Pause_OnPlayerConnect","i",playerid);//here
}

#if defined _ALS_OnPlayerConnect
    #undef OnPlayerConnect
#else
    #define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect Pause_OnPlayerConnect
forward Pause_OnPlayerConnect(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)