ksystofs

Auto save

Recommended Posts

Sveiki, turiu serveryje autosave, bet kai iseinu is serverio, poto uzeinu pinigus ir kitus dalykus saugo, o zaidejo pozicija ne, ka daryt? anksciau taip nebuvo, ir kai iseinu is servo (ijunges savo kompe) išsijungia samp-server.exe

Tad laukiu pagalbos,

(kai serveri esu ijunges ant kompo) kodel kai serveryje rasau /q arba iseinu tada isjungia samp-server.exe programele

Dalintis ┼í─» prane┼íim─ů


Nuoroda iki šio pranešimo
Dalintis per kit─ů puslap─»

bandyk Po

public OnPlayerDisconnect(playerid,reason) 

Irašyk

switch(reason)
{
case 0: SavePlayerData(playerid,false);
case 1: SavePlayerData(playerid,false);
case 2: SavePlayerData(playerid,false);
}

Jeigu padejau gal negaila + Rep duoti bus :)

Dalintis ┼í─» prane┼íim─ů


Nuoroda iki šio pranešimo
Dalintis per kit─ů puslap─»

ten kur yra tavo save tai rašyk

new Float:x,Float:y,Float:z;
dini_FloatSet(file,"posx",x);
dini_FloatSet(file,"posy",y);
dini_FloatSet(file,"posz",z);


Ten kur tavo u┼żkrovimas d─Śk :

SetPlayerPos(playerid,dini_Float(file,"posx"),dini_Float(file,"posy"),dini_Float(file,"posz"));


Dalintis ┼í─» prane┼íim─ů


Nuoroda iki šio pranešimo
Dalintis per kit─ů puslap─»
bandyk Po
public OnPlayerDisconnect(playerid,reason) 

Irašyk

switch(reason)
{
case 0: SavePlayerData(playerid,false);
case 1: SavePlayerData(playerid,false);
case 2: SavePlayerData(playerid,false);
}

Jeigu padejau gal negaila + Rep duoti bus :)

Gaila, bet nepadejai, taspats ir dabar su tavo scriptu:(

Dalintis ┼í─» prane┼íim─ů


Nuoroda iki šio pranešimo
Dalintis per kit─ů puslap─»

buvo problema filterscripte, bet kaip ji nuimiau viskas ok,

kas cia netaip?

#include 
#include 


AntiDeAMX()
{
   new a[][] =
   {
       "Unarmed (Fist)",
       "Brass K"
   };
   #pragma unused a
}


#define RESETCARS

#define CARSELL

#if defined CARSELL

#endif

#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIGHTRED 0xFF6347AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_LIGHTGREEN 0x9ACD32AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_YELLOW2 0xF5DEB3AA
#define COLOR_WHITE 0xFFFFFFAA

forward SetVehicleParamsForAll(carid,objective,doorslocked);
forward CreateTunedCar(playerid);
forward DelayDestroyCar(playerid);
forward DelaySetVehicleParams(playerid);
forward ResetAutohausSpawns();

enum ahCar
{
Typ2,
Float:X,
Float:Y,
Float:Z,
Float:Rotation,
Status,
Lock,
Carid,
Paintjob,
Color1,
Color2,
mod1,
mod2,
mod3,
mod4,
mod5,
mod6,
mod7,
mod8,
mod9,
mod10,
mod11,
mod12,
mod13,
mod14,
mod15,
mod16,
mod17,
};
new Carlist2[MAX_PLAYERS][ahCar];

enum ahSpawn
{
Float:X,
Float:Y,
Float:Z,
Float:Rotation,
};
new Carspawns[2][ahSpawn] = {
{739.7457,-1343.8668,13.2828,270.2592},
{-1639.3599,1198.1665,6.9527,269.9673}
};

enum ahModel
{
Name[128],
Autohaus,
Modelid,
Carid,
Price,
Repair,
Float:X,
Float:Y,
Float:Z,
Float:Rotation,
};
new Buylist[21][ahModel] = {
{"Blista Compact",1,496,-1,40000,2500,-1668.6447,1207.0372,7.0249,309.5959},
{"Buffalo",1,402,-1,250000,3000,-1663.6709,1215.2883,7.0234,274.9868},
{"Bullet",1,541,-1,320000,17500,-1651.3892,1210.3469,7.0208,281.3321},
{"Banshee",1,429,-1,53000,10000,-1677.3560,1207.8099,13.4461,208.2602},
{"BF-400",1,581,-1,32000,750,-1665.7789,1222.4406,13.4485,279.6459},
{"Euros",1,587,-1,50000,7000,-1660.7256,1217.6407,13.4444,283.1553},
{"Infernus",1,411,-1,148000,7000,-1653.2462,1210.7842,13.4460,266.7211},
{"Phoenix",1,603,-1,140000,4000,-1664.4386,1206.8241,20.9289,332.5978},
{"Super GT",1,506,-1,320000,20000,-1651.6372,1208.2538,20.9231,305.1015},
{"Turismo",1,451,-1,400000,20000,-1665.1248,1222.7113,20.9265,267.4103},
{"Uranus",1,558,-1,85000,10000,-1661.1943,1217.9629,20.9268,286.1662},
{"ZR-350",1,477,-1,220000,7000,-1654.3116,1214.8097,20.9267,173.5712},
{"Hermes",1,474,-1,70000,7000,-1655.3134,1213.9294,6.9771,286.5933},
{"Sultan",1,560,-1,80000,17000,-1668.7091,1205.4949,13.4208,286.5933},
{"Elegy",1,562,-1,150000,17000,-1656.5016,1214.3345,13.3991,299.7012},
{"Alpha",1,602,-1,20000,200,-1659.1598,1213.4072,20.8799,299.7012},
	{"Admiral",1,445,-1,30000,500,-1658.4358,1204.8983,20.8814,266.3032},
	{"NRG-500",1,522,-1,430000,40500,-1670.0909,1221.8965,6.8493,227.4652},
	{"PCJ-600",1,461,-1,43000,4050,-1670.8348,1221.0856,6.8494,227.4653},
	{"Wayfarer",1,586,-1,90000,10000,-1673.9457,1217.6946,6.8494,227.4653},
	{"Sanchez",1,468,-1,70000,8000,-1675.7222,1215.7582,6.8495,227.4653}

};
new Spectating[MAX_PLAYERS][1];

// begin of tuning component list
new spoiler[20][0] = {
{1000},
{1001},
{1002},
{1003},
{1014},
{1015},
{1016},
{1023},
{1058},
{1060},
{1049},
{1050},
{1138},
{1139},
{1146},
{1147},
{1158},
{1162},
{1163},
{1164}
};

new nitro[3][0] = {
   {1008},
   {1009},
   {1010}
};

new fbumper[23][0] = {
   {1117},
   {1152},
   {1153},
   {1155},
   {1157},
   {1160},
   {1165},
   {1167},
   {1169},
   {1170},
   {1171},
   {1172},
   {1173},
   {1174},
   {1175},
   {1179},
   {1181},
   {1182},
   {1185},
   {1188},
   {1189},
   {1192},
   {1193}
};

new rbumper[22][0] = {
   {1140},
   {1141},
   {1148},
   {1149},
   {1150},
   {1151},
   {1154},
   {1156},
   {1159},
   {1161},
   {1166},
   {1168},
   {1176},
   {1177},
   {1178},
   {1180},
   {1183},
   {1184},
   {1186},
   {1187},
   {1190},
   {1191}
};

new exhaust[28][0] = {
   {1018},
   {1019},
   {1020},
   {1021},
   {1022},
   {1028},
   {1029},
   {1037},
   {1043},
   {1044},
   {1045},
   {1046},
   {1059},
   {1064},
   {1065},
   {1066},
   {1089},
   {1092},
   {1104},
   {1105},
   {1113},
   {1114},
   {1126},
   {1127},
   {1129},
   {1132},
   {1135},
   {1136}
};

new bventr[2][0] = {
   {1042},
   {1044}
};

new bventl[2][0] = {
   {1043},
   {1045}
};

new bscoop[4][0] = {
{1004},
{1005},
{1011},
{1012}
};

new rscoop[13][0] = {
   {1006},
   {1032},
   {1033},
   {1035},
   {1038},
   {1053},
   {1054},
   {1055},
   {1061},
   {1067},
   {1068},
   {1088},
   {1091}
};

new lskirt[21][0] = {
   {1007},
   {1026},
   {1031},
   {1036},
   {1039},
   {1042},
   {1047},
   {1048},
   {1056},
   {1057},
   {1069},
   {1070},
   {1090},
   {1093},
   {1106},
   {1108},
   {1118},
   {1119},
   {1133},
   {1122},
   {1134}
};

new rskirt[21][0] = {
   {1017},
   {1027},
   {1030},
   {1040},
   {1041},
   {1051},
   {1052},
   {1062},
   {1063},
   {1071},
   {1072},
   {1094},
   {1095},
   {1099},
   {1101},
   {1102},
   {1107},
   {1120},
   {1121},
   {1124},
   {1137}
};

new hydraulics[1][0] = {
   {1087}
};

new base[1][0] = {
   {1086}
};

new rbbars[2][0] = {
   {1109},
   {1110}
};

new fbbars[2][0] = {
   {1115},
   {1116}
};

new wheels[17][0] = {
   {1025},
   {1073},
   {1074},
   {1075},
   {1076},
   {1077},
   {1078},
   {1079},
   {1080},
   {1081},
   {1082},
   {1083},
   {1084},
   {1085},
   {1096},
   {1097},
   {1098}
};

new lights[2][0] = {
{1013},
{1024}
};
// end of tuning component list

#if defined CARSELL
new offerCar[MAX_PLAYERS][2];
#endif

public OnPlayerSpawn(playerid)
{
       AntiDeAMX();
       return 1;
}

ini_GetKey( line[] )
{
new keyRes[256];
keyRes[0] = 0;
   if ( strfind( line , "=" , true ) == -1 ) return keyRes;
   strmid( keyRes , line , 0 , strfind( line , "=" , true ) , sizeof( keyRes) );
   return keyRes;
}

ini_GetValue( line[] )
{
new valRes[256];
valRes[0]=0;
if ( strfind( line , "=" , true ) == -1 ) return valRes;
strmid( valRes , line , strfind( line , "=" , true )+1 , strlen( line ) , sizeof( valRes ) );
return valRes;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
	index++;
}

new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
	result[index - offset] = string[index];
	index++;
}
result[index - offset] = EOS;
return result;
}

