03.08.2011, 00:50
pawn Код:
forward LoadFactionCars();
forward IsAFactionCar(playerid);
pawn Код:
enum pInfo
{
pKey[128],
pLevel,
pAdmin,
pDonateRank,
gPupgrade,
pConnectTime,
pReg,
pSex,
pAge,
pOrigin,
pMuted,
pExp,
pCash,
pAccount,
pVirWorld,
pLocked,
pAccent,
pLeader,
pMember,
pFactionCar,
//pSQLID,
};
pawn Код:
public LoadFactionCars()
{
new arrCoords[8][64];
new strFromFile2[256];
new File: file = fopen("factioncars.cfg", io_read);
if (file)
{
new idx = 184;
while (idx < sizeof(CarInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
CarInfo[idx][cModel] = strval(arrCoords[0]);
CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);
CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);
CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);
CarInfo[idx][cAngle] = floatstr(arrCoords[4]);
CarInfo[idx][cColorOne] = strval(arrCoords[5]);
CarInfo[idx][cColorTwo] = strval(arrCoords[6]);
strmid(PlayerInfo[idx][pFactionCar], arrCoords[7], 0, strlen(arrCoords[7]), 255);
idx++;
}
}
return 1;
}
public IsAFactionCar(player)
{
if(PlayerInfo[playerid][pFactionCar] == 6) { }
else {
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY,"You don't have keys of this vehicle.");}
}
I was trying to create this kind of dynamic car script thing, so that I can add faction cars into a .cfg file, and just put the cars into that file and put the faction number on the end.
Made it so that when I make someone leader or invite someone to a family, it automatically changes the [pFactionCar] to the faction number, my only problem is that when I go into the car, I don't get thrown out.
I know it probably has something to do with that I forwarded "IsAFactionCar" as playerid and all that shit, but not sure how to fix it properly.
I would be extremely grateful if someone could give me a little push here,
Thanks in advance.