raven problem
#1

i have a problem with the car system of ravens , everytime a player buys a car , it replaces another car example armycars anyone knows how to fix this? so all cars go +1 id? or smth?
Reply
#2

How we will fix it , without showing us the code ? , Can you show us the codes
Reply
#3

well .. you have the whole car system , but everytime someone buys a car it replaces an army car somewhy

i have no idea what i have to paste cuz its all through the script i only know its ravens car system , if you buy car an army car dissapears
Reply
#4

You should give us the Code, without that, it will be hard to fix it..
Reply
#5

Quote:

new armycar[15];

public IsNgCar(carid)
{
for(new i = 0; i < sizeof(armycar); i++)
{
if(carid == armycar[i]) return 1;
}
return 0;

// armycar bugged

armycar[0] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[1] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[2] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[3] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[4] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[5] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[6] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[7] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[8] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[9] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[10] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[11] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[12] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[13] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //
armycar[14] = AddStaticVehicleEx(464,-2419.0483,539.7922,29.6728,267.5278,0,0,30000); //

forward IsAnOwnableCar(carid);
new OwnableCarOffer[MAX_PLAYERS];

new OwnableCarID[MAX_PLAYERS];

new OwnableCarPrice[MAX_PLAYERS];

if(IsAnOwnableCar(vehicleid))
{
format(string,sizeof(string)," %s (%d) Owner: %s",vehicle, vehicleid, CarInfo[vehicleid][cOwner]);
SendClientMessage(playerid, COLOR_GREY, string);
}
else if(IsASalesVehicle(vehicleid))
{
CanTurnEngine[playerid] = 9999;
SendClientMessage(playerid, COLOR_CREAM, "You are not allowed to move Dealership car vehicles away.");
SetVehicleToRespawn(GetPlayerVehicleID(playerid));
TextDrawHideForPlayer(playerid, Textdraw53[playerid]);
LinkVehicleToInterior(GetPlayerVehicleID(playerid) , 0);
format(string,sizeof(string)," %s (%d) Owner: Dealership",vehicle, vehicleid);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SetTimer("GateClose", 4000, 0);
format(string,sizeof(string),"Type /v buy to buy this car for $%d",GetVehiclePrice(vehicleid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}

public IsAnOwnableCar(carid)
{
for(new i = 0; i < sizeof(ownedcar); i++)
{
if(carid == ownedcar[i]) return 1;
}
return 0;

if(IsAnOwnableCar(carid))
{
format(comment, sizeof(comment),"* Car id %d code is %d",carid, CarInfo[carid][cCode]);
}
else
{
format(comment, sizeof(comment),"* Car id %d code is %d",carid, VehiclePass[carid]);
}
SendClientMessage(playerid, COLOR_GREY,comment);
return 1;

OwnableCarOffer[playerid] = 999;
OwnableCarID[playerid] = 0;
OwnableCarPrice[playerid] = 0;

if(!IsAnOwnableCar©)
{
EncodeVehicle©;
}
}
}
if(dialogid == 20000)
{
if(response)
{
if(listitem == 0)
{
if(Decoder == 0)
{
new checking;
new carid = GetPlayerVehicleID(playerid);
if(IsAnOwnableCar(carid))
{
checking = CarInfo[carid][cCode];
}
else
{
checking = VehiclePass[carid];
}
if(checking != -1)
{
SetPlayerCriminal(playerid,255,"Stealing a Vehicle");
ShowDecoder(playerid);
Decoding[playerid] = 1;
Digits = GetDigits(checking);
if(PlayerInfo[playerid][pAdminDuty] == 1)
{
ProxDetector(30.0, playerid, "* Admin uses his hacking device and tries to decode the password of the car", COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,CO LOR_CHAT5);
}
if(PlayerInfo[playerid][pMaskuse] == 1 && PlayerInfo[playerid][pAdminDuty] == 0)
{
ProxDetector(30.0, playerid, "* Stranger uses his hacking device and tries to decode the password of the car", COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,CO LOR_CHAT5);
}
if(PlayerInfo[playerid][pAdminDuty] == 0 && PlayerInfo[playerid][pMaskuse] == 0)
{
format(string, sizeof(string), "* %s uses his hacking device and tries to decode the password of the car", sendername);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,CO LOR_CHAT5);
}
DecoderTimer = SetTimerEx("DecodePassword",20,true,"ii",playerid, carid);
SendClientMessage(playerid, COLOR_GREY,"* Decoding Started - REMEMBER: This is purely based on Luck, decoder forcefully checks with random numbers!");
decodecode = 0;
}
else return SendClientMessage(playerid, COLOR_GREY,"* This car is not locked!");
Decoder = 1;
}
else return SendClientMessage(playerid, COLOR_GREY,"* Satelital Decoder is already being Used, please wait!");
}
else if(listitem == 1)
{
SafeRemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
}
}
}
if(dialogid == 1000)
{
if(response)
{
new ownvehkey;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { ownvehkey = PlayerInfo[playerid][pPcarkey3]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey4]) { ownvehkey = PlayerInfo[playerid][pPcarkey4]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey5]) { ownvehkey = PlayerInfo[playerid][pPcarkey5]; }
new carsellprice = GetVehiclePrice(ownvehkey) / 5;
PlayerInfo[playerid][pMats] += carsellprice;
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~You have scratched your car for: ~n~~g~%d materials", carsellprice);
GameTextForPlayer(playerid, string, 10000, 3);

if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey])
PlayerInfo[playerid][pPcarkey] = 9999;
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2])
PlayerInfo[playerid][pPcarkey2] = 9999;
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3])
PlayerInfo[playerid][pPcarkey3] = 9999;
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey4])
PlayerInfo[playerid][pPcarkey4] = 9999;
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey5])
PlayerInfo[playerid][pPcarkey5] = 9999;


