09.07.2012, 18:45
So i made a script to save impounded cars here it is:
Mhm whats wrong here ??
and the errors \/
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];
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