Kod forward:
forward UcitajMotel();
forward SacuvajMotel();Kod new:
new sobeumotelu;Pinfo(izdvojio sam samo pSoba jer o tome govorim):
enum pInfo
{
pSoba
};
new PlayerInfo;Kod OnPlayerConnect:
PlayerInfo = 0;Kod spawna:
/* -------------------------------------- Motel -------------------------------------- */
if (PlayerInfo == 1) //Soba 1
{
SetPlayerPos(playerid, 98.8528,1179.4883,20.9402);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 2) //Soba 2
{
SetPlayerPos(playerid, 98.7300,1171.7739,20.9402);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 3) //Soba 3
{
SetPlayerPos(playerid, 98.8566,1162.1509,20.9402);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 4) //Soba 4
{
SetPlayerPos(playerid, 99.0185,1178.1738,18.6641);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 5) //Soba 5
{
SetPlayerPos(playerid, 98.9961,1170.1553,18.6641);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 6) //Soba 6
{
SetPlayerPos(playerid, 98.9636,1163.6509,18.6641);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 7) //Soba 7
{
SetPlayerPos(playerid, 86.0440,1162.2635,20.9402);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 8) //Soba 8
{
SetPlayerPos(playerid, 78.2655,1162.5160,20.9402);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 9) //Soba 9
{
SetPlayerPos(playerid, 68.7173,1162.3577,20.9402);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 10) //Soba 10
{
SetPlayerPos(playerid, 84.8236,1162.2186,18.6565);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 11) //Soba 11
{
SetPlayerPos(playerid, 76.7669,1162.4476,18.6641);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}
if (PlayerInfo == 12) //Soba 12
{
SetPlayerPos(playerid, 70.0784,1162.2688,18.6641);
SetPlayerInterior(playerid,0);
PlayerInfo = 0;
return 1;
}OnPlayerRegister:
format(var, 32, "Soba=%d\n",PlayerInfo);fwrite(hFile, var);OnPlayerLogin:
if( strcmp( key , "Soba" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo = strval( val ); }Komanda(/rentroom, a pravi /rentroom di iznajmljujes kucu je izmjenjen u drugu komandu):
if (strcmp(cmd, "/rentroom", true) == 0)
{
if(IsPlayerConnected(playerid))
{
new ttemp = 0;
do
{
if(sobeumotelu==0)
{
sobeumotelu = 1;
PlayerInfo = ttemp;
SacuvajMotel();
break;
}
if(ttemp == 11 && sobeumotelu == 1)
{
SendClientMessage(playerid, COLOR_GRAD, " Sve sobe u hotelu su zauzete!");
break;
}
}
while (temp < 12);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " Niste prijavljeni !");
}
return 1;
}Negdje u scripti:
public UcitajMotel()
{
new koordinate;
new FajlPodaci;
new File: file = fopen("motel.ini", io_read);
if(file)
{
fread(file, FajlPodaci);
split(FajlPodaci, koordinate, ',');
new tmot = 0;
while(tmot < 12)
{
sobeumotelu = strval(koordinate);
tmot++;
}
}
else
{
fopen("motel.ini", io_write);
print("Datoteka motel.ini nije nadjena. Sistem ce sada pokusati stvoriti tu datoteku.");
SacuvajMotel();
}
return 1;
}
public SacuvajMotel()
{
new kstr, tpom;
format(kstr, sizeof(kstr), "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", for(tpom = 0; tpom < 12; sobeumotelu, tpom++ ));
new File: file2 = fopen("motel.ini", io_write);
fwrite(file2, kstr);
fclose(file2);
return 1;
}Errori koji mi se javljaju:
D:\Bruno`s Documents\CroMafia\gamemodes\cmr.pwn(4567) : error 029: invalid expression, assumed zero
D:\Bruno`s Documents\CroMafia\gamemodes\cmr.pwn(4567) : error 001: expected token: ")", but found ";"
D:\Bruno`s Documents\CroMafia\gamemodes\cmr.pwn(4567) : warning 215: expression has no effect
D:\Bruno`s Documents\CroMafia\gamemodes\cmr.pwn(4567) : warning 215: expression has no effect
D:\Bruno`s Documents\CroMafia\gamemodes\cmr.pwn(4567) : error 001: expected token: ";", but found ")"
D:\Bruno`s Documents\CroMafia\gamemodes\cmr.pwn(4567) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
4 Errors.To je u redu pod "public SacuvajMotel()":
format(kstr, sizeof(kstr), "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", for(tpom = 0; tpom < 12; sobeumotelu, tpom++ ));