07.04.2013, 13:04
(
Последний раз редактировалось MadafakaPro; 14.05.2013 в 20:17.
)
fixed...
stock VehiclePath(vehicleID)
{
new strPath[64];
format(strPath, sizeof(strPath), "/vehicle/%d.ini",vehicleID);
return strPath;
}
stock VehicleLoad(vehicleID, file[])
{
INI_ParseFile(file, "LoadVehicleData", .bExtra = true, .extra = vehicleID);
new pname(MAX_PLAYER_NAME];format(pname,sizeof pname,"%s",VehicleInfo[vehicleID][vOwner]);
VehicleCreate(VehicleInfo[vehicleID][vModel],VehicleInfo[vehicleID][vLoc[0]], VehicleInfo[vehicleID][vColor1], VehicleInfo[vehicleID][vColor2], VehicleInfo[vehicleID][vRespawn],
pname, VehicleInfo[vehicleID][vLocked]);
//NOTE: "vLoc" is an arrey !
}
public LoadVehicleData(vehicleID, name[], value[])
{
new strLoc[8]; // Will hold the location key name dynamically.
INI_Int("model", VehicleInfo[vehicleID][vModel]);
for(new i = 0; i < 4; i++)
{
format(strLoc, sizeof(strLoc), "Loc%d", i), INI_Float(strLoc, VehicleInfo[vehicleID][vLoc[i]]);
INI_Int("color1", VehicleInfo[vehicleID][vColor1]); // You should've guessed it by now.
INI_Int("color2", VehicleInfo[vehicleID][vColor2]);
INI_Int("respawn", VehicleInfo[vehicleID][vRespawn]);
INI_String("owner", VehicleInfo[vehicleID][vOwner], MAX_PLAYER_NAME);
VehicleInfo[vehicleID][vLocked] = INI_Int("locked") == 1 ? true : false;
}
return 1;
}
//you cant loop the return as it will break the loop as there is no brackets!
stock VehicleLoad(vehicleID, file[])
{
INI_ParseFile(file, "LoadVehicleData", .bExtra = true, .extra = vehicleID);
//new pname(MAX_PLAYER_NAME];
format(pname,sizeof pname,"%s",VehicleInfo[vehicleID][vOwner]);
VehicleCreate(VehicleInfo[vehicleID][vModel],VehicleInfo[vehicleID][vLoc], VehicleInfo[vehicleID][vColor1], VehicleInfo[vehicleID][vColor2], VehicleInfo[vehicleID][vRespawn],pname, VehicleInfo[vehicleID][vLocked]);
}
stock VehicleCreate(vehicleModel, Float:vehicleLoc[4], vehicleColor1, vehicleColor2, vehicleRespawn, vehicleOwner[], bool:vehicleLocked)
// This is our most important function. This will create the vehicle with the valid information provided on the arguments.
{
new vehicleid = VehicleGetFreeSlot(); // Get the free slot and store it on the vehicleid variable.
//Now, we will basically put the information from the arguments to our newly created vehicle's array.
VehicleInfo[vehicleid][vModel] = vehicleModel; // Assign our vehicle's model id to the model id provided.
VehicleInfo[vehicleid][vLoc] = vehicleLoc; // Assign our vehicle's position/rotation to the position/rotation provided.
VehicleInfo[vehicleid][vColor1] = vehicleColor1; // Assign our vehicle's primary color to the primary color provided.
VehicleInfo[vehicleid][vColor2] = vehicleColor2; // Assign our vehicle's secondary color to the secondary color provided.
VehicleInfo[vehicleid][vRespawn] = vehicleRespawn; // Assign our vehicle's respawn time to the respawn time provided.
format(VehicleInfo[vehicleid][vOwner], MAX_PLAYER_NAME, vehicleOwner); // Assign our vehicle's owner name to the owner name provided.
VehicleInfo[vehicleid][vLocked] = vehicleLocked; // Assign our vehicle's lock data to the lock data provided.
VehicleInfo[vehicleid][vID] = CreateVehicle(vehicleModel, vehicleLoc[0], vehicleLoc[1], vehicleLoc[2], vehicleLoc[3], vehicleColor1, vehicleColor2,
vehicleRespawn); // Now we are doing two things. We are creating our vehicle on the sa-mp world based on the data provided as well as assigning the
// sa-mp vehicle id to our system's vehicle id so that we can alter it later.
vCreated[vehicleid] = true; // Tell our vehicle management variable that this vehicle creation has been done and it's now on the system.
VehicleLock(vehicleid, VehicleInfo[vehicleid][vLocked]); // Toggle our vehicle's door based on the parameter.
return vehicleid; // Return the newly created vehicle's system id.
}
new pname(MAX_PLAYER_NAME]; format(pname,sizeof pname,"%s",VehicleInfo[vehicleID][vOwner]);
C:\Users\user\Desktop\Roleplay\Roleplay\gamemodes\rp.pwn(192) : error 001: expected token: ";", but found "("
C:\Users\user\Desktop\Roleplay\Roleplay\gamemodes\rp.pwn(192) : error 001: expected token: ")", but found "]"
C:\Users\user\Desktop\Roleplay\Roleplay\gamemodes\rp.pwn(192) : warning 215: expression has no effect
C:\Users\user\Desktop\Roleplay\Roleplay\gamemodes\rp.pwn(192) : error 035: argument type mismatch (argument 1)
C:\Users\user\Desktop\Roleplay\Roleplay\gamemodes\rp.pwn(192) : fatal error 107: too many error messages on one line
new pname[MAX_PLAYER_NAME]; format(pname,sizeof pname,"%s",VehicleInfo[vehicleID][vOwner]);
format(strLoc, sizeof(strLoc), "Loc%d", i), INI_Float(strLoc, VehicleInfo[vehicleID][vLoc[i]]);
C:\Users\user\Desktop\Roleplay\Roleplay\gamemodes\rp.pwn(203) : error 029: invalid expression, assumed zero
C:\Users\user\Desktop\Roleplay\Roleplay\gamemodes\rp.pwn(203) : error 001: expected token: ";", but found "return"
C:\Users\user\Desktop\Roleplay\Roleplay\gamemodes\rp.pwn(203) : error 028: invalid subscript (not an array or too many subscripts): "vLoc"
C:\Users\user\Desktop\Roleplay\Roleplay\gamemodes\rp.pwn(203) : fatal error 107: too many error messages on one line