SA-MP Forums Archive
0kb compile 500lines script [HELP] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 0kb compile 500lines script [HELP] (/showthread.php?tid=311827)



0kb compile 500lines script [HELP] - wNNk - 18.01.2012

http://pastebin.com/0USLbb5t

here is the script, can u find the missing bracket please??


Re: 0kb compile 500lines script [HELP] - Kyle - 18.01.2012

Bit obvious 75 - 76 - Give rep if I helped.


Re: 0kb compile 500lines script [HELP] - Konstantinos - 18.01.2012

You are missing a lot of brackets(5+)
Replace to those
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    for(new i=0; i<MAX_PLAYERS; i++) {
        if(isInExam[i] && examCarPlayer[i]==vehicleid) {
            if(timeChanged) {
                new h,m,s;
                #pragma unused s
                gettime(h,m,s); SetPlayerTime(i, h, m); timeChanged = false;
            }
            GameTextForPlayer(i, "~r~Ai picat examenul!", 10000, 5);
            SetVehicleToRespawn(vehicleid);
            isInExam[i]=0; checkpoint[i]=0; examCarPlayer[i]=0;
            for(new j=0; j<3; j++) {
                if(examCar[j][0]==vehicleid) {
                    examCar[j][1]=-1;
                    break;
                }
                SetPlayerWeather(i, 1);
                DisablePlayerCheckpoint(i);
                break;
            }
        }
    }
    return 1;
}

public OnVehicleRespray(playerid,vehicleid,color1,color2)
{
    if(isInExam[playerid]) {
        if(timeChanged) {
            new h,m,s;
            gettime(h,m,s); SetPlayerTime(playerid, h, m); timeChanged = false;
        }
        SendClientMessage(playerid,BLUE,"MARS CU HACKURILE TALE");
        GameTextForPlayer(playerid, "~r~Ai picat examenul!", 10000, 5);
        isInExam[playerid]=0; checkpoint[playerid]=0; examCarPlayer[playerid]=0;
        for(new i=0; i<3; i++) {
            if(examCar[i][0]==vehicleid) {
                examCar[i][1]=-1;
                break;
            }
        }
        SetPlayerWeather(playerid, 1);
        RemovePlayerFromVehicle(playerid); SetVehicleToRespawn(vehicleid);
        DisablePlayerCheckpoint(playerid);
    }
    return 1;
}


public OnVehicleMod(playerid, vehicleid, componentid)
{
    if(isInExam[playerid])
    {
        if(timeChanged)
        {
            new h,m,s;
            gettime(h,m,s); SetPlayerTime(playerid, h, m); timeChanged = false;
        }
        SendClientMessage(playerid,BLUE,"Incearca sa nu te mai lovesti!");
        GameTextForPlayer(playerid, "~r~Ai picat examenul!", 5000, 5);
        isInExam[playerid]=0; checkpoint[playerid]=0; examCarPlayer[playerid]=0;
        for(new i=0; i<3; i++)
        {
            if(examCar[i][0]==vehicleid)
            {
                examCar[i][1]=-1;
                break;
            }
            SetPlayerWeather(playerid, 1);
            RemovePlayerFromVehicle(playerid); RemoveVehicleComponent(vehicleid, componentid);
            SetVehicleToRespawn(vehicleid);
            DisablePlayerCheckpoint(playerid);
        }
    }
    return 1;
}

public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    new Float:health;
    GetVehicleHealth(vehicleid,health);
    for(new i=0; i<MAX_PLAYERS; i++) {
        if(isInExam[i] && examCarPlayer[i]==vehicleid && playerid!=i) {
            FixCar(vehicleid); SetVehicleHealth(vehicleid, oldHP); allowHPchange = true;
            SendClientMessage(playerid,BLUE,"Nu te supara.... E doar un test ;))");
            break;
        }
        oldHP = health;
    }
    return 1;
}

public OnPlayerUpdate(playerid)
{
    if(IsPlayerInVehicle(playerid, examCarPlayer[playerid]) && isInExam[playerid]) {
        new Float:health;
        GetVehicleHealth(examCarPlayer[playerid], health);
        if(health > oldHP && allowHPchange==false) {
            if(timeChanged) {
                new h,m,s;
                gettime(h,m,s); SetPlayerTime(playerid, h, m); timeChanged = false;
            }
            SendClientMessage(playerid,BLUE,"MARS CU HACKURILE TALE!");
            GameTextForPlayer(playerid, "~r~Ai picat examenul!", 10000, 5);
            isInExam[playerid]=0; checkpoint[playerid]=0;
            for(new i=0; i<3; i++) {
                if(examCar[i][0]==examCarPlayer[playerid]) {
                    examCar[i][1]=-1;
                    break;
                }
                SetPlayerWeather(playerid, 1);
                RemovePlayerFromVehicle(playerid); SetVehicleToRespawn(examCarPlayer[playerid]);
                DisablePlayerCheckpoint(playerid);
                examCarPlayer[playerid]=0;
            }
        }
        else if(allowHPchange) allowHPchange = false;
    }
    return 1;
}