IsAutohausCar(carid)
{
new i;
for(i=0; i	{
    if(Buylist[i][Carid]==carid) { return i; }
}
return -1;
}

GetPlayerFromCarlist2Car(carid)
{
new i;
for(i=0; i	{
    if(Carlist2[i][Carid]==carid) { return i; }
}
return -1;
}

GetModType(componentid)
{
new i;
for(i=0; i<20; i++)
{
    if(spoiler[i][0]==componentid) { return 1; }
}
for(i=0; i<3; i++)
{
    if(nitro[i][0]==componentid) { return 2; }
}
for(i=0; i<23; i++)
{
    if(fbumper[i][0]==componentid) { return 3; }
}
for(i=0; i<22; i++)
{
    if(rbumper[i][0]==componentid) { return 4; }
}
for(i=0; i<28; i++)
{
    if(exhaust[i][0]==componentid) { return 5; }
}
for(i=0; i<2; i++)
{
    if(bventr[i][0]==componentid) { return 6; }
}
for(i=0; i<2; i++)
{
    if(bventl[i][0]==componentid) { return 7; }
}
for(i=0; i<4; i++)
{
    if(bscoop[i][0]==componentid) { return 8; }
}
for(i=0; i<13; i++)
{
    if(rscoop[i][0]==componentid) { return 9; }
}
for(i=0; i<21; i++)
{
    if(lskirt[i][0]==componentid) { return 10; }
}
for(i=0; i<21; i++)
{
    if(rskirt[i][0]==componentid) { return 11; }
}
if(hydraulics[0][0]==componentid) { return 12; }
if(base[0][0]==componentid) { return 13; }
for(i=0; i<2; i++)
{
    if(rbbars[i][0]==componentid) { return 14; }
}
for(i=0; i<2; i++)
{
    if(fbbars[i][0]==componentid) { return 15; }
}
for(i=0; i<17; i++)
{
    if(wheels[i][0]==componentid) { return 16; }
}
for(i=0; i<2; i++)
{
    if(lights[i][0]==componentid) { return 17; }
}
return 0;
}

public OnFilterScriptInit()
{
print("----------------------------------");
print(" ~*~ Mobile Cardealership 1.4 ~*~");
print(" ~*~     (c) 2009 by ping     ~*~");
print("----------------------------------\n");

new i;
for(i=0; i	{
	Buylist[i][Carid]=CreateVehicle(Buylist[i][Modelid],Buylist[i][X],Buylist[i][Y],Buylist[i][Z],Buylist[i][Rotation],-1,-1,-1);
}
for(i=0; i	{
	Spectating[i][0]=-1;
}
return 1;
}

public OnPlayerConnect(playerid)
{
new dateiname[MAX_PLAYER_NAME+4];
new playername[MAX_PLAYER_NAME];
Carlist2[playerid][Typ2]=-1; Carlist2[playerid][X]=0.0; Carlist2[playerid][Y]=0.0; Carlist2[playerid][Z]=0.0;
Carlist2[playerid][Rotation]=0.0; Carlist2[playerid][status]=0; Carlist2[playerid][Lock]=0; Carlist2[playerid][Carid]=-1;
Carlist2[playerid][Color1]=-1; Carlist2[playerid][Color2]=-1; Carlist2[playerid][mod1]=-1; Carlist2[playerid][mod2]=-1;
Carlist2[playerid][mod3]=-1; Carlist2[playerid][mod4]=-1; Carlist2[playerid][mod5]=-1; Carlist2[playerid][mod6]=-1;
Carlist2[playerid][mod7]=-1; Carlist2[playerid][mod8]=-1; Carlist2[playerid][mod9]=-1; Carlist2[playerid][mod10]=-1;
Carlist2[playerid][mod11]=-1; Carlist2[playerid][mod12]=-1; Carlist2[playerid][mod13]=-1; Carlist2[playerid][mod14]=-1;
Carlist2[playerid][mod15]=-1; Carlist2[playerid][mod16]=-1; Carlist2[playerid][mod17]=-1; Carlist2[playerid][Paintjob]=-1;
Spectating[playerid][0]=-1;
#if defined CARSELL
offerCar[playerid]={-1,0};
#endif
   GetPlayerName(playerid, playername, sizeof(playername));
format(dateiname, sizeof(dateiname), "saves/masinos/%s", playername);
if (fexist(dateiname))
{
	new File: CarFile = fopen(dateiname, io_read);
	if ( CarFile )
	{
	    new key[ 256 ];
	    new Data[ 256 ];
	    while ( fread( CarFile , Data , sizeof( Data ) ) )
		{
			key = ini_GetKey(Data);
			if(strcmp(key,"AH_Typ2",true)==0) { Carlist2[playerid][Typ2]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_X",true)==0) { Carlist2[playerid][X]=floatstr(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_Y",true)==0) { Carlist2[playerid][Y]=floatstr(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_Z",true)==0) { Carlist2[playerid][Z]=floatstr(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_Rot",true)==0) { Carlist2[playerid][Rotation]=floatstr(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_Status",true)==0) { Carlist2[playerid][status]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_Lock",true)==0) { Carlist2[playerid][Lock]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_Paintjob",true)==0) { Carlist2[playerid][Paintjob]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_Color1",true)==0) { Carlist2[playerid][Color1]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_Color2",true)==0) { Carlist2[playerid][Color2]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod1",true)==0) { Carlist2[playerid][mod1]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod2",true)==0) { Carlist2[playerid][mod2]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod3",true)==0) { Carlist2[playerid][mod3]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod4",true)==0) { Carlist2[playerid][mod4]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod5",true)==0) { Carlist2[playerid][mod5]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod6",true)==0) { Carlist2[playerid][mod6]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod7",true)==0) { Carlist2[playerid][mod7]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod8",true)==0) { Carlist2[playerid][mod8]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod9",true)==0) { Carlist2[playerid][mod9]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod10",true)==0) { Carlist2[playerid][mod10]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod11",true)==0) { Carlist2[playerid][mod11]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod12",true)==0) { Carlist2[playerid][mod12]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod13",true)==0) { Carlist2[playerid][mod13]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod14",true)==0) { Carlist2[playerid][mod14]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod15",true)==0) { Carlist2[playerid][mod15]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod16",true)==0) { Carlist2[playerid][mod16]=strval(ini_GetValue(Data)); }
		    else if(strcmp(key,"AH_mod17",true)==0) { Carlist2[playerid][mod17]=strval(ini_GetValue(Data)); }
		}
	}
    fclose(CarFile);
    if(Carlist2[playerid][Typ2]!=-1 && Carlist2[playerid][status]==1)
    {
        Carlist2[playerid][Carid]=CreateTunedCar(playerid);
	}
}
SetTimerEx("DelaySetVehicleParams",10000,0,"i",playerid);
return 1;
}

