Jump to content
  • 0

pomoc Ukládání aut


Mr.hustoch

Dotaz

Zdravím,potřebuju aby auta která spawnu na serveru (pomočí spawneru) se při opuštení hráčem uložila a spawnula se na tom místě kde je řidič zanechal i při restartu serveru (Nejlepší by bylo bez inc)


UP


UP

Link to comment
Share on other sites

6 odpovědí na tuto otázku

Recommended Posts

  • 0

public OnGameModeInit() {
new
SuborUmiestnenie[12],
StringPrecitany[32],
VozidloModelID,
Float:VozidloPoziciaX,
Float:VozidloPoziciaY,
Float:VozidloPoziciaZ,
Float:VozidloPoziciaUhol;

for (new i; i < MAX_VEHICLES; i++) {
format(SuborUmiestnenie, sizeof (SuborUmiestnenie), "%i.txt", i);
if (fexist(SuborUmiestnenie)) {
new
File:subor = fopen(SuborUmiestnenie, io_read);

if (subor) {
fread(subor, StringPrecitany);
VozidloModelID = strval(StringPrecitany);
fread(subor, StringPrecitany);
VozidloPoziciaX = floatstr(StringPrecitany);
fread(subor, StringPrecitany);
VozidloPoziciaY = floatstr(StringPrecitany);
fread(subor, StringPrecitany);
VozidloPoziciaZ = floatstr(StringPrecitany);
fread(subor, StringPrecitany);
VozidloPoziciaUhol = floatstr(StringPrecitany);
fclose(subor);
CreateVehicle(VozidloModelID, VozidloPoziciaX, VozidloPoziciaY, VozidloPoziciaZ, VozidloPoziciaUhol, -1, -1, 0);
SetVehiclePos(i, VozidloPoziciaX, VozidloPoziciaY, VozidloPoziciaZ);
SetVehicleZAngle(i, VozidloPoziciaUhol);
}
}
}
return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid) {
new
File:subor,
SuborUmiestnenie[12],
forma[64],
VozidloModelID = GetVehicleModel(vehicleid);
Float:VozidloPoziciaX,
Float:VozidloPoziciaY,
Float:VozidloPoziciaZ,
Float:VozidloPoziciaUhol;

GetVehiclePos(vehicleid, VozidloPoziciaX, VozidloPoziciaY, VozidloPoziciaZ);
GetVehicleZAngle(vehicleid, VozidloPoziciaUhol);
format(SuborUmiestnenie, sizeof (SuborUmiestnenie), "%i.txt", vehicleid);
File:subor = fopen(SuborUmiestnenie, io_write);
if (subor) {
format(forma, sizeof (forma), "%i\r\n%f\r\n%f\r\n%f\r\n%f", VozidloModelID, VozidloPoziciaX, VozidloPoziciaY, VozidloPoziciaZ, VozidloPoziciaUhol);
fwrite(subor, forma);
fclose(subor);
}
return 1;
}
Link to comment
Share on other sites

  • 0

Funguje to v pohodě akorát si to mění barvy těch aut jak chce šlo by to nějak vylepšít?

 

EDIT: A ještě mi to hazí tyto varování 

C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(553) : warning 217: loose indentation
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(559) : warning 219: local variable "SuborUmiestnenie" shadows a variable at a preceding level
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(561) : warning 219: local variable "VozidloModelID" shadows a variable at a preceding level
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(562) : warning 221: label name "Float" shadows tag name
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(562) : warning 217: loose indentation
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(562) : warning 215: expression has no effect
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(562 -- 563) : warning 215: expression has no effect
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(562 -- 564) : warning 215: expression has no effect
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(562 -- 565) : warning 215: expression has no effect
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(567) : warning 217: loose indentation
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(570) : warning 221: label name "File" shadows tag name
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(570) : warning 203: symbol is never used: "File"
C:\Users\Zdenek.Zdenek-PC\Desktop\Samp server\gamemodes\game.pwn(562) : warning 203: symbol is never used: "Float"
Link to comment
Share on other sites

  • 0

Toto si hoď iba navrch do modu a nemaj to v tych publikoch..

new

File:subor,

SuborUmiestnenie[12],

forma[64],

VozidloModelID = GetVehicleModel(vehicleid);

Float:VozidloPoziciaX,

Float:VozidloPoziciaY,

Float:VozidloPoziciaZ,

Float:VozidloPoziciaUhol;

 

 

A co sa tyka tej farb vytvor si promenu do ktorej budeš ukladat id farby a v exitvehicle si ju uložíš a v gamemode načitaš

Link to comment
Share on other sites

  • 0

ok barva mi nevadí udělám kod a při dělání do amx mi spadne pawno 

/ This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

new File:subor,forma[64],SuborUmiestnenie[12],StringPrecitany[32],VozidloModelID = GetVehicleModel(vehicleid),Float:VozidloPoziciaX,Float:VozidloPoziciaY,Float:VozidloPoziciaZ,Float:VozidloPoziciaUhol;

public OnFilterScriptInit() {
	for (new i; i < MAX_VEHICLES; i++) {
		format(SuborUmiestnenie, sizeof (SuborUmiestnenie), "%i.txt", i);
		if (fexist(SuborUmiestnenie)) {
			new
				File:subor = fopen(SuborUmiestnenie, io_read);

			if (subor) {
				fread(subor, StringPrecitany);
				VozidloModelID = strval(StringPrecitany);
				fread(subor, StringPrecitany);
				VozidloPoziciaX = floatstr(StringPrecitany);
				fread(subor, StringPrecitany);
				VozidloPoziciaY = floatstr(StringPrecitany);
				fread(subor, StringPrecitany);
				VozidloPoziciaZ = floatstr(StringPrecitany);
				fread(subor, StringPrecitany);
				VozidloPoziciaUhol = floatstr(StringPrecitany);
				fclose(subor);
				CreateVehicle(VozidloModelID, VozidloPoziciaX, VozidloPoziciaY, VozidloPoziciaZ, VozidloPoziciaUhol, -1, -1, 0);
				SetVehiclePos(i, VozidloPoziciaX, VozidloPoziciaY, VozidloPoziciaZ);
				SetVehicleZAngle(i, VozidloPoziciaUhol);
			}
		}
	}
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid) {
	GetVehiclePos(vehicleid, VozidloPoziciaX, VozidloPoziciaY, VozidloPoziciaZ);
	GetVehicleZAngle(vehicleid, VozidloPoziciaUhol);
	format(SuborUmiestnenie, sizeof (SuborUmiestnenie), "%i.txt", vehicleid);
	File:subor = fopen(SuborUmiestnenie, io_write);
	if (subor) {
		format(forma, sizeof (forma), "%i\r\n%f\r\n%f\r\n%f\r\n%f", VozidloModelID, VozidloPoziciaX, VozidloPoziciaY, VozidloPoziciaZ, VozidloPoziciaUhol);
		fwrite(subor, forma);
		fclose(subor);
	}
	return 1;
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...