09.03.2014, 18:43
Guys, i have a problem, i need to restart the server to make function work. I buy vehicle, and i want to park, it says that i am not i my vehicle. When i restart server, and try again, it works? What i have to do??
Also, when i buy vehicle, and want to enter, for Owner (in SCM) nothing to show, when i restart server, it show the Owner... Please, i ened help, i am making script from 0...
Also, when i buy vehicle, and want to enter, for Owner (in SCM) nothing to show, when i restart server, it show the Owner... Please, i ened help, i am making script from 0...
PHP код:
YCMD:kupivozilo(playerid, params[], help)
{
#pragma unused help
new sendername[32];
GetPlayerName(playerid, sendername, sizeof(sendername));
new vID = GetPlayerVehicleID(playerid);
new vMDL = GetVehicleModel(vID);
new vehicle = 1;
if(!IsASalesVehicle(vID)) return SCM(playerid, -1, ""CRVENA"GoMilano"BELA": Ovo vozilo nije na prodaju.");
if(PlayerInfo[playerid][pVehicle1] != 999 && PlayerInfo[playerid][pVehicle2] != 999 && PlayerInfo[playerid][pVehicle3] != 999) return SCM(playerid, -1, ""CRVENA"GoMilano"BELA": Ne mozete kupiti vise vozila.");
if(GetPlayerMoney(playerid) < GetVehiclePrice(vID)) return SCM(playerid, -1, ""CRVENA"GoMilano"BELA": Nemate dovoljno novca da bi kupili ovo vozilo.");
/*for(new i = 0 ; i < sizeof(VehicleInfo); i++)
{
if(!fexist(CarPath(i)))
vehicle = i;
break;
}*/
for(new v = 1; v < sizeof(VehicleInfo); v++)
{
if(VehicleInfo[v][vOwned] == 0)
{
vehicle = v;
break;
}
}
if(PlayerInfo[playerid][pVehicle1] == 999)
{
PlayerInfo[playerid][pVehicle1] = vMDL;
PlayerInfo[playerid][pVehicle1ControlID] = vehicle;
}
else if(PlayerInfo[playerid][pVehicle2] == 999)
{
PlayerInfo[playerid][pVehicle2] = vMDL;
PlayerInfo[playerid][pVehicle2ControlID] = vehicle;
}
else if(PlayerInfo[playerid][pVehicle3] == 999)
{
PlayerInfo[playerid][pVehicle3] = vMDL;
PlayerInfo[playerid][pVehicle3ControlID] = vehicle;
}
else { return 1;}
new model[64];
GetVehicleName(vMDL, model, sizeof(model));
VehicleInfo[vehicle][vOwned] = 1;
strmid(VehicleInfo[vehicle][vOwner], sendername, 0, strlen(sendername), 999);
VehicleInfo[vehicle][vModel] = vMDL;
VehicleInfo[vehicle][vParkX] = 1590.3740;
VehicleInfo[vehicle][vParkY] = -1026.0565;
VehicleInfo[vehicle][vParkZ] = 30.9063;
VehicleInfo[vehicle][vParkA] = 317.1649;
VehicleInfo[vehicle][vColor1] = 1;
VehicleInfo[vehicle][vColor2] = 1;
VehicleInfo[vehicle][vLocked] = 1;
VehicleInfo[vehicle][vRegistration] = 0;
VehicleInfo[vehicle][vControlID] = vehicle;
OwnedVehicle[vehicle] = CreateVehicle(vMDL, VehicleInfo[vehicle][vParkX], VehicleInfo[vehicle][vParkY], VehicleInfo[vehicle][vParkZ], VehicleInfo[vehicle][vParkA], VehicleInfo[vehicle][vColor1], VehicleInfo[vehicle][vColor2], -1);
SCM(playerid, -1, ""CRVENA"GoMilano"BELA": Kupili ste vozilo. Idite na parking kod banke i preuzmite ga.");
GivePlayerMoney(playerid, -GetVehiclePrice(vID));
SaveVehicle(vehicle);
SavePlayer(playerid);
return 1;
}
YCMD:prodajvozilo(playerid, params[], help)
{
#pragma unused help
new sendername[32], slot, vID;
GetPlayerName(playerid, sendername, sizeof(sendername));
vID = GetPlayerVehicleID(playerid);
if(sscanf(params, "i", slot)) return SCM(playerid, -1, ""CRVENA"KORISCENJE"BELA": /prodajvozilo [slot]");
switch(slot)
{
case 1:
{
if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vozilu.");
if(PlayerInfo[playerid][pVehicle1] == 999) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Nemate vozilo na prvom slotu.");
if(VehicleInfo[vID][vControlID] != PlayerInfo[playerid][pVehicle1ControlID]) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vasem vozilu.");
PlayerInfo[playerid][pVehicle1] = 999;
PlayerInfo[playerid][pVehicle1ControlID] = 999;
VehicleInfo[vID][vOwned] = 0;
VehicleInfo[vID][vOwner] = 0;
VehicleInfo[vID][vParkX] = 1590.3740;
VehicleInfo[vID][vParkY] = -1026.0565;
VehicleInfo[vID][vParkZ] = 23.9063;
VehicleInfo[vID][vParkA] = 317.1649;
VehicleInfo[vID][vLocked] = 0;
VehicleInfo[vID][vRegistration] = 0;
SaveVehicle(vID);
RemovePlayerFromVehicle(playerid);
DestroyVehicle(vID);
TogglePlayerControllable(playerid, 1);
SavePlayer(playerid);
}
case 2:
{
if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vozilu.");
if(PlayerInfo[playerid][pVehicle2] == 999) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Nemate vozilo na drugom slotu.");
if(VehicleInfo[vID][vControlID] != PlayerInfo[playerid][pVehicle2ControlID]) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vasem vozilu.");
PlayerInfo[playerid][pVehicle2] = 999;
PlayerInfo[playerid][pVehicle2ControlID] = 999;
VehicleInfo[vID][vOwned] = 0;
VehicleInfo[vID][vOwner] = 0;
VehicleInfo[vID][vParkX] = 1590.3740;
VehicleInfo[vID][vParkY] = -1026.0565;
VehicleInfo[vID][vParkZ] = 23.9063;
VehicleInfo[vID][vParkA] = 317.1649;
VehicleInfo[vID][vLocked] = 0;
SaveVehicle(vID);
RemovePlayerFromVehicle(playerid);
DestroyVehicle(vID);
TogglePlayerControllable(playerid, 1);
SavePlayer(playerid);
}
case 3:
{
if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vozilu.");
if(PlayerInfo[playerid][pVehicle3] == 999) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Nemate vozilo na trecem slotu.");
if(VehicleInfo[vID][vControlID] != PlayerInfo[playerid][pVehicle3ControlID]) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vasem vozilu.");
PlayerInfo[playerid][pVehicle3] = 999;
PlayerInfo[playerid][pVehicle3ControlID] = 999;
VehicleInfo[vID][vOwned] = 0;
VehicleInfo[vID][vOwner] = 0;
VehicleInfo[vID][vParkX] = 1590.3740;
VehicleInfo[vID][vParkY] = -1026.0565;
VehicleInfo[vID][vParkZ] = 23.9063;
VehicleInfo[vID][vParkA] = 317.1649;
VehicleInfo[vID][vLocked] = 0;
SaveVehicle(vID);
RemovePlayerFromVehicle(playerid);
DestroyVehicle(vID);
TogglePlayerControllable(playerid, 1);
SavePlayer(playerid);
}
}
SavePlayer(playerid);
return 1;
}
YCMD:park(playerid, params[], help)
{
#pragma unused help
new sendername[32], slot, vID, vMDL, Float:X, Float:Y, Float:Z;
GetPlayerName(playerid, sendername, sizeof(sendername));
vID = GetPlayerVehicleID(playerid);
vMDL = GetVehicleModel(vID);
if(sscanf(params, "i", slot)) return SCM(playerid, -1, ""CRVENA"KORISCENJE"BELA": /park [slot]");
if(PlayerInfo[playerid][pVehicle1] == 999 && PlayerInfo[playerid][pVehicle2] == 999 && PlayerInfo[playerid][pVehicle3] == 999) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Nemate vozilo.");
switch(slot)
{
case 1:
{
if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vozilu.");
if(PlayerInfo[playerid][pVehicle1] == 999) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Nemate vozilo na prvom slotu.");
if(VehicleInfo[vID][vControlID] != PlayerInfo[playerid][pVehicle1ControlID]) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vasem vozilu.");
GetVehiclePos(vID, X, Y, Z);
VehicleInfo[vID][vParkX] = X;
VehicleInfo[vID][vParkY] = Y;
VehicleInfo[vID][vParkZ] = Z;
RemovePlayerFromVehicle(playerid);
DestroyVehicle(vID);
OwnedVehicle[vID] = CreateVehicle(vMDL, VehicleInfo[vID][vParkX], VehicleInfo[vID][vParkY], VehicleInfo[vID][vParkZ], VehicleInfo[vID][vParkA], VehicleInfo[vID][vColor1], VehicleInfo[vID][vColor2], -1);
TogglePlayerControllable(playerid, 1);
SCM(playerid, -1, ""NARANDZASTA"Parkirali ste vase vozilo.");
}
case 2:
{
if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vozilu.");
if(PlayerInfo[playerid][pVehicle2] == 999) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Nemate vozilo na drugom slotu.");
if(VehicleInfo[vID][vControlID] != PlayerInfo[playerid][pVehicle2ControlID]) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vasem vozilu.");
GetVehiclePos(vID, X, Y, Z);
VehicleInfo[vID][vParkX] = X;
VehicleInfo[vID][vParkY] = Y;
VehicleInfo[vID][vParkZ] = Z;
RemovePlayerFromVehicle(playerid);
DestroyVehicle(vID);
OwnedVehicle[vID] = CreateVehicle(vMDL, VehicleInfo[vID][vParkX], VehicleInfo[vID][vParkY], VehicleInfo[vID][vParkZ], VehicleInfo[vID][vParkA], VehicleInfo[vID][vColor1], VehicleInfo[vID][vColor2], -1);
TogglePlayerControllable(playerid, 1);
SCM(playerid, -1, ""NARANDZASTA"Parkirali ste vase vozilo.");
}
case 3:
{
if(!IsPlayerInAnyVehicle(playerid)) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vozilu.");
if(PlayerInfo[playerid][pVehicle3] == 999) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Nemate vozilo na trecem slotu.");
if(VehicleInfo[vID][vControlID] != PlayerInfo[playerid][pVehicle3ControlID]) return SCM(playerid, -1, ""CRVENA"GRESKA"BELA": Niste u vasem vozilu.");
GetVehiclePos(vID, X, Y, Z);
VehicleInfo[vID][vParkX] = X;
VehicleInfo[vID][vParkY] = Y;
VehicleInfo[vID][vParkZ] = Z;
RemovePlayerFromVehicle(playerid);
DestroyVehicle(vID);
OwnedVehicle[vID] = CreateVehicle(vMDL, VehicleInfo[vID][vParkX], VehicleInfo[vID][vParkY], VehicleInfo[vID][vParkZ], VehicleInfo[vID][vParkA], VehicleInfo[vID][vColor1], VehicleInfo[vID][vColor2], -1);
TogglePlayerControllable(playerid, 1);
SCM(playerid, -1, ""NARANDZASTA"Parkirali ste vase vozilo.");
}
}
return 1;
}