public OnPlayerDisconnect(playerid)
{
new dateiname[MAX_PLAYER_NAME+4];
new playername[MAX_PLAYER_NAME];
new var[256];
   GetPlayerName(playerid, playername, sizeof(playername));
format(dateiname, sizeof(dateiname), "saves/masinos/%s", playername);
new File: CarFile = fopen(dateiname, io_write);
   format(var, 256, "AH_Typ2=%i\n", Carlist2[playerid][Typ2]); fwrite(CarFile, var);
   format(var, 256, "AH_X=%f\n", Carlist2[playerid][X]); fwrite(CarFile, var);
format(var, 256, "AH_Y=%f\n", Carlist2[playerid][Y]); fwrite(CarFile, var);
format(var, 256, "AH_Z=%f\n", Carlist2[playerid][Z]); fwrite(CarFile, var);
format(var, 256, "AH_Rot=%f\n", Carlist2[playerid][Rotation]); fwrite(CarFile, var);
format(var, 256, "AH_Status=%i\n", Carlist2[playerid][status]); fwrite(CarFile, var);
format(var, 256, "AH_Lock=%i\n", Carlist2[playerid][Lock]); fwrite(CarFile, var);
format(var, 256, "AH_Paintjob=%i\n", Carlist2[playerid][Paintjob]); fwrite(CarFile, var);
format(var, 256, "AH_Color1=%i\n", Carlist2[playerid][Color1]); fwrite(CarFile, var);
format(var, 256, "AH_Color2=%i\n", Carlist2[playerid][Color2]); fwrite(CarFile, var);
format(var, 256, "AH_mod1=%i\n", Carlist2[playerid][mod1]); fwrite(CarFile, var);
format(var, 256, "AH_mod2=%i\n", Carlist2[playerid][mod2]); fwrite(CarFile, var);
format(var, 256, "AH_mod3=%i\n", Carlist2[playerid][mod3]); fwrite(CarFile, var);
format(var, 256, "AH_mod4=%i\n", Carlist2[playerid][mod4]); fwrite(CarFile, var);
format(var, 256, "AH_mod5=%i\n", Carlist2[playerid][mod5]); fwrite(CarFile, var);
format(var, 256, "AH_mod6=%i\n", Carlist2[playerid][mod6]); fwrite(CarFile, var);
format(var, 256, "AH_mod7=%i\n", Carlist2[playerid][mod7]); fwrite(CarFile, var);
format(var, 256, "AH_mod8=%i\n", Carlist2[playerid][mod8]); fwrite(CarFile, var);
format(var, 256, "AH_mod9=%i\n", Carlist2[playerid][mod9]); fwrite(CarFile, var);
format(var, 256, "AH_mod10=%i\n", Carlist2[playerid][mod10]); fwrite(CarFile, var);
format(var, 256, "AH_mod11=%i\n", Carlist2[playerid][mod11]); fwrite(CarFile, var);
format(var, 256, "AH_mod12=%i\n", Carlist2[playerid][mod12]); fwrite(CarFile, var);
format(var, 256, "AH_mod13=%i\n", Carlist2[playerid][mod13]); fwrite(CarFile, var);
format(var, 256, "AH_mod14=%i\n", Carlist2[playerid][mod14]); fwrite(CarFile, var);
format(var, 256, "AH_mod15=%i\n", Carlist2[playerid][mod15]); fwrite(CarFile, var);
format(var, 256, "AH_mod16=%i\n", Carlist2[playerid][mod16]); fwrite(CarFile, var);
format(var, 256, "AH_mod17=%i\n", Carlist2[playerid][mod17]); fwrite(CarFile, var);
   fclose(CarFile);
   if(Carlist2[playerid][Carid]!=-1)
{
	SetVehicleParamsForAll(Carlist2[playerid][Carid],0,0);
	DestroyVehicle(Carlist2[playerid][Carid]);
	Carlist2[playerid][Carid]=-1;
}
   if (Spectating[playerid][0]!=-1)
   {
       SetVehicleParamsForAll(Buylist[spectating[playerid][0]][Carid],0,0);
       Spectating[playerid][0]=-1;
}
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
new i;
for(i=0; i	{
		if(Carlist2[i][Carid]==vehicleid)
		{
	 	SetTimerEx("DelayDestroyCar",3000,0,"i",i);
		return 1;
		}
}
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{

      	if(!strcmp(cmdtext, "/raktai 2", true))
{
    if (Carlist2[playerid][Typ2]!=-1)
    {
		if (Carlist2[playerid][Carid]!=-1)
		{
			if (Carlist2[playerid][Lock]==0)
			{
			    Carlist2[playerid][Lock]=1;
			    SetVehicleParamsForAll(Carlist2[playerid][Carid],0,1);
			    SetVehicleParamsForPlayer(Carlist2[playerid][Carid],playerid,0,0);
				SendClientMessage(playerid, COLOR_RED, "* Antras automobilis s├źkmingai u├żrakintas");
			}
			else
			{
			    Carlist2[playerid][Lock]=0;
			    SetVehicleParamsForAll(Carlist2[playerid][Carid],0,0);
			    SendClientMessage(playerid, COLOR_RED, "* Antras automobilis s├źkmingai atrakintas");
			}
		}
		else { SendClientMessage(playerid, COLOR_GREY, "* Tavo antroji ma├░ina sudau├żyta, suremontuok j├á /remont!"); }
	}
	else { SendClientMessage(playerid, COLOR_GREY, "* J├╗s neturite antro automobilio!"); }
    return 1;
}

	new tmp[128];
new cmd[128],idx,string[128];
#if defined CARSELL
#endif
cmd = strtok(cmdtext, idx);

if (strcmp("/2masina", cmd, true, 9) == 0)
{
    if(IsPlayerConnected(playerid))
    {
		#if defined CARSELL

			    ShowPlayerDialog(playerid,6,DIALOG_STYLE_LIST,"{FFFFFF}[ {00C0FF}SERVERIS {FFFFFF}]","			Serverio 2 transporto komandos\n\n1. /raktai 2 - U├żrakina Atrakina j├╗s├Ş transport├á\n2. /2remont - Suremontuoja j├╗s├Ş transport├á\n3. /spos - I├░saugo j├╗s├Ş transporto pozicij├á\n4. /2carmapas - Parodo j├╗s├Ş transporto pozicij├á\n5. /2ismesti - I├░mesti i├░ j├╗s├Ş transporto\n6. /2cparduoti - Parduoti transport├á\n7. /2siulyti - Pasi├╗lyti transport├á ├żaid├źjui\n\nPirmos ma├░inos valdymas /masina","U├żdaryti","");

		#endif
	}
	return 1;
}
else if (strcmp("/2spos", cmd, true, 10) == 0)
{
	if (IsPlayerInVehicle(playerid,Carlist2[playerid][Carid]))
	{
	    GetVehiclePos(Carlist2[playerid][Carid],Carlist2[playerid][X],Carlist2[playerid][Y],Carlist2[playerid][Z]);
	    GetVehicleZAngle(Carlist2[playerid][Carid],Carlist2[playerid][Rotation]);
	    CarSaveData(playerid);
	    SendClientMessage(playerid, COLOR_GREEN, "Automobilis i├░saugotas!");
	}
	else { SendClientMessage(playerid, COLOR_GREY, "Cia ne j├╗s├Ş automobilis!"); }
	return 1;
}

/*else if(!strcmp(cmdtext, "/2carmapas", true,9))
{
 if (Carlist2[playerid][Carid]==-1)
 {
  SendClientMessage(playerid,COLOR_GREY,"* Jus neturite masinos.Arba ji sudauzyta.Pabandykit /remont");
  return 1;
 }

 	new msg[128],Float:coo[6];
 	GetVehiclePos(Carlist2[playerid][Carid],coo[0],coo[1],coo[2]);
 	GetPlayerPos(playerid,coo[3],coo[4],coo[5]);
 	new Float:atstumas = ((floatabs(coo[0]-coo[3])+floatabs(coo[1]-coo[4])+floatabs(coo[2]-coo[5]))/3)/100;

 new salis1[10],salis2[10];

 if(coo[0]-coo[3]>0) salis1="rytus"; else salis1="vakarus";
 if(coo[1]-coo[4]>0) salis2="siaures"; else salis2="pietu";

 format(msg,sizeof(msg),"* Ie├░kokite savo automobilio.Jis yra %f KM i %s %s nuo jusu.",atstumas,salis2,salis1);
 SendClientMessage(playerid,COLOR_GREY,msg);
 return 1;
}*/
	else if(!strcmp(cmdtext, "/2carmapas", true,9))
{
 if (Carlist2[playerid][Carid]==-1)
 {
  SendClientMessage(playerid,COLOR_GREY,"* Jus neturite masinos.Arba ji sudauzyta.Pabandykit /remont");
  return 1;
 }
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 431)
{
SendClientMessage(playerid,COLOR_RED,"* Si komanda autobuse nenaudojama");
  	return 1;
  	}
 new msg[128],Float:coo[6];
 GetVehiclePos(Carlist2[playerid][Carid],coo[0],coo[1],coo[2]);
 GetPlayerPos(playerid,coo[3],coo[4],coo[5]);
 new Float:atstumas = ((floatabs(coo[0]-coo[3])+floatabs(coo[1]-coo[4])+floatabs(coo[2]-coo[5]))/3)/100;
 SetPlayerCheckpoint(playerid,coo[0],coo[1],coo[2],2);

 new salis1[10],salis2[10];

 if(coo[0]-coo[3]>0) salis1="rytus"; else salis1="vakarus";
 if(coo[1]-coo[4]>0) salis2="siaures"; else salis2="pietu";

 format(msg,sizeof(msg),"* Dabartine masinos vieta rodoma GPS. Ji yra %f KM i %s %s nuo jusu.",atstumas,salis2,salis1);
 SendClientMessage(playerid,COLOR_GREY,msg);
 return 1;
}
	else if (strcmp("/2remont", cmd, true, 10) == 0)
{
    if (Carlist2[playerid][Typ2]!=-1)
    {
		if (Carlist2[playerid][status]==0)
		{
		    new reparatur = Buylist[Carlist2[playerid][Typ2]][Repair];
			if (reparatur <= GetPlayerMoney(playerid))
			{
			    Carlist2[playerid][status]=1;
			    Carlist2[playerid][Carid]=CreateTunedCar(playerid);
				GivePlayerMoney(playerid, - reparatur);
				format(string, 128, "Suremontavote automobili uz $%i! Jis atsirado ten kur ji buvote priparkave.", reparatur);
				SendClientMessage(playerid, COLOR_RED, string);
			}
			else { format(string, 128, "Truksta pinigu remontui(reikia: $%i)!", reparatur); SendClientMessage(playerid, COLOR_LIGHTRED, string); }
		}
        else { SendClientMessage(playerid, COLOR_GREY, "Tau nereikia remontuoti masinos!"); }
	}
	else { SendClientMessage(playerid, COLOR_GREY, "Jus neturite masinos!"); }
	return 1;
}
/*	else if (strcmp("/raktai 2", cmd, true))
{
    if (Carlist2[playerid][Typ2]!=-1)
    {
		if (Carlist2[playerid][Carid]!=-1)
		{
			if (Carlist2[playerid][Lock]==0)
			{
			    Carlist2[playerid][Lock]=1;
			    SetVehicleParamsForAll(Carlist2[playerid][Carid],0,1);
			    SetVehicleParamsForPlayer(Carlist2[playerid][Carid],playerid,0,0);
				SendClientMessage(playerid, COLOR_RED, "* Antras automobilis s├źmingai u├żrakintas");
			}
			else
			{
			    Carlist2[playerid][Lock]=0;
			    SetVehicleParamsForAll(Carlist2[playerid][Carid],0,0);
			    SendClientMessage(playerid, COLOR_RED, "* Antras automobilis s├źkmingai atrakintas");
			}
		}
		else { SendClientMessage(playerid, COLOR_GREY, "Tavo antroji ma├░ina sudau├żyta, suremontuok j├á /2remont!"); }
	}
	else { SendClientMessage(playerid, COLOR_GREY, "J├╗s neturite antrojo automobilio!"); }
    return 1;
}*/
/*else if (strcmp("/respraycar", cmd, true, 10) == 0)
{
    if (Carlist2[playerid][Typ2]!=-1)
    {
		if (Carlist2[playerid][Carid]!=-1)
		{
		    ChangeVehicleColor(Carlist2[playerid][Carid],Carlist2[playerid][Color1],Carlist2[playerid][Color2]);
		    SendClientMessage(playerid, COLOR_RED, "You resprayed your car!");
  			}
		else { SendClientMessage(playerid, COLOR_GREY, "Your car is broken. You have to repair it!"); }
	}
	else { SendClientMessage(playerid, COLOR_GREY, "You do not have a car!"); }
    return 1;
}*/
/*else if (strcmp("/repaintcar", cmd, true, 10) == 0)
{
    if (Carlist2[playerid][Typ]!=-1)
    {
		if (Carlist2[playerid][Carid]!=-1)
		{
		    if (Carlist2[playerid][Paintjob]!=-1)
		    {
		    	ChangeVehiclePaintjob(Carlist2[playerid][Carid],Carlist2[playerid][Paintjob]);
       			SendClientMessage(playerid, COLOR_RED, "You repainted your car!");
			}
			else { SendClientMessage(playerid, COLOR_GREY, "Your car does not have a paintjob yet!"); }
  			}
		else { SendClientMessage(playerid, COLOR_GREY, "Your car is broken. You have to repair it!"); }
	}
	else { SendClientMessage(playerid, COLOR_GREY, "You do not have a car!"); }
    return 1;
}*/
else if (strcmp("/2islipti", cmd, true, 10) == 0)
{
    if (Spectating[playerid][0]!=-1)
    {
        TogglePlayerControllable(playerid,1);
        SetVehicleParamsForAll(Buylist[spectating[playerid][0]][Carid],0,0);
        Spectating[playerid][0]=-1;
        RemovePlayerFromVehicle(playerid);
	}
	else { SendClientMessage(playerid, COLOR_GREY, "Tu ne salono automobilyje!"); }
    return 1;
}

else if (strcmp("/2pirkti", cmd, true, 10) == 0)
{
    if (Spectating[playerid][0]!=-1)
    {
        if (Carlist2[playerid][Typ2]==-1)
        {
            new price = Buylist[spectating[playerid][0]][Price];
            if (price <= GetPlayerMoney(playerid))
            {
                new autohaus=Buylist[spectating[playerid][0]][Autohaus];
  	        		GivePlayerMoney(playerid, - price);
  	        		Carlist2[playerid][Typ2]=Spectating[playerid][0]; Carlist2[playerid][X]=Carspawns[autohaus][X]; Carlist2[playerid][Y]=Carspawns[autohaus][Y];
				Carlist2[playerid][Z]=Carspawns[autohaus][Z]; Carlist2[playerid][Rotation]=Carspawns[autohaus][Rotation]; Carlist2[playerid][status]=1; Carlist2[playerid][Lock]=0;
				Carlist2[playerid][Carid]=CreateVehicle(Buylist[spectating[playerid][0]][Modelid],Carlist2[playerid][X],Carlist2[playerid][Y],Carlist2[playerid][Z],Carlist2[playerid][Rotation],-1,-1,-1);
		        SetVehicleParamsForAll(Buylist[spectating[playerid][0]][Carid],0,0);
		        TogglePlayerControllable(playerid,1);
		        Spectating[playerid][0]=-1;
		        RemovePlayerFromVehicle(playerid);
				format(string,128,"{FFFFFF}[ {6EF83C}TRANSPORTO TURGUS {FFFFFF}]: Sveikiname! Jus nusipirkote %s uz %i LT!",Buylist[Carlist2[playerid][Typ2]][Name],price);
				SendClientMessage(playerid, COLOR_RED, string);
                                           SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}[ {6EF83C}TRANSPORTO TURGUS {FFFFFF}]: Pagrindines komandos:/2masina");
                                           SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}[ {6EF83C}TRANSPORTO TURGUS {FFFFFF}]: Jusu transporto priemone pagaminta.Gero kelio!");
                                           SendClientMessage(playerid, COLOR_GREEN, "{FFFFFF}[ {6EF83C}TRANSPORTO TURGUS {FFFFFF}]: Ja rasi parases: /2carmapas!");
			}
               else { format(string, 128, "Automobiliui (Reikia: $%i)!", price); SendClientMessage(playerid, COLOR_LIGHTRED, string); }
		}
		else { SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[ {6EF83C}TRANSPORTO TURGUS {FFFFFF}]: Pirma turi parduoti savo sena automobili ar motocikla! /2cparduoti"); }
    }
    else { SendClientMessage(playerid, COLOR_GREY, "{FFFFFF}[ {6EF83C}TRANSPORTO TURGUS {FFFFFF}]: Turetum buti automobiliu turguje!"); }
    return 1;
}

else if (strcmp("/2cparduoti", cmd, true, 10) == 0)
{
    if (Carlist2[playerid][Typ2]!=-1)
    {
        new price = (Buylist[Carlist2[playerid][Typ2]][Price]/5)*4;
        if (IsPlayerInVehicle(playerid,Carlist2[playerid][Carid])) { RemovePlayerFromVehicle(playerid); }
        GivePlayerMoney(playerid, price);
        DestroyVehicle(Carlist2[playerid][Carid]);
		Carlist2[playerid][Typ2]=-1; Carlist2[playerid][X]=0.0; Carlist2[playerid][Y]=0.0; Carlist2[playerid][Z]=0.0;
		Carlist2[playerid][Rotation]=0.0; Carlist2[playerid][status]=0; Carlist2[playerid][Lock]=0; Carlist2[playerid][Carid]=-1;
		Carlist2[playerid][Color1]=-1; Carlist2[playerid][Color2]=-1; Carlist2[playerid][mod1]=-1; Carlist2[playerid][mod2]=-1;
		Carlist2[playerid][mod3]=-1; Carlist2[playerid][mod4]=-1; Carlist2[playerid][mod5]=-1; Carlist2[playerid][mod6]=-1;
		Carlist2[playerid][mod7]=-1; Carlist2[playerid][mod8]=-1; Carlist2[playerid][mod9]=-1; Carlist2[playerid][mod10]=-1;
		Carlist2[playerid][mod11]=-1; Carlist2[playerid][mod12]=-1; Carlist2[playerid][mod13]=-1; Carlist2[playerid][mod14]=-1;
		Carlist2[playerid][mod15]=-1; Carlist2[playerid][mod16]=-1; Carlist2[playerid][mod17]=-1; Carlist2[playerid][Paintjob]=-1;
		format(string,128,"Pardaviai savo automobili u├ż $%i!",price);
		SendClientMessage(playerid, COLOR_RED, string);
    }
    else { SendClientMessage(playerid, COLOR_GREY, "J├╗s neturite automobilio!"); }
    return 1;
}
#if defined RESETCARS
else if (strcmp("/8resetcars", cmd, true, 10) == 0)
{
	if(CallRemoteFunction("IsAdmin","i",playerid)) { ResetAutohausSpawns(); }
    return 1;
}
#endif
#if defined CARSELL

else if (strcmp("/2siulyti", cmd, true, 8) == 0)
{
       tmp = strtok(cmdtext, idx);
	if (!strlen(tmp))
	{
	    SendClientMessage(playerid, COLOR_GREY, "Parduoti masina /2siulyti [zaidejo nick] [kaina]");
           return 1;
       }
       new sellplayerid;
       tmp = strtok(cmdtext, idx);
	if (!strlen(tmp))
	{
	    SendClientMessage(playerid, COLOR_GREY, "Naudojimas /2siulyti [zaidejo nick] [kaina]");
           return 1;
       }
       new price = strval(tmp);
       if (price<0)
       {
	    SendClientMessage(playerid, COLOR_GREY, "Suma turi buti didesne uz 0.");
           return 1;
       }
    if (Carlist2[playerid][Typ2]==-1)
    {
        SendClientMessage(playerid, COLOR_GREY, "Tu neturi masinos!");
        return 1;
    }
       if (!IsPlayerConnected(sellplayerid))
       {
	    SendClientMessage(playerid, COLOR_GREY, "Zaidejas atsijunges.");
           return 1;
       }
       offerCar[sellplayerid][0]=playerid;
	offerCar[sellplayerid][1]=price;
	new playername[MAX_PLAYER_NAME];
	new sellplayername[MAX_PLAYER_NAME];
	GetPlayerName(playerid,playername,sizeof(playername));
	GetPlayerName(sellplayerid,sellplayername,sizeof(sellplayername));
	format(string,128,"Tu siulai savo masina %s uz $%i!",sellplayername,price);
	SendClientMessage(playerid, COLOR_RED, string);
	SendClientMessage(playerid, COLOR_YELLOW, "Atsaukti pardavima /2atsaukti.");
       format(string,128,"%s si├╗lo %s u├ż $%i.",playername,Buylist[Carlist2[playerid][Typ2]][Name],price);
       SendClientMessage(sellplayerid, COLOR_RED, string);
       SendClientMessage(sellplayerid, COLOR_YELLOW, "Sutikti siulyma /2sutinku.");
    return 1;
}
else if (strcmp("/2atsaukti", cmd, true, 9) == 0)
{
    for (new i=0; i	    {
        if (offerCar[i][0]==playerid)
        {
            offerCar[i]={-1,0};
            SendClientMessage(playerid, COLOR_RED, "* Tu atsaukiai pardavima.");
            if (IsPlayerConnected(i))
            {
				new playername[MAX_PLAYER_NAME];
				GetPlayerName(playerid,playername,sizeof(playername));
                format(string,128,"* %s atsauke pasiulyma.",playername);
                   SendClientMessage(i, COLOR_GREEN, string);
            }
            return 1;
        }
    }
    SendClientMessage(playerid, COLOR_GREY, "Tu nesiulai masinos!");
    return 1;
}
else if (strcmp("/2sutinku", cmd, true, 8) == 0)
{
    if (offerCar[playerid][0]!=-1)
    {
        if (IsPlayerConnected(offerCar[playerid][0]))
        {
            if (Carlist2[playerid][Typ2]==-1)
            {
                if (Carlist2[offerCar[playerid][0]][Typ2]!=-1)
                {
                    if (GetPlayerMoney(playerid)>=offerCar[playerid][1])
                    {
                        new sellerid=offerCar[playerid][0];
                        new price=offerCar[playerid][1];
                        offerCar[playerid]={-1,0};
          	        		GivePlayerMoney(playerid, - price);
          	        		GivePlayerMoney(sellerid, price);
          	        		Carlist2[playerid][Typ2]=Carlist2[sellerid][Typ2];
          	        		Carlist2[playerid][X]=Carlist2[sellerid][X];
          	        		Carlist2[playerid][Y]=Carlist2[sellerid][Y];
				        Carlist2[playerid][Z]=Carlist2[sellerid][Z];
				        Carlist2[playerid][Rotation]=Carlist2[sellerid][Rotation];
				        Carlist2[playerid][status]=Carlist2[sellerid][status];
				        Carlist2[playerid][Lock]=Carlist2[sellerid][Lock];
				        Carlist2[playerid][Carid]=Carlist2[sellerid][Carid];
		                Carlist2[playerid][Color1]=Carlist2[sellerid][Color1];
		                Carlist2[playerid][Color2]=Carlist2[sellerid][Color2];
		                Carlist2[playerid][mod1]=Carlist2[sellerid][mod1];
		                Carlist2[playerid][mod2]=Carlist2[sellerid][mod2];
		                Carlist2[playerid][mod3]=Carlist2[sellerid][mod3];
		                Carlist2[playerid][mod4]=Carlist2[sellerid][mod4];
		                Carlist2[playerid][mod5]=Carlist2[sellerid][mod5];
		                Carlist2[playerid][mod6]=Carlist2[sellerid][mod6];
		                Carlist2[playerid][mod7]=Carlist2[sellerid][mod7];
		                Carlist2[playerid][mod8]=Carlist2[sellerid][mod8];
		                Carlist2[playerid][mod9]=Carlist2[sellerid][mod9];
		                Carlist2[playerid][mod10]=Carlist2[sellerid][mod10];
		                Carlist2[playerid][mod11]=Carlist2[sellerid][mod11];
		                Carlist2[playerid][mod12]=Carlist2[sellerid][mod12];
		                Carlist2[playerid][mod13]=Carlist2[sellerid][mod13];
		                Carlist2[playerid][mod14]=Carlist2[sellerid][mod14];
		                Carlist2[playerid][mod15]=Carlist2[sellerid][mod15];
		                Carlist2[playerid][mod16]=Carlist2[sellerid][mod16];
		                Carlist2[playerid][mod17]=Carlist2[sellerid][mod17];
		                Carlist2[playerid][Paintjob]=Carlist2[sellerid][Paintjob];
		                Carlist2[sellerid][Typ2]=-1; Carlist2[sellerid][X]=0.0; Carlist2[sellerid][Y]=0.0; Carlist2[sellerid][Z]=0.0;
		                Carlist2[sellerid][Rotation]=0.0; Carlist2[sellerid][status]=0; Carlist2[sellerid][Lock]=0; Carlist2[sellerid][Carid]=-1;
		                Carlist2[sellerid][Color1]=-1; Carlist2[sellerid][Color2]=-1; Carlist2[sellerid][mod1]=-1; Carlist2[sellerid][mod2]=-1;
		                Carlist2[sellerid][mod3]=-1; Carlist2[sellerid][mod4]=-1; Carlist2[sellerid][mod5]=-1; Carlist2[sellerid][mod6]=-1;
		                Carlist2[sellerid][mod7]=-1; Carlist2[sellerid][mod8]=-1; Carlist2[sellerid][mod9]=-1; Carlist2[sellerid][mod10]=-1;
		                Carlist2[sellerid][mod11]=-1; Carlist2[sellerid][mod12]=-1; Carlist2[sellerid][mod13]=-1; Carlist2[sellerid][mod14]=-1;
		                Carlist2[sellerid][mod15]=-1; Carlist2[sellerid][mod16]=-1; Carlist2[sellerid][mod17]=-1; Carlist2[sellerid][Paintjob]=-1;
				        if (Carlist2[playerid][status]==1)
				        {
		                    SetVehicleParamsForAll(Carlist2[playerid][Carid],0,Carlist2[playerid][Lock]);
		                    SetVehicleParamsForPlayer(Carlist2[playerid][Carid],playerid,0,0);
		                }
                           format(string,128,"Sveikinu! Tu pardaviai masina %s uz %i!",Buylist[Carlist2[playerid][Typ2]][Name],price);
						SendClientMessage(playerid, COLOR_RED, string);
						SendClientMessage(playerid, COLOR_GREEN, "Tavo masina sudauzita rasik /2remont ,kad sutaisyti ja.");
						SendClientMessage(playerid, COLOR_GREEN, "Masina uzsirakinti/atsirakinti gali su komanda /2raktai.");
						SendClientMessage(playerid, COLOR_GREEN, "Daugiau komandu suzinosi /2masina.");
						SendClientMessage(playerid, COLOR_YELLOW, "Masina jau tavo, gero vaziniejimo");
	 					new playername[MAX_PLAYER_NAME];
						GetPlayerName(playerid,playername,sizeof(playername));
		                format(string,128,"Tu pardaviai savo masina %s uz $%i!",playername, price);
		                SendClientMessage(sellerid, COLOR_RED, string);
                    }
                    else
                    {
                        format(string, 128, "Neuztenka pinigu nusipirkti masinai (reikia: $%i)!", offerCar[playerid][1]);
                        SendClientMessage(playerid, COLOR_GREY, string);
                    }
                   }
                   else
                   {
                       offerCar[playerid]={-1,0};
                       SendClientMessage(playerid, COLOR_GREY, "Pardavejas neturi masinos!.");
                   }
            }
            else
            {
		        SendClientMessage(playerid, COLOR_GREY, "Tu jau turi masina!");
            }
		}
           else
           {
               offerCar[playerid]={-1,0};
               SendClientMessage(playerid, COLOR_GREY, "Pardavejas atsijunges.");
           }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GREY, "Tau nesiuloma jokia masina.");
    }
    return 1;
}
#endif
return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
    new vehicleid = GetPlayerVehicleID(playerid);
	new typ2;
	typ2=IsAutohausCar(vehicleid);
	if(typ2!=-1)
	{
	    new string[128];
	    TogglePlayerControllable(playerid,0);
	    Spectating[playerid][0]=typ2;
	    SetVehicleParamsForAll(vehicleid,0,1);
		SendClientMessage(playerid, COLOR_YELLOW, "~*~ Ma├░inu dyleris ~*~");
		format(string,128,"Pavadinimas: %s",Buylist[typ2][Name]);
		SendClientMessage(playerid, COLOR_YELLOW, string);
		format(string,128,"Kaina: $%i",Buylist[typ2][Price]);
		SendClientMessage(playerid, COLOR_YELLOW, string);
		format(string,128,"Remonto kaina: $%i",Buylist[typ2][Repair]);
		SendClientMessage(playerid, COLOR_YELLOW, string);
	    SendClientMessage(playerid, COLOR_GREEN, "Ma├░ina parduodama, gali nusipirkti para├░es: /2pirkti");
	    SendClientMessage(playerid, COLOR_GREEN, "Jai nori i├░lipti i├░ ma├░inos ra├░yk: /2islipti");
	        SetTimerEx("removcar",5000,0,"i",playerid);
	    SendClientMessage(playerid, COLOR_GREEN, "Apsispresti turesi per 10s.!!");
	}
}
return 1;
}

