problem cmd crash server
#1

pawn Код:
enum carsinf
{
    vModel,
    Float:pX,
    Float:pY,
    Float:pZ,
    Float:pR,
    cOwner[MAX_PLAYER_NAME],
    cOwned,
}
new CarInfo[MAX_VEHICLES][carsinf];
pawn Код:
COMMAND:car(playerid, params[])
{
    new Float:X, Float:Y, Float:Z, Float:R;
    new car;
    GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, R);
    car = CreateVehicle(411, X, Y, Z, R, 1, 1, 60);
    PutPlayerInVehicle(playerid, car, 0);
    new model = GetVehicleModel(GetPlayerVehicleID(playerid));
    new cid;
    cid = GetPlayerVehicleID(playerid);
    CarInfo[cid][vModel] = model;
    CarInfo[cid][pX] = X;
    CarInfo[cid][pY] = Y;
    CarInfo[cid][pZ] = Z;
    CarInfo[cid][pR] = R;
    new nameo[MAX_PLAYER_NAME];
    GetPlayerName(playerid, nameo, sizeof(nameo));
    CarInfo[cid][cOwner] = nameo;
    CarInfo[cid][cOwned] = 1;
    new file[256];
    format(file, sizeof(file),"Cars/%s.txt",cid);
    if(dini_Exists(file))
    {
        dini_IntSet(file,"Model",CarInfo[cid][vModel]);
        dini_FloatSet(file,"posX",CarInfo[cid][pX]);
        dini_FloatSet(file,"posY",CarInfo[cid][pY]);
        dini_FloatSet(file,"posZ",CarInfo[cid][pZ]);
        dini_FloatSet(file,"posR",CarInfo[cid][pR]);
        dini_IntSet(file,"Owner",CarInfo[cid][cOwner]);
        dini_IntSet(file,"Owned",CarInfo[cid][cOwned]);
    }
    else
    {
        dini_Create(file);
        dini_IntSet(file,"Model",CarInfo[cid][vModel]);
        dini_FloatSet(file,"posX",CarInfo[cid][pX]);
        dini_FloatSet(file,"posY",CarInfo[cid][pY]);
        dini_FloatSet(file,"posZ",CarInfo[cid][pZ]);
        dini_FloatSet(file,"posR",CarInfo[cid][pR]);
        dini_IntSet(file,"Owner",CarInfo[cid][cOwner]);
        dini_IntSet(file,"Owned",CarInfo[cid][cOwned]);
    }
    return 1;
}

when i type this command my server shutdown please help me
Reply
#2

bumb
Reply
#3

A couple of things:

- Are you sure the last entry of an enumeration has a comma (,)?

- I don't see the variable R as defined anywhere, is it define "globally" and is it the correct type?

- Check the actual text file to see what was written if anything and is it correct.

The most annoying and time consuming but 100% way of testing, is to write to a file before the execution of every line of code to a something like a debug.txt file, which identifies the line of code which executes last before your server crashes (or at least identifies what function etc is being called), this will give you an accurate to the line indication, then we just need to find out what you are doing wrong with that line (probably a function call).
Reply
#4

the problem was only %s need to replace it by %d
Reply
#5

Yeah it's usually always something small (using string instead of int eh).
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)