Server crashing because of /ffix
#1

Код:
if(strcmp(cmdtext, "/ffix", true) == 0)
  {
	  if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	  {
			new curveh;
			new newveh;
			new Float:X,Float:Y,Float:Z;
			new Float:ang;
			new angle;
			new color1;
			new color2;
			curveh = GetPlayerVehicleID(playerid);
			GetPlayerPos(playerid,X,Y,Z);
			ang = GetVehicleZAngle(curveh,ang);
			GetVehicleColors(curveh,color1,color2);
			newveh = CreateVehicle(curveh,X,Y,Z,angle,color1,color2,60000);
			RemovePlayerFromVehicle(playerid);
			DestroyVehicle(curveh);
			SetVehicleZAngle(curveh,ang);
			PutPlayerInVehicle(playerid,newveh,0);
			GameTextForPlayer(playerid, "~p~Sutaisyta",5000,5);
		}
		else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
		{
			GameTextForPlayer(playerid, "Turi buti masinoi",5000,5);
			return 0;
		}
		else if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
		{
			GameTextForPlayer(playerid, "Turi buti vairuotojas",5000,5);
			return 0;
		}
		return 1;
	}
This code crashes the server, i want it to fix the car fully.
Reply
#2

I suppose this is the problem:
pawn Код:
DestroyVehicle(curveh);
            SetVehicleZAngle(curveh,ang);
Reply
#3

Quote:
Originally Posted by MenaceX^
I suppose this is the problem:
pawn Код:
DestroyVehicle(curveh);
            SetVehicleZAngle(curveh,ang);

Oww, thanks for the quick reply, didn't see that there :P
Reply
#4

Didn't work, same crashing.
Reply
#5

Bump
Reply
#6

if(strcmp(cmdtext, "/ffix", true) == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
new curveh;
new newveh;
new Float:X,Float:Y,Float:Z;
new Float:ang;
new angle;
new color1;
new color2;
curveh = GetPlayerVehicleID(playerid);
GetPlayerPos(playerid,X,Y,Z);
ang = GetVehicleZAngle(curveh,ang);
GetVehicleColors(curveh,color1,color2);
RemovePlayerFromVehicle(playerid);
DestroyVehicle(curveh);
newveh = CreateVehicle(curveh,X,Y,Z,angle,color1,color2,600 00);
SetVehicleZAngle(curveh,ang);
PutPlayerInVehicle(playerid,newveh,0);
GameTextForPlayer(playerid, "~p~Sutaisyta",5000,5);
}
else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
{
GameTextForPlayer(playerid, "Turi buti masinoi",5000,5);
return 0;
}
else if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
GameTextForPlayer(playerid, "Turi buti vairuotojas",5000,5);
return 0;
}
return 1;
}

if you swap those bits around does it still crash?
Reply
#7

yeah,there were problems that i created CURVEH not a newveh, but i replaced that and still get a crash
Reply
#8

pawn Код:
if(strcmp(cmdtext, "/ffix", true) == 0)
{
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new curveh, newveh, model, Float:p[4], color1, color2;
        curveh = GetPlayerVehicleID(playerid);
        GetVehiclePos(curveh,p[0],p[1],p[2]);
        GetVehicleZAngle(curveh,p[3]);
        GetVehicleColors(curveh,color1,color2); // there are no GetVehicleColors function :X
        model = GetVehicleModel(curveh);
        DestroyVehicle(curveh);
        newveh = CreateVehicle(model,p[0],p[1],p[2],p[3],color1,color2,60000);
        PutPlayerInVehicle(playerid,newveh,0);
        GameTextForPlayer(playerid, "~p~Sutaisyta",5000,5);
    }
    else if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT) return GameTextForPlayer(playerid, "Turi buti masinoi",5000,5);
    else if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return GameTextForPlayer(playerid, "Turi buti vairuotojas",5000,5);
    return 1;
}
Enjoy
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)