public function crashes server ?
#1

when ever I do OnPropUpdate(); my server crashes , here is the coding for it

pawn Код:
forward OnPropUpdate()
public OnPropUpdate()
{
    new coordsstring[1024];
    new idx;
    format(coordsstring, sizeof(coordsstring), "%d|%s|%s|%s|%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
    DIntInfo[idx][doorOwned],
    DIntInfo[idx][doorOwner],
    DIntInfo[idx][doorUOwner],
    DIntInfo[idx][doorFOwner],
    DIntInfo[idx][doorEntranceX],
    DIntInfo[idx][doorEntranceY],
    DIntInfo[idx][doorEntranceZ],
    DIntInfo[idx][doorEntAngle],
    DIntInfo[idx][doorExitX],
    DIntInfo[idx][doorExitY],
    DIntInfo[idx][doorExitZ],
    DIntInfo[idx][doorExitAngle],
    DIntInfo[idx][doorLevelRequired],
    DIntInfo[idx][doorTill],
    DIntInfo[idx][doorMats],
    DIntInfo[idx][doorPot],
    DIntInfo[idx][doorCrack],
    DIntInfo[idx][doorLocked],
    DIntInfo[idx][doorInterior],
    DIntInfo[idx][doorVirtual],
    DIntInfo[idx][doorBuyPrice],
    DIntInfo[idx][doorType]);
    new File: file2 = fopen("dint.cfg", io_write);
    fwrite(file2, coordsstring);
    fclose(file2);
    return 1;
}
Reply
#2

Bump ?
Reply
#3

The file "dint.cfg" probably does not exist.
Reply
#4

io_write should create the file if it doesn't exist. Might be a problem with file permissions. Trying to write in a file that can't be created and all.

If you have your server folder in your GTA folder (don't know why so many people do that) then it might be a problem with Windows UAC. As far as I know you need to give admin rights to create files in the program files directory.
Reply
#5

The already exist within the scriptfiles folder. Any command that has a OnPropUpdate in it crashes the server... ?
Reply
#6

Are you writing to files in any other functions? Do they work? Have you tried running the server as an administrator if you're using Windows 7?
Reply
#7

Using windows Vista , Im administrator , All other .cfg's write fine in my script without crash it just seems to be this one.
Reply
#8

pawn Код:
CMD:pinfo(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pAdmin] < 4)
        {
            SendClientMessageEx(playerid, COLOR_GRAD2, "   You are not an Admin !");
            return 1;
        }
        new dstring[128];
        for(new i = 0; i < sizeof(DIntInfo); i++)
        {
            if (IsPlayerInRangeOfPoint(playerid,3.0,DIntInfo[i][doorEntranceX], DIntInfo[i][doorEntranceY], DIntInfo[i][doorEntranceZ]))
            {
                format(dstring, sizeof(dstring), "ID: %d, Property Name: %s", i, DIntInfo[i][doorOwner]);
                SendClientMessageEx(playerid, COLOR_GRAD1, dstring);
                format(dstring, sizeof(dstring), "Property Owner: %s", DIntInfo[i][doorFOwner]);
                SendClientMessageEx(playerid, COLOR_GRAD1, dstring);
                format(dstring, sizeof(dstring), "Property Purchase Price: $%d", DIntInfo[i][doorBuyPrice]);
                SendClientMessageEx(playerid, COLOR_GRAD1, dstring);
                format(dstring, sizeof(dstring), "Funds: %s, Type: %d, Owned: %d", DIntInfo[i][doorTill], DIntInfo[i][doorType], DIntInfo[i][doorOwned]);
                SendClientMessageEx(playerid, COLOR_GRAD1, dstring);
                format(dstring, sizeof(dstring), "Interior: %d, Virtual %d, Level: %d", DIntInfo[i][doorInterior], DIntInfo[i][doorVirtual], DIntInfo[i][doorLevelRequired]);
                SendClientMessageEx(playerid, COLOR_GRAD1, dstring);
                format(dstring, sizeof(dstring), "Mats: %d, Pot: %d, Crack: %d", DIntInfo[i][doorMats], DIntInfo[i][doorPot], DIntInfo[i][doorCrack]);
                SendClientMessageEx(playerid, COLOR_GRAD1, dstring);
                format(dstring, sizeof(dstring), "Enter Angle: %f, Exit Angle: %f", DIntInfo[i][doorEntAngle], DIntInfo[i][doorExitAngle]);
                SendClientMessageEx(playerid, COLOR_GRAD1, dstring);
            }
        }
    }
    return 1;
}

Removed the OnPropUpdate . This command still crashes server....
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)