public OnVehicleMod(playerid,vehicleid,componentid)
{
if (playerid!=GetPlayerFromCarlist2Car(vehicleid)) {return 1;}
if(playerid!=-1)
{
	new mod=GetModType(componentid);
	switch (mod)
	{
	    case 1: { Carlist2[playerid][mod1]=componentid; }
	    case 2: { Carlist2[playerid][mod2]=componentid; }
	    case 3: { Carlist2[playerid][mod3]=componentid; }
	    case 4: { Carlist2[playerid][mod4]=componentid; }
	    case 5: { Carlist2[playerid][mod5]=componentid; }
	    case 6: { Carlist2[playerid][mod6]=componentid; }
	    case 7: { Carlist2[playerid][mod7]=componentid; }
	    case 8: { Carlist2[playerid][mod8]=componentid; }
	    case 9: { Carlist2[playerid][mod9]=componentid; }
	    case 10: { Carlist2[playerid][mod10]=componentid; }
	    case 11: { Carlist2[playerid][mod11]=componentid; }
	    case 12: { Carlist2[playerid][mod12]=componentid; }
	    case 13: { Carlist2[playerid][mod13]=componentid; }
	    case 14: { Carlist2[playerid][mod14]=componentid; }
	    case 15: { Carlist2[playerid][mod15]=componentid; }
	    case 16: { Carlist2[playerid][mod16]=componentid; }
	    case 17: { Carlist2[playerid][mod17]=componentid; }
	    default: { new string[128]; format(string,128,"Unknown component id: %i",componentid); print(string); }
	}
}
return 1;
}

