AddCar(Filename[], CarMod, Cost, Float:Spawnx, Float:Spawny, Float:Spawnz, Rot, Col1,Col2)
AddCar("Infernus", 411, 5000, 2019.5199, -1253.3680, 23.7115, 116, 12, 12);
Originally Posted by xenowortt
ohh good! Nice work!
|
#include <a_samp> #include <dini> #define MAX_CARS 200 #define RED 0xF60000AA enum carinfo { CarNames[60], //To save into the file CarModel, //The Car model CarCost, //The car cost CarOwner[24], // The car owners Name CarIsBought, //If the car is brought or not Float:SpawnX, // PickupX Float:SpawnY, //PickupY Float:SpawnZ, //PickupZ Color1, Color2, Rotation, Owned, } new CarInfo[MAX_CARS][carinfo]; new CarCount = -1; //Car count stock AddCar(Filename[], CarMod, Cost, Float:Spawnx, Float:Spawny, Float:Spawnz, Rot, Col1, Col2) { if(!dini_Exists("Cars.ini")) { dini_Create("Cars.ini"); } CarCount ++; new ID = CarCount; //CarID format(CarInfo[ID][CarNames], 60, "%s", Filename); //Saves the Car Name into a variable CarInfo[ID][CarIsBought] = 0; CarInfo[ID][SpawnX] = Spawnx; CarInfo[ID][SpawnY] = Spawny; CarInfo[ID][SpawnZ] = Spawnz; CarInfo[ID][CarModel] = CarMod; CarInfo[ID][Color1] = Col1; CarInfo[ID][Color2] = Col2; CarInfo[ID][Rotation] = Rot; if(strlen(dini_Get("Cars.ini", Filename))) //This is to see if there is any owner. { format(CarInfo[ID][CarOwner], 24, "%s", dini_Get("Cars.ini", Filename)); CarInfo[ID][Owned] = 1; } AddStaticVehicle(CarMod,Spawnx,Spawny,Spawnz,Rot,Col1,Col2); // car } public OnGameModeInit() { AddCar("Bullet", 411, 5000, 2019.5199, -1253.3680, 23.7115, 116, 12, 12);System Loaded"); AddCar("Huntley", 579, 12345, 1560.7213, -2254.2932, 13.4793, 270.1003, 42, 42); return 1; } public OnFilterScriptInit() { print("\n--------------------------------------"); print(" [SB] Car System Loaded"); print("--------------------------------------\n"); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/vbuy", cmdtext) == 0) { for(new i; i<MAX_CARS; i++) { if(IsPlayerInAnyVehicle(playerid)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strlen(dini_Get("Cars.ini", Pname))) if(GetPlayerMoney(playerid) < CarInfo[i][CarCost]) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this Car!"); if(CarInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This Car is already owned!"); SetPlayerMoney(playerid, GetPlayerMoney(playerid) - CarInfo[i][CarCost]); GameTextForPlayer(playerid, "~r~Car Purchased!", 2000, 3); CarInfo[i][Owned] = 1; format(CarInfo[i][CarOwner], 24, "%s", Pname); dini_Set("Cars.ini", Pname, CarInfo[i][CarNames]); return 1; } else if(!IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, RED, "You must be in a car!"); } else if(GetPlayerVehicleID(playerid) != CarInfo[i][CarNames]) { SendClientMessage(playerid, RED, "Unsupported Car!"); } } return 1; } if (strcmp("/vsell", cmdtext) == 0) { for(new i; i<MAX_CARS; i++) { if(IsPlayerInAnyVehicle(playerid)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, CarInfo[i][CarOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this Car!"); GivePlayerMoney(playerid, CarInfo[i][CarCost]); GameTextForPlayer(playerid, "~g~Car Sold!", 2000, 3); CarInfo[i][Owned] = 0; CarInfo[i][CarOwner] = EOS; dini_Unset("Cars.ini", Pname); return 1; } else if(!IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, RED, "You are not in a vehicle!"); } } } return 0; }
Originally Posted by jocki
Fatal error in 100 ?
Код:
#include <a_samp> #include <dini> #define MAX_CARS 200 #define RED 0xF60000AA enum carinfo { CarNames[60], //To save into the file CarModel, //The Car model CarCost, //The car cost CarOwner[24], // The car owners Name CarIsBought, //If the car is brought or not Float:SpawnX, // PickupX Float:SpawnY, //PickupY Float:SpawnZ, //PickupZ Color1, Color2, Rotation, Owned, } new CarInfo[MAX_CARS][carinfo]; new CarCount = -1; //Car count stock AddCar(Filename[], CarMod, Cost, Float:Spawnx, Float:Spawny, Float:Spawnz, Rot, Col1, Col2) { if(!dini_Exists("Cars.ini")) { dini_Create("Cars.ini"); } CarCount ++; new ID = CarCount; //CarID format(CarInfo[ID][CarNames], 60, "%s", Filename); //Saves the Car Name into a variable CarInfo[ID][CarIsBought] = 0; CarInfo[ID][SpawnX] = Spawnx; CarInfo[ID][SpawnY] = Spawny; CarInfo[ID][SpawnZ] = Spawnz; CarInfo[ID][CarModel] = CarMod; CarInfo[ID][Color1] = Col1; CarInfo[ID][Color2] = Col2; CarInfo[ID][Rotation] = Rot; if(strlen(dini_Get("Cars.ini", Filename))) //This is to see if there is any owner. { format(CarInfo[ID][CarOwner], 24, "%s", dini_Get("Cars.ini", Filename)); CarInfo[ID][Owned] = 1; } AddStaticVehicle(CarMod,Spawnx,Spawny,Spawnz,Rot,Col1,Col2); // car } public OnGameModeInit() { AddCar("Bullet", 411, 5000, 2019.5199, -1253.3680, 23.7115, 116, 12, 12);System Loaded"); AddCar("Huntley", 579, 12345, 1560.7213, -2254.2932, 13.4793, 270.1003, 42, 42); return 1; } public OnFilterScriptInit() { print("\n--------------------------------------"); print(" [SB] Car System Loaded"); print("--------------------------------------\n"); return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/vbuy", cmdtext) == 0) { for(new i; i<MAX_CARS; i++) { if(IsPlayerInAnyVehicle(playerid)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strlen(dini_Get("Cars.ini", Pname))) if(GetPlayerMoney(playerid) < CarInfo[i][CarCost]) return SendClientMessage(playerid, 0xF60000AA, "You don't have enough money to buy this Car!"); if(CarInfo[i][Owned] == 1) return SendClientMessage(playerid, 0xF60000AA, "This Car is already owned!"); SetPlayerMoney(playerid, GetPlayerMoney(playerid) - CarInfo[i][CarCost]); GameTextForPlayer(playerid, "~r~Car Purchased!", 2000, 3); CarInfo[i][Owned] = 1; format(CarInfo[i][CarOwner], 24, "%s", Pname); dini_Set("Cars.ini", Pname, CarInfo[i][CarNames]); return 1; } else if(!IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, RED, "You must be in a car!"); } else if(GetPlayerVehicleID(playerid) != CarInfo[i][CarNames]) { SendClientMessage(playerid, RED, "Unsupported Car!"); } } return 1; } if (strcmp("/vsell", cmdtext) == 0) { for(new i; i<MAX_CARS; i++) { if(IsPlayerInAnyVehicle(playerid)) { new Pname[24]; GetPlayerName(playerid, Pname, 24); if(strcmp(Pname, CarInfo[i][CarOwner]) != 0) return SendClientMessage(playerid, 0xF60000AA, "You don't own this Car!"); GivePlayerMoney(playerid, CarInfo[i][CarCost]); GameTextForPlayer(playerid, "~g~Car Sold!", 2000, 3); CarInfo[i][Owned] = 0; CarInfo[i][CarOwner] = EOS; dini_Unset("Cars.ini", Pname); return 1; } else if(!IsPlayerInAnyVehicle(playerid)) { SendClientMessage(playerid, RED, "You are not in a vehicle!"); } } } return 0; } |
C:\Dokumente und Einstellungen\Tim Macik\Desktop\Cars.pwn(2) : fatal error 100: cannot read from file: "dini"
whats wrong? |