SA-MP Forums Archive
Help me please. - 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: Help me please. (/showthread.php?tid=358178)



Help me please. - hulitubolies - 09.07.2012

So i made a script to save impounded cars here it is:

pawn Код:
new impounded[MAX_VEHICLES];
pawn Код:
enum pInfo
pImpounded[MAX_VEHICLES],
pawn Код:
enum ImpoundedInfo
{
    pVeh,
    pImpounded,
}
pawn Код:
stock SaveImpounded()
{
    new idx = 0, File:file;
    new string[256];
    while(idx < MAX_IMPOUNDED)
    {
        format(string, sizeof(string), "%d|%d",
        ImpoundedInfo[idx][pVeh],
        ImpoundedInfo[idx][pImpounded],
        if(idx == 0)
        {
            file = fopen("Impounded.cfg", io_write);
        }
        else
        {
            file = fopen("Impounded.cfg", io_append);
        }
        fwrite(file, string);
        fclose(file);
        idx++;
    }
    print("Impounded saved successfully.");
}

stock LoadImpounded()
{
    new dinfo[7][128];
    new string[256];
    new File:file = fopen("Impounded.cfg", io_read);
    if(file)
    {
        new idx = 0;
        while(idx < MAX_IMPOUNDED)
        {
            fread(file, string);
            split(string, dinfo, '|');

            ImpoundedInfo[idx][pVeh] = strval(dinfo[1]);
            ImpoundedInfo[idx][Impounded] = strval(dinfo[2]);
            idx++;
        }
    }
    print("Impounded loaded successfully.");
    return 1;
}
[MAX_VEHICLES];
pawn Код:
CMD:impound(playerid, params[])
{
    new  engine,lights,alarm,doors,bonnet,boot,objective;
    new vid, id, idn[MAX_PLAYER_NAME], n[MAX_PLAYER_NAME], str[288];
    id = (strval(params));
    GetPlayerName(playerid, n, sizeof(n));
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /impound");
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_GREY, "You are not in vehicle");
    if(!IsALSR(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSR Member.");
    vid = GetPlayerVehicleID(id);
    GetPlayerName(id, idn, sizeof(idn));
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,0,lights,alarm,doors,bonnet,boot,objective);
    impounded[vid] = 1;
    format(str,sizeof(str),"%s Takes out a notepad and writes car in impounded list.", n, idn);
    SendClientMessageToAll(COLOR_PURPLE, str);
    return 1;
}
CMD:unimpound(playerid, params[])
{
    new  engine,lights,alarm,doors,bonnet,boot,objective;
    new vid, id, idn[MAX_PLAYER_NAME], n[MAX_PLAYER_NAME], str[245];
    id = (strval(params));
    GetPlayerName(playerid, n, sizeof(n));
    if(!strlen(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /unimpound");
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsPlayerInAnyVehicle(id)) return SendClientMessage(playerid, COLOR_GREY, "You are not in vehicle");
    if(!IsALSR(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSR Member.");
    vid = GetPlayerVehicleID(id);
    GetPlayerName(id, idn, sizeof(idn));
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,1,lights,alarm,doors,bonnet,boot,objective);
    impounded[vid] = 0;
    format(str, sizeof(str), "%s Takes out a notepad and writes car in unimpounded list.", n, idn);
    SendClientMessageToAll(COLOR_PURPLE, str);
    return 1;
}[MAX_VEHICLES];
Mhm whats wrong here ??
and the errors \/

Код:
D:\Documents and Settings\ScOuT3221\Desktop\SAMPSERVER\gamemodes\ZRP.pwn(2336) : error 021: symbol already defined: "ImpoundedInfo"
D:\Documents and Settings\ScOuT3221\Desktop\SAMPSERVER\gamemodes\ZRP.pwn(2373 -- 2374) : error 028: invalid subscript (not an array or too many subscripts): "ImpoundedInfo"
D:\Documents and Settings\ScOuT3221\Desktop\SAMPSERVER\gamemodes\ZRP.pwn(2374) : warning 215: expression has no effect
D:\Documents and Settings\ScOuT3221\Desktop\SAMPSERVER\gamemodes\ZRP.pwn(2374) : error 001: expected token: ";", but found "]"
D:\Documents and Settings\ScOuT3221\Desktop\SAMPSERVER\gamemodes\ZRP.pwn(2374) : error 029: invalid expression, assumed zero
D:\Documents and Settings\ScOuT3221\Desktop\SAMPSERVER\gamemodes\ZRP.pwn(2374) : fatal error 107: too many error messages on one line



Re: Help me please. - Jarok - 09.07.2012

show us the lines.


Re: Help me please. - hulitubolies - 09.07.2012

Wha lines ??


Re: Help me please. - hulitubolies - 09.07.2012

pawn Код:
stock SaveImpounded()
{
    new idx = 0, File:file;
    new string[256];
    while(idx < MAX_IMPOUNDED)
    {
2373            format(string, sizeof(string), "%d|%d",
2374                ImpoundedInfo[idx][pVeh],
2375                 ImpoundedInfo[idx][pImpounded],
        if(idx == 0)
        {
            file = fopen("Impounded.cfg", io_write);
        }
        else
        {
            file = fopen("Impounded.cfg", io_append);
        }
        fwrite(file, string);
        fclose(file);
        idx++;
    }
    print("Impounded saved successfully.");
}
This fixed.
Код:
D:\Documents and Settings\ScOuT3221\Desktop\SAMPSERVER\gamemodes\ZRP.pwn(2336) : error 021: symbol already defined: "ImpoundedInfo"
and it send me another error
Код:
D:\Documents and Settings\ScOuT3221\Desktop\SAMPSERVER\gamemodes\ZRP.pwn(2372 -- 2373) : error 028: invalid subscript (not an array or too many subscripts): "ImpoundedInfo"



Re: Help me please. - hulitubolies - 09.07.2012

Co can someone help me with that bullshit ??


Re: Help me please. - hulitubolies - 09.07.2012

Please help me


Re: Help me please. - Dubya - 09.07.2012

SHowthe enum ImpoundedInfo


Re: Help me please. - hulitubolies - 09.07.2012

pawn Код:
enum ImpoundedInfo
{
    pVeh,
    pImpounded,
}



Re: Help me please. - kepa333 - 09.07.2012

do like hulitubolies sayd


Re: Help me please. - hulitubolies - 09.07.2012

So does somebody know how to fix it ??