Bug or something else
#1

Greetings to all sa-mp.com visitors! I have very annoying bug in my public server since september. I can't improve it and I don't know what I need to do, I trying everything and testing some functions. Problem is in owned vehicles, they doesn't creates smetimes or crates in position 0.0. But I make function to create car ingame near me to check function CreateVehicle and explain something about this bug... There is my simple function:


Код:
COMMAND:car(playerid,params[])
{
	new model, carc1, carc2;
	new Float:x, Float:y, Float:z,veh;
	if(sscanf(params, "iii", model, carc1, carc2)) return SendClientMessage(playerid, RAUDONA, "/car [model_id] [color1] [color2]");
	GetPlayerPos(playerid, x, y, z);
	veh = CreateVehicle(model, x, y+5, z+2, 0, carc1, carc2, 400);
	TrDegalai[veh] = 8.0;
	SendClientMessage(playerid, BALTA, "Car created!");
	return 1;
}
Then I use this function in server about 5 minutes after server start vehicles always creates, but after some time (about 20hours) vehcles in server won't create. I mean in my public server where players are always playing. At this time in server are about 400 vehicles and my define Max_Vehicles is 1000, but with this command /car often vehicles don't create, but sometimes it creates. And I don't know why vehicles doesn't appear in my server after some time...
Reply
#2

Vehicles will respawn after ... seconds/minutes, i dont know how to turn this off, i'm looking for this too.

Ontopic: I'm looking also for a /car command
Reply
#3

You should try using player vehicles instead, so assign them to a playerid.

pawn Код:
new veh[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    veh[playerid] = -1;
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    if(veh[playerid] != -1)
    {
        DestroyVehicle(veh[playerid]);
    }
    return 1;
}

COMMAND:car(playerid,params[])
{
    new model, carc1, carc2;
    new Float:x, Float:y, Float:z;
    if(sscanf(params, "iii", model, carc1, carc2)) return SendClientMessage(playerid, RAUDONA, "/car [model_id] [color1] [color2]");
    GetPlayerPos(playerid, x, y, z);
    if(veh[playerid] != -1)
    {
        DestroyVehicle(veh[playerid]);
    }
    veh[playerid] = CreateVehicle(model, x, y+5, z+2, 0, spalva1, spalva2, 400);
    TrDegalai[veh[playerid]] = 8.0;
    SendClientMessage(playerid, BALTA, "Car created!");
    return 1;
}
EDIT: At the end of CreateVehicle, there is a respawn delay parameter, you just need to set this to -1 to prevent it from respawning.
https://sampwiki.blast.hk/wiki/CreateVehicle
Reply
#4

It can't help me. Because it doesn't matter whick array I will use, however vehicles won't create... I am waiting for another answers :S
Reply
#5

Do you want to give it a try or what...?
Reply
#6

Because problem not in array... Problem somewhere else... I know it.
Reply
#7

Can problem be in car limit? Can I reach some car limit and then vehicles gets buged?
Reply
#8

I'm thinking about an out of bounds error here:
pawn Код:
TrDegalai[veh] = 8.0;
I am not sure how vehicleids are assigned, but if it just keeps adding 1 to the last id instead of using the first viable id then I suspect this will get out of bounds very quickly. I suggest installing crashdetect to see if it indeed is an OOB error.
Reply
#9

I have installed crashdetect plugin very long time. It don't showing me any errors. I think problem somewhere else
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)