public OnVehiclePaintjob(playerid,vehicleid, paintjobid)
{
if (playerid!=GetPlayerFromCarlist2Car(vehicleid)) {return 1;}
if(playerid!=-1)
{
    Carlist2[playerid][Paintjob]=paintjobid;
}
return 1;
}

public OnVehicleRespray(playerid,vehicleid, color1, color2)
{
if (playerid!=GetPlayerFromCarlist2Car(vehicleid)) {return 1;}
if(playerid!=-1)
{
    Carlist2[playerid][Color1]=color1;
    Carlist2[playerid][Color2]=color2;
}
return 1;
}

public SetVehicleParamsForAll(carid,objective,doorslocked)
{
new i;
for(i=0; i}

public CreateTunedCar(playerid)
{
if(IsPlayerConnected(playerid) && Carlist2[playerid][Typ2]!=-1)
{
    new carid=CreateVehicle(Buylist[Carlist2[playerid][Typ2]][Modelid],Carlist2[playerid][X],Carlist2[playerid][Y],Carlist2[playerid][Z],Carlist2[playerid][Rotation],-1,-1,-1);
    if(Carlist2[playerid][Lock]==1)
    {
        SetVehicleParamsForAll(carid,0,1);
        SetVehicleParamsForPlayer(carid,playerid,0,0);
	}
	if(Carlist2[playerid][mod1]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod1]); }
	if(Carlist2[playerid][mod2]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod2]); }
	if(Carlist2[playerid][mod3]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod3]); }
	if(Carlist2[playerid][mod4]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod4]); }
	if(Carlist2[playerid][mod5]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod5]); }
	if(Carlist2[playerid][mod6]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod6]); }
	if(Carlist2[playerid][mod7]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod7]); }
	if(Carlist2[playerid][mod8]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod8]); }
	if(Carlist2[playerid][mod9]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod9]); }
	if(Carlist2[playerid][mod10]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod10]); }
	if(Carlist2[playerid][mod11]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod11]); }
	if(Carlist2[playerid][mod12]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod12]); }
	if(Carlist2[playerid][mod13]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod13]); }
	if(Carlist2[playerid][mod14]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod14]); }
	if(Carlist2[playerid][mod15]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod15]); }
	if(Carlist2[playerid][mod16]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod16]); }
	if(Carlist2[playerid][mod17]!=-1) { AddVehicleComponent(carid,Carlist2[playerid][mod17]); }
	if(Carlist2[playerid][Paintjob]!=-1) { ChangeVehiclePaintjob(carid,Carlist2[playerid][Paintjob]); }
	if(Carlist2[playerid][Color1]!=-1) { ChangeVehicleColor(carid,Carlist2[playerid][Color1],Carlist2[playerid][Color2]); }
    return carid;
}
return -1;
}

