01.07.2012, 04:59
pawn Код:
C:\Users\..\Documents\\gamemodes\ZRP.pwn(14135) : error 028: invalid subscript (not an array or too many subscripts): "ObjectInfo"
C:\Users\...\Documents\\gamemodes\ZRP.pwn(14135) : warning 215: expression has no effect
C:\Users\...\Documents\\gamemodes\ZRP.pwn(14135) : error 001: expected token: ";", but found "]"
C:\Users\...\Documents\\gamemodes\ZRP.pwn(14135) : error 029: invalid expression, assumed zero
C:\Users\...\Documents\\gamemodes\ZRP.pwn(14135) : fatal error 107: too many error messages on one line
pawn Код:
CMD:deleteobject(playerid, params[])
{
new idx, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
if(!aDuty[playerid]) return SendClientMessage(playerid, COLOR_GREY, "You are not on admin duty.");
if(sscanf(params, "i", idx)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /deletegate [gateid]");
if(!ObjectInfo[idx][oModel]) return SendClientMessage(playerid, COLOR_GREY, "Invalid gate id.");
ObjectInfo[idx][gModel] = 0;
ObjectInfo[idx][gCX] = 0;
ObjectInfo[idx][gCY] = 0;
ObjectInfo[idx][gCZ] = 0;
ObjectInfo[idx][gCRX] = 0;
ObjectInfo[idx][gCRY] = 0;
ObjectInfo[idx][gCRZ] = 0;
ObjectInfo[idx][gOX] = 0;
ObjectInfo[idx][gOY] = 0;
ObjectInfo[idx][gOZ] = 0;
ObjectInfo[idx][gORX] = 0;
ObjectInfo[idx][gORY] = 0;
ObjectInfo[idx][gORZ] = 0;
ObjectInfo[idx][gStatus] = 0;
format(ObjectInfo[idx][gPassword], 256, "");
ObjectInfo[idx][gSpeed] = 0;
DestroyDynamicObject(ObjectInfo[idx][gGate]);
DestroyDynamic3DTextLabel(ObjectInfo[idx][gText]);
format(string, sizeof(string), "AdmWarn: %s has deleted gate ID %d.", RPN(playerid), idx);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/gates.log", string);
foreach(Player, i)
{
if(PlayerInfo[i][pGate][0] == idx)
{
PlayerInfo[i][pGate][0] = 0;
SendClientMessage(playerid, COLOR_WHITE, " An administrator has deleted your gate in slot 1.");
format(string, sizeof(string), "AdmWarn: %s has deleted %s's slot 1 gate. (ID: %d)", RPN(playerid), RPN(i), idx);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/gates.log", string);
}
if(PlayerInfo[i][pGate][1] == idx)
{
PlayerInfo[i][pGate][1] = 0;
SendClientMessage(playerid, COLOR_WHITE, " An administrator has deleted your gate in slot 2.");
format(string, sizeof(string), "AdmWarn: %s has deleted %s's slot 2 gate. (ID: %d)", RPN(playerid), RPN(i), idx);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/gates.log", string);
}
if(PlayerInfo[i][pGate][2] == idx)
{
PlayerInfo[i][pGate][2] = 0;
SendClientMessage(playerid, COLOR_WHITE, " An administrator has deleted your gate in slot 3.");
format(string, sizeof(string), "AdmWarn: %s has deleted %s's slot 3 gate. (ID: %d)", RPN(playerid), RPN(i), idx);
SendAdminMessage(COLOR_DARKRED, 1, string);
Log("logs/gates.log", string);
}
}
return 1;
}
pawn Код:
enum ObjectInfo
{
oObject,
Text3D:OText,
oModel,
Float:OCX,
Float:OCY,
Float:OCZ,
Float:OCRX,
Float:OCRY,
Float:OCRZ,
Float:OOX,
Float:OOY,
Float:OOZ,
Float:OORX,
Float:OORY,
Float:OORZ,
}
new ObjectInform[MAX_OBJECT][ObjectInfo];
stock LoadObject()
{
new dinfo[15][128];
new string[256];
new File:file = fopen("objects.cfg", io_read);
if(file)
{
new idx = 1;
while(idx < MAX_GATES)
{
fread(file, string);
split(string, dinfo, '|');
ObjectInfo[idx][oModel] = strval(dinfo[0]);
ObjectInfo[idx][OCX] = floatstr(dinfo[1]);
ObjectInfo[idx][OCY] = floatstr(dinfo[2]);
ObjectInfo[idx][OCZ] = floatstr(dinfo[3]);
ObjectInfo[idx][OCRX] = floatstr(dinfo[4]);
ObjectInfo[idx][OCRY] = floatstr(dinfo[5]);
ObjectInfo[idx][OCRZ] = floatstr(dinfo[6]);
ObjectInfo[idx][OOX] = floatstr(dinfo[7]);
ObjectInfo[idx][OOY] = floatstr(dinfo[8]);
ObjectInfo[idx][OOZ] = floatstr(dinfo[9]);
ObjectInfo[idx][OORX] = floatstr(dinfo[10]);
ObjectInfo[idx][OORY] = floatstr(dinfo[11]);
ObjectInfo[idx][OORZ] = floatstr(dinfo[12]);
if(ObjectInfo[idx][OModel]) // If gate exists
{
format(string, sizeof(string), "Gate ID: %d", idx);
ObjectInfo[idx][oObject] = CreateDynamicObject(ObjectInfo[idx][gModel], ObjectInfo[idx][gCX], ObjectInfo[idx][gCY], ObjectInfo[idx][gCZ], ObjectInfo[idx][gCRX], ObjectInfo[idx][gCRY], ObjectInfo[idx][gCRZ]);
ObjectInfo[idx][oText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, ObjectInfo[idx][gCX], ObjectInfo[idx][gCY], ObjectInfo[idx][gCZ], 10);
}
idx++;
}
}
print("Gates loaded successfully.");
return 1;
}
stock SaveObject()
{
new idx = 1, File:file;
new string[256];
while(idx < MAX_GATES)
{
format(string, sizeof(string), "%d|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%f|%s|%f\r\n",
ObjectInfo[idx][oModel],
ObjectInfo[idx][oCX],
ObjectInfo[idx][oCY],
ObjectInfo[idx][oCZ],
ObjectInfo[idx][oCRX],
ObjectInfo[idx][oCRY],
ObjectInfo[idx][oCRZ],
ObjectInfo[idx][oOX],
ObjectInfo[idx][oOY],
ObjectInfo[idx][oOZ],
ObjectInfo[idx][oORX],
ObjectInfo[idx][oORY],
ObjectInfo[idx][oORZ],
if(idx == 1)
{
file = fopen("objects.cfg", io_write);
}
else
{
file = fopen("objects.cfg", io_append);
}
fwrite(file, string);
fclose(file);
idx++;
}
print("Gates saved successfully.");
return 1;
}