SafeRemovePlayerFromVehicle(playerid);
DestroyVehicle(ownvehkey);
TogglePlayerControllable(playerid, 1);
OnPropUpdate(4,ownvehkey);
OnPlayerUpdateEx(playerid);
TogglePlayerDynamicCP(playerid, scratchcarcp, 1);
}
}

if (GetPlayerState(playerid) == 1)
{
return 1;
}
TextDrawHideForPlayer(playerid, Textdraw53[playerid]);
if(IsAnOwnableCar(vehicleid))
{
new Float,Float:y,Float:z;
new Float:a;
GetVehiclePos(vehicleid, x, y, z);
GetVehicleZAngle(vehicleid, a);
CarInfo[vehicleid][cLocationx] = x;
CarInfo[vehicleid][cLocationy] = y;
CarInfo[vehicleid][cLocationz] = z;
CarInfo[vehicleid][cAngle] = a;
OnPropUpdate(4,vehicleid);
}

/* new keycar = PlayerInfo[playerid][pPcarkey];
new vehicle = GetPlayerVehicleID(playerid);
if(IsAnOwnableCar(vehicleid))
{
if(keycar == vehicleid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(vehicleid,i,0,1);
}
GameTextForPlayer(playerid, "~w~Vehicle~n~~r~Auto-Locked", 10000, 3);
CarInfo[keycar][cLock] = 1;

if(!IsAnOwnableCar©)
{
EncodeVehicle©;
}
}

if(IsAnOwnableCar(carid))
{
CarInfo[carid][cLocationx] = x;
CarInfo[carid][cLocationy] = y;
CarInfo[carid][cLocationz] = z;
CarInfo[carid][cAngle] = a;
format(string, sizeof(string), "~n~ You have parked your car in this location. ~n~");
GameTextForPlayer(playerid, "You have parked this car in this position. It will respawn here.", 10000, 3);
OnPropUpdate(4,carid);
OnPlayerUpdateEx(playerid);
DestroyVehicle(carid);
ownedcar[carid] = CreateVehicle(CarInfo[carid][cModel],CarInfo[carid][cLocationx],CarInfo[carid][cLocationy],CarInfo[carid][cLocationz]+1.0,CarInfo[carid][cAngle],CarInfo[carid][cColorOne],CarInfo[carid][cColorTwo],60000);
if(CarInfo[carid][cPaintjob] != 999)
{
ChangeVehiclePaintjob(carid, CarInfo[carid][cPaintjob]);
}
SetVehicleVirtualWorld(carid, CarInfo[carid][cVirWorld]);
SetVehicleModifications(carid);
PutPlayerInVehicle(playerid, carid, 0);
return 1;

SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, "Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
}
else if(PlayerInfo[giveplayerid][pPcarkey2] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
else if(PlayerInfo[giveplayerid][pPcarkey3] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
else if(PlayerInfo[giveplayerid][pPcarkey4] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
else if(PlayerInfo[giveplayerid][pPcarkey5] == 9999)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "HINT: /v sellto [playerid/PartOfName] [price]");
return 1;
}
new price;
price = strval(tmp);
if(price < 1 || price > 1500000)
{
SendClientMessage(playerid, COLOR_GREY, " Price not lower then 1 and not higher then 1500000. ");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* You offerd %s to buy your car for $%d .", giveplayer, price);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Car Owner %s offered you to buy his/her car for $%d (type /accept ownablecar) to buy.", playername, price);
SendClientMessage(giveplayerid, COLOR_WHITE, string);
OwnableCarOffer[giveplayerid] = playerid;
OwnableCarID[giveplayerid] = ownvehkey;
OwnableCarPrice[giveplayerid] = price;
return 1;
}
}
}
}

if(IsAnOwnableCar(result))
{
if(PlayerInfo[playerid][pPcarkey] == result) { }
else if(PlayerInfo[playerid][pPcarkey2] == result) { }
else if(PlayerInfo[playerid][pPcarkey3] == result) { }
else if(PlayerInfo[playerid][pPcarkey4] == result) { }
else if(PlayerInfo[playerid][pPcarkey5] == result) { }
else
{
SendClientMessage(playerid, COLOR_GREY, " Trunk is locked !")

if(!IsAnOwnableCar(idcar))
{
if(VehiclePass[idcar] == 0)
return SendClientMessage(playerid, COLOR_GREY,"* You may not decode this vehicle's password!");
}

ShowPlayerDialog(playerid, 20000, DIALOG_STYLE_LIST,"Select The Option","1\tStart Decoding\n2\tExit The Car","Select","Cancel");
}

}
if(IsAnOwnableCar(carid) && CarInfo[carid][cOwned] == 0)
{
TogglePlayerControllable(playerid, 1);
SafeRemovePlayerFromVehicle(playerid);
}
if(IsPlayerInAnyVehicle(playerid) && !engineOn[GetPlayerVehicleID(playerid)] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
TogglePlayerControllable(playerid, 1);
SafeRemovePlayerFromVehicle(playerid);
}
if(GetPlayerVehicleID(playerid) >= 112 && GetPlayerVehicleID(playerid) <= 130 || GetPlayerVehicleID(playerid) >= 135 && GetPlayerVehicleID(playerid) <= 154)
{
TogglePlayerControllable(playerid, 1);
SafeRemovePlayerFromVehicle(playerid);

all i could find wich seemned usefull
Reply
#6

Thats not the problem, I know his problem. I too have this problem (simular system in my GM). He's basically saying that his GM (and mine too) isn't setting the Vehciles ID to h (h is the #of the .ini file) Every car in the Owned cars should load with their ID to h, but they don't. So what's wrong? Anyone know?

Here is the code in Ravens:
pawn Код:
LoadCar();
    new string2[64];
    for(new h = 1; h < sizeof(CarInfo); h++)
    {
        format(string2, sizeof(string2), "LARP/Vehicles/%d.ini",h);
        if(dini_Exists(string2))
        {
            ownedcar[h] = AddStaticVehicleEx(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],60000);
            if(CarInfo[h][cPaintjob] != 999)
            {
                ChangeVehiclePaintjob(h, CarInfo[h][cPaintjob]);
            }
            SetVehicleVirtualWorld(h, CarInfo[h][cVirWorld]);
            SetVehicleModifications(h);
        }
    }
Note that h is sending the right # because I tried setting the license plate to h and the license plate had the right number.
Reply
#7

I have the same issue, I was about to give up on it and rewrite the whole thing.. Anyone have a solution?
Reply
#8

Yea, does anyone know how to set the vehicleid of multiple vehicles using the variable h? Or have an alternative way to set cars ID's?
Reply
#9

seems noone knows lol
Reply
#10

Raven's Roleplay isn't a script for beginners to use. It is very buggy and also needs updating to a faster command processor, such as 'zCMD'.

What your system does is because of the poorly coded back-end of the vehicle system, when you purchase a vehicle it starts the vehicle ID of player-purchased vehicles at '1'. When you get to around 20 vehicles purchased on your server, it then starts overwriting the placed vehicles in-game.

You will also notice that when you sell a vehicle, all of your vehicles will begin to assign themselves to other owners, displaying other players names when the vehicle actually solely belongs to you, as well as your "/stats" command displaying the wrong vehicle ID's also.

A good way to tackle this problem if you are experienced is to convert the player owned vehicles to a SQL format such as MySQL or MSSQL. But before you even attempt this, you're in for a hell of a lot of work if you do! You'd be a lot better off just using a new, polished up game-mode and starting there!

Regards, Ayumi.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)