SA-MP Forums Archive
Bug or something else - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Bug or something else (/showthread.php?tid=403598)



Bug or something else - Vvolk - 30.12.2012

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...



Re: Bug or something else - Jimmy0wns - 30.12.2012

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


Re: Bug or something else - Threshold - 30.12.2012

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


Re: Bug or something else - Vvolk - 30.12.2012

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


Re: Bug or something else - Threshold - 30.12.2012

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


Re: Bug or something else - Vvolk - 30.12.2012

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


Re: Bug or something else - Vvolk - 01.01.2013

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


Re: Bug or something else - Vince - 01.01.2013

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.


Re: Bug or something else - Vvolk - 01.01.2013

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