public DelayDestroyCar(playerid)
{
SetVehicleParamsForAll(Carlist2[playerid][Carid],0,0);
DestroyVehicle(Carlist2[playerid][Carid]);
Carlist2[playerid][status]=0;
Carlist2[playerid][Carid]=-1;
return 1;
}
forward CarSaveData(playerid);
public CarSaveData(playerid)
{
print("Irasom masinas");
new playername[MAX_PLAYER_NAME];
new dateiname[MAX_PLAYER_NAME+4];
new var[256];
new vehid = GetPlayerVehicleID(playerid);
   GetPlayerName(playerid, playername, sizeof(playername));
format(dateiname, sizeof(dateiname), "saves/masinos/%s", playername);
new File: CarFile = fopen(dateiname, io_write);
   format(var, 256, "AH_Typ=%i\n", GetVehicleModel(vehid)); fwrite(CarFile, var);
format(var, 256, "AH_Paintjob=%i\n", Carlist2[playerid][Paintjob]); fwrite(CarFile, var);
format(var, 256, "AH_Color1=%i\n", Carlist2[playerid][Color1]); fwrite(CarFile, var);
format(var, 256, "AH_Color2=%i\n", Carlist2[playerid][Color2]); fwrite(CarFile, var);
format(var, 256, "AH_Lock=%i\n", Carlist2[playerid][Lock]); fwrite(CarFile, var);
format(var, 256, "AH_mod1=%i\n", GetVehicleComponentInSlot(vehid, 1)); fwrite(CarFile, var);
format(var, 256, "AH_mod2=%i\n", GetVehicleComponentInSlot(vehid, 2)); fwrite(CarFile, var);
format(var, 256, "AH_mod3=%i\n", GetVehicleComponentInSlot(vehid, 3)); fwrite(CarFile, var);
format(var, 256, "AH_mod4=%i\n", GetVehicleComponentInSlot(vehid, 4)); fwrite(CarFile, var);
format(var, 256, "AH_mod5=%i\n", GetVehicleComponentInSlot(vehid, 5)); fwrite(CarFile, var);
format(var, 256, "AH_mod6=%i\n", GetVehicleComponentInSlot(vehid, 6)); fwrite(CarFile, var);
format(var, 256, "AH_mod7=%i\n", GetVehicleComponentInSlot(vehid, 7)); fwrite(CarFile, var);
format(var, 256, "AH_mod8=%i\n", GetVehicleComponentInSlot(vehid, 8)); fwrite(CarFile, var);
format(var, 256, "AH_mod9=%i\n", GetVehicleComponentInSlot(vehid, 9)); fwrite(CarFile, var);
format(var, 256, "AH_mod10=%i\n", GetVehicleComponentInSlot(vehid, 10)); fwrite(CarFile, var);
format(var, 256, "AH_mod11=%i\n", GetVehicleComponentInSlot(vehid, 11)); fwrite(CarFile, var);
format(var, 256, "AH_mod12=%i\n", GetVehicleComponentInSlot(vehid, 12)); fwrite(CarFile, var);
format(var, 256, "AH_mod13=%i\n", GetVehicleComponentInSlot(vehid, 13)); fwrite(CarFile, var);
format(var, 256, "AH_mod14=%i\n", GetVehicleComponentInSlot(vehid, 14)); fwrite(CarFile, var);
format(var, 256, "AH_mod15=%i\n", GetVehicleComponentInSlot(vehid, 15)); fwrite(CarFile, var);
format(var, 256, "AH_mod16=%i\n", GetVehicleComponentInSlot(vehid, 16)); fwrite(CarFile, var);
format(var, 256, "AH_mod17=%i\n", GetVehicleComponentInSlot(vehid, 17)); fwrite(CarFile, var);
   fclose(CarFile);
   return 1;
}