forward LoadLicense(playerid, name[], value[]);
public LoadLicense(playerid, name[], value[])
{
    INI_Int("DrivingLicense", Player[playerid]);
    return 0;
}


stock GetPlayerDrivingLicense(playerid)
{
    new name[MAX_PLAYER_NAME],string[256];
    GetPlayerName(playerid,name,sizeof(name));
    format(string,256,"Players/%s.ini",name);
    INI_ParseFile(string,"LoadLicense", .bExtra=true, .extra=playerid);
    return
}


stock SavePlayerLicense(playerid)
{
    new INI:player;
    new name[MAX_PLAYER_NAME],string[256];
    GetPlayerName(playerid,name,sizeof(name));
    format(string,256,"Players/%s.ini",name);
    player = INI_Open(string);
    INI_WriteInt(player, "DrivingLicense", Player[playerid]);
    INI_Close(player);
    return 1;
}


stock SetPlayerMoney(playerid, money)
{
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid, money);
    return 1;
}


FixCar(vehicleid)
{
    new panels, doors, lights, tires;
    GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
    tires = encode_tires(0, 0, 0, 0);
    panels = encode_panels(0, 0, 0, 0, 0, 0, 0);
    doors = encode_doors(0, 0, 0, 0, 0, 0);
    lights = encode_lights(0, 0, 0, 0);
    UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
    return 1;
}


encode_tires(tire1, tire2, tire3, tire4) return tire1 | (tire2 << 1) | (tire3 << 2) | (tire4 << 3);
encode_panels(flp, frp, rlp, rrp, windshield, front_bumper, rear_bumper)
{
    return flp | (frp << 4) | (rlp << 8) | (rrp << 12) | (windshield << 16) | (front_bumper << 20) | (rear_bumper << 24);
}


encode_doors(bonnet, boot, driver_door, passenger_door, behind_driver_door, behind_passenger_door)
{
    #pragma unused behind_driver_door
    #pragma unused behind_passenger_door
    return bonnet | (boot << 8) | (driver_door << 16) | (passenger_door << 24);
}


encode_lights(light1, light2, light3, light4)
{
    return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
}


// Ceas

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Ceas + Data by PwRh--------------------");
    print("--------------------------------------\n");

    SetTimer("settime",1000,true);

    Date = TextDrawCreate(547.000000,11.000000,"--");

    TextDrawFont(Date,3);
    TextDrawLetterSize(Date,0.399999,1.600000);
    TextDrawColor(Date,0xffffffff);

    Time = TextDrawCreate(547.000000,28.000000,"--");

    TextDrawFont(Time,3);
    TextDrawLetterSize(Time,0.399999,1.600000);
    TextDrawColor(Time,0xffffffff);

    SetTimer("settime",1000,true);
    return 1;
}


public OnFilterScriptExit()
{
    print("\n-----------------------------------------------------");
    print(" Ceas + Data by PwRh !---------------------------------");
    print("-----------------------------------------------------/n");
    return 1;
}


public OnPlayerSpawn(playerid)
{
    SendClientMessage(playerid, 0xF97804FF, "Contact pentru mai multe la : naruto4wnnk!");
    TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date);

    return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
    TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
    return 1;
}