public DelaySetVehicleParams(playerid)
{
if(!IsPlayerConnected(playerid)) { return 0; }
new i;
for(i=0; i
{
    if(Carlist2[i][Carid]!=-1 && Carlist2[i][Lock]==1) { SetVehicleParamsForPlayer(Carlist2[i][Carid],playerid,0,1); }
    if(Spectating[i][0]!=-1) { SetVehicleParamsForPlayer(Buylist[spectating[i][0]][Carid],playerid,0,1); }
}
return 1;
}

public ResetAutohausSpawns()
{
new i;
for(i=0; i}
forward removcar(playerid);
public removcar(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);

TogglePlayerControllable(playerid,1);
        SetVehicleParamsForAll(Buylist[spectating[playerid][0]][Carid],0,0);
        Spectating[playerid][0]=-1;
        SetVehicleToRespawn(vehicleid);
        RemovePlayerFromVehicle(playerid);
return 1;
}

cia 2masinos filterscript, padekite istaisyt man labai jo reikia:(

Dalintis ┼í─» prane┼íim─ů


Nuoroda iki šio pranešimo
Dalintis per kit─ů puslap─»

Prisijungti prie diskusijos

Palikti atsakym─ů galite i┼í karto, o u┼żsiregistruoti v─Śliau. Jeigu jau turite paskyr─ů m┼źs┼│ forume, Prisijunkite.

Sve─Źias
Atsakyti šioje temoje...

×   ─«klijuotas tekstas turi teksto formatavim─ů.   Pa┼íalinti teksto formatavim─ů

  Galimi tik 75 veidukai.

×   Nuoroda buvo automati┼íkai ─»terpta.   ─«terpti nuorod─ů paprastai

×   J┼źs┼│ ankstesnis prane┼íimas buvo atkurtas.   I┼ívalyti redaktori┼│

×   J┼źs negalite ─»kelti nuotraukas tiesiogiai.─«kelkite arba ─»d─Śkite nuotraukas i┼í URL.


  • ┼áiame puslapyje nar┼ío:   0 nariai

    N─Śra registruot┼│ nari┼│ per┼żi┼źrin─Źi┼│ ┼í─» forum─ů.