public settime(playerid)
{
    new string[256],year,month,day,hours,minutes,seconds;
    getdate(year, month, day), gettime(hours, minutes, seconds);
    format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
    TextDrawSetString(Date, string);
    format(string, sizeof string, "%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
    TextDrawSetString(Time, string);
    return 1;
}
Quote:
Originally Posted by KyleSmith
Посмотреть сообщение
Bit obvious 75 - 76 - Give rep if I helped.
Is the Reputation so important for all? In every post I see give rep if I help you..


Re: 0kb compile 500lines script [HELP] - wNNk - 18.01.2012

doesn't work..


Re: 0kb compile 500lines script [HELP] - Konstantinos - 18.01.2012

Look your code
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    for(new i=0; i<MAX_PLAYERS; i++) {
        if(isInExam[i] && examCarPlayer[i]==vehicleid) {
            if(timeChanged) {
                new h,m,s;
#pragma unused s
                gettime(h,m,s); SetPlayerTime(i, h, m); timeChanged = false;
            }
            GameTextForPlayer(i, "~r~Ai picat examenul!", 10000, 5);
            SetVehicleToRespawn(vehicleid);
            isInExam[i]=0; checkpoint[i]=0; examCarPlayer[i]=0;
            for(new j=0; j<3; j++) {
                if(examCar[j][0]==vehicleid) {
                    examCar[j][1]=-1;
                    break;
                }
                SetPlayerWeather(i, 1);
                DisablePlayerCheckpoint(i);
                break;
            }
            return 1;
        }

        public OnVehicleRespray(playerid,vehicleid,color1,color2) {
            if(isInExam[playerid]) {
                if(timeChanged) {
                    new h,m,s;
                    gettime(h,m,s); SetPlayerTime(playerid, h, m); timeChanged = false;
                }
                SendClientMessage(playerid,BLUE,"MARS CU HACKURILE TALE");
                GameTextForPlayer(playerid, "~r~Ai picat examenul!", 10000, 5);
                isInExam[playerid]=0; checkpoint[playerid]=0; examCarPlayer[playerid]=0;
                for(new i=0; i<3; i++) {
                    if(examCar[i][0]==vehicleid) {
                        examCar[i][1]=-1;
                        break;
                    }
                }
                SetPlayerWeather(playerid, 1);
                RemovePlayerFromVehicle(playerid); SetVehicleToRespawn(vehicleid);
                DisablePlayerCheckpoint(playerid);
            }
            return 1;
        }
        public OnVehicleMod(playerid, vehicleid, componentid) {
            if(isInExam[playerid]) {
                if(timeChanged) {
                    new h,m,s;
                    gettime(h,m,s); SetPlayerTime(playerid, h, m); timeChanged = false;
                }
                SendClientMessage(playerid,BLUE,"Incearca sa nu te mai lovesti!");
                GameTextForPlayer(playerid, "~r~Ai picat examenul!", 5000, 5);
                isInExam[playerid]=0; checkpoint[playerid]=0; examCarPlayer[playerid]=0;
                for(new i=0; i<3; i++) {
                    if(examCar[i][0]==vehicleid) {
                        examCar[i][1]=-1;
                        break;
                    }
                    SetPlayerWeather(playerid, 1);
                    RemovePlayerFromVehicle(playerid); RemoveVehicleComponent(vehicleid, componentid);
                    SetVehicleToRespawn(vehicleid);
                    DisablePlayerCheckpoint(playerid);
                }
                return 1;
            }

            public OnVehicleDamageStatusUpdate(vehicleid, playerid) {
                new Float:health;
                GetVehicleHealth(vehicleid,health);
                for(new i=0; i<MAX_PLAYERS; i++) {
                    if(isInExam[i] && examCarPlayer[i]==vehicleid && playerid!=i) {
                        FixCar(vehicleid); SetVehicleHealth(vehicleid, oldHP); allowHPchange = true;
                        SendClientMessage(playerid,BLUE,"Nu te supara.... E doar un test ;))");
                        break;
                    }
                    oldHP = health;
                    return 1;
                }

                public OnPlayerUpdate(playerid) {
                    if(IsPlayerInVehicle(playerid, examCarPlayer[playerid]) && isInExam[playerid]) {
                        new Float:health;
                        GetVehicleHealth(examCarPlayer[playerid], health);
                        if(health > oldHP && allowHPchange==false) {
                            if(timeChanged) {
                                new h,m,s;
                                gettime(h,m,s); SetPlayerTime(playerid, h, m); timeChanged = false;
                            }
                            SendClientMessage(playerid,BLUE,"MARS CU HACKURILE TALE!");
                            GameTextForPlayer(playerid, "~r~Ai picat examenul!", 10000, 5);
                            isInExam[playerid]=0; checkpoint[playerid]=0;
                            for(new i=0; i<3; i++) {
                                if(examCar[i][0]==examCarPlayer[playerid]) {
                                    examCar[i][1]=-1;
                                    break;
                                }
                                SetPlayerWeather(playerid, 1);
                                RemovePlayerFromVehicle(playerid); SetVehicleToRespawn(examCarPlayer[playerid]);
                                DisablePlayerCheckpoint(playerid);
                                examCarPlayer[playerid]=0;
                            }
                            else if(allowHPchange) allowHPchange = false;
                        }
                        return 1;
                    }

                    forward LoadLicense(playerid, name[], value[]);
                    public LoadLicense(playerid, name[], value[]) {
                        INI_Int("DrivingLicense", Player[playerid]);
                        return 0;
                    }

                    stock GetPlayerDrivingLicense(playerid) {
                        new name[MAX_PLAYER_NAME],string[256];
                        GetPlayerName(playerid,name,sizeof(name));
                        format(string,256,"Players/%s.ini",name);
                        INI_ParseFile(string,"LoadLicense", .bExtra=true, .extra=playerid);
                        return
                    }

                    stock SavePlayerLicense(playerid) {
                        new INI:player;
                        new name[MAX_PLAYER_NAME],string[256];
                        GetPlayerName(playerid,name,sizeof(name));
                        format(string,256,"Players/%s.ini",name);
                        player = INI_Open(string);
                        INI_WriteInt(player, "DrivingLicense", Player[playerid]);
                        INI_Close(player);
                        return 1;
                    }

                    stock SetPlayerMoney(playerid, money) {
                        ResetPlayerMoney(playerid);
                        GivePlayerMoney(playerid, money);
                        return 1;
                    }

                    FixCar(vehicleid) {
                        new panels, doors, lights, tires;
                        GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
                        tires = encode_tires(0, 0, 0, 0);
                        panels = encode_panels(0, 0, 0, 0, 0, 0, 0);
                        doors = encode_doors(0, 0, 0, 0, 0, 0);
                        lights = encode_lights(0, 0, 0, 0);
                        UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
                        return 1;
                    }

                    encode_tires(tire1, tire2, tire3, tire4) return tire1 | (tire2 << 1) | (tire3 << 2) | (tire4 << 3);
                    encode_panels(flp, frp, rlp, rrp, windshield, front_bumper, rear_bumper) {
                        return flp | (frp << 4) | (rlp << 8) | (rrp << 12) | (windshield << 16) | (front_bumper << 20) | (rear_bumper << 24);
                    }
                    encode_doors(bonnet, boot, driver_door, passenger_door, behind_driver_door, behind_passenger_door) {
#pragma unused behind_driver_door
#pragma unused behind_passenger_door
                        return bonnet | (boot << 8) | (driver_door << 16) | (passenger_door << 24);
                    }
                    encode_lights(light1, light2, light3, light4) {
                        return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
                    }

// Ceas

                    public OnFilterScriptInit() {
                        print("\n--------------------------------------");
                        print(" Ceas + Data by PwRh--------------------");
                        print("--------------------------------------\n");

                        SetTimer("settime",1000,true);

                        Date = TextDrawCreate(547.000000,11.000000,"--");

                        TextDrawFont(Date,3);
                        TextDrawLetterSize(Date,0.399999,1.600000);
                        TextDrawColor(Date,0xffffffff);

                        Time = TextDrawCreate(547.000000,28.000000,"--");

                        TextDrawFont(Time,3);
                        TextDrawLetterSize(Time,0.399999,1.600000);
                        TextDrawColor(Time,0xffffffff);

                        SetTimer("settime",1000,true);
                        return 1;
                    }

                    public OnFilterScriptExit() {
                        print("\n-----------------------------------------------------");
                        print(" Ceas + Data by PwRh !---------------------------------");
                        print("-----------------------------------------------------/n");
                        return 1;
                    }

                    public OnPlayerSpawn(playerid) {
                        SendClientMessage(playerid, 0xF97804FF, "Contact pentru mai multe la : naruto4wnnk!");
                        TextDrawShowForPlayer(playerid, Time), TextDrawShowForPlayer(playerid, Date);

                        return 1;
                    }

                    public OnPlayerDisconnect(playerid, reason) {
                        TextDrawHideForPlayer(playerid, Time), TextDrawHideForPlayer(playerid, Date);
                        return 1;
                    }

                    public settime(playerid) {
                        new string[256],year,month,day,hours,minutes,seconds;
                        getdate(year, month, day), gettime(hours, minutes, seconds);
                        format(string, sizeof string, "%d/%s%d/%s%d", day, ((month < 10) ? ("0") : ("")), month, (year < 10) ? ("0") : (""), year);
                        TextDrawSetString(Date, string);
                        format(string, sizeof string, "%s%d:%s%d:%s%d", (hours < 10) ? ("0") : (""), hours, (minutes < 10) ? ("0") : (""), minutes, (seconds < 10) ? ("0") : (""), seconds);
                        TextDrawSetString(Time, string);
                        return 1;
                    }
                    {



Re: 0kb compile 500lines script [HELP] - wNNk - 18.01.2012

this is the whole script from public Onvehicledeath until the finish ?


Re: 0kb compile 500lines script [HELP] - Konstantinos - 18.01.2012

On that part, brackets missing.


Re: 0kb compile 500lines script [HELP] - wNNk - 18.01.2012

so it's not fixed?


Re: 0kb compile 500lines script [HELP] - wNNk - 18.01.2012

please can some1 fix that


Re: 0kb compile 500lines script [HELP] - MP2 - 18.01.2012

If you indented properly:
pawn Код:
if(condition)
{
    // do something
}
instead of
pawn Код:
if(condition) {}{{}{}{}{
}
}}{}{
 // do something
}{{}}}}
Then you'd be able to find missing brackets in a second.



Less exaggerated version:
pawn Код:
if(condition) {
    // Do stuff
}