Surname_Name = Peter_Smith PhoneNr = 2895 etc... |
Originally Posted by falor
Hey guys.
I'm actually making my gamemod, but i have a problem. I put the player's info in a scriptfile, but all informations are separated by a coma ( e.g : Peter_Smith,0,0,150536864,9000,0,0,0,0,1,2895 ) How can i change my script to make a better scriptfile like : Quote:
Thanks |
format(filestring,sizeof(filestring),"%s,%d,%d,%d, %d,%d,%d,%d,%d,%d,%d",playername,PlayerInfo[playerid][vowned],PlayerInfo[playerid][vowner],PlayerInfo[playerid][pass],PlayerInfo[playerid][pcash],PlayerInfo[playerid][bank],PlayerInfo[playerid][admin],PlayerInfo[playerid][bowner],PlayerInfo[playerid][bowned],PlayerInfo[playerid][phone],PlayerInfo[playerid][phonenr]); |
stock SavePlayer(playerid) { new fname[256],playername[256],filestring[256]; new File: file; GetPlayerName(playerid, playername, sizeof(playername)); format(fname,sizeof(fname),P_FILE,udb_encode(playe rname)); if(!fexist(fname)) {} else { file = fopen(fname, io_write); if(file) { PlayerInfo[playerid][pcash] = GetPlayerMoney(playerid); format(filestring,sizeof(filestring),"%s,%d,%d,%d, %d,%d,%d,%d,%d,%d,%d",playername,PlayerInfo[playerid][vowned],PlayerInfo[playerid][vowner],PlayerInfo[playerid][pass],PlayerInfo[playerid][pcash],PlayerInfo[playerid][bank],PlayerInfo[playerid][admin],PlayerInfo[playerid][bowner],PlayerInfo[playerid][bowned],PlayerInfo[playerid][phone],PlayerInfo[playerid][phonenr]); fwrite(file,filestring); fclose(file); } } } |
"%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
"PlayerName=%s\nVehicleOwned=%d\nVehicleOwner=%d\nPassword=%d\nCash=%d\nBank=%d\nAdmin Level=%d\nBusinesOwner=%d\nBusinessOwned=%d\nPhone=%d\nPhone Number=%d"
PAWN Code: "%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d"
"PlayerName=%s\nVehicleOwned=%d\nVehicleOwner=%d\nPassword=%d\nCash=%d\nBank=%d\nAdmin Level=%d\nBusinesOwner=%d\nBusinessOwned=%d\nPhone=%d\nPhone Number=%d"
F:\SANAND~1\Server\GAMEMO~1\BUILDI~2.PWN(2718) : error 075: input line too long (after substitutions) F:\SANAND~1\Server\GAMEMO~1\BUILDI~2.PWN(2719) : error 017: undefined symbol "pla" F:\SANAND~1\Server\GAMEMO~1\BUILDI~2.PWN(2720) : error 017: undefined symbol "yerid" F:\SANAND~1\Server\GAMEMO~1\BUILDI~2.PWN(2720) : error 029: invalid expression, assumed zero F:\SANAND~1\Server\GAMEMO~1\BUILDI~2.PWN(2720) : error 029: invalid expression, assumed zero F:\SANAND~1\Server\GAMEMO~1\BUILDI~2.PWN(2720) : fatal error 107: too many error messages on one line
stock SavePlayer(playerid) { new fname[256],playername[256],filestring[256]; new File: file; GetPlayerName(playerid, playername, sizeof(playername)); format(fname,sizeof(fname),P_FILE,udb_encode(playername)); if(!fexist(fname)) {} else { file = fopen(fname, io_write); if(file) { PlayerInfo[playerid][pcash] = GetPlayerMoney(playerid); format(filestring,sizeof(filestring),"PlayerName=%s\nVehicleOwned=%d\nVehicleOwner=%d\nPassword=%d\nCash=%d\nBank=%d\nAdmin Level=%d\nBusinesOwner=%d\nBusinessOwned=%d\nPhone=%d\nPhone Number=%d",playername,PlayerInfo[playerid][vowned],PlayerInfo[playerid][vowner],PlayerInfo[playerid][pass],PlayerInfo[playerid][pcash],PlayerInfo[playerid][bank],PlayerInfo[playerid][admin],PlayerInfo[playerid][bowner],PlayerInfo[playerid][bowned],PlayerInfo[playerid][phone],PlayerInfo[playerid][phonenr],PlayerInfo[playerid][niveau]); fwrite(file,filestring); fclose(file); } }
format(filestring,sizeof(filestring),"PlayerName=%s\n", playername); fwrite(file,filestring);
format(filestring,sizeof(filestring),"VehicleOwned=%d\n", PlayerInfo[playerid][vowned]); fwrite(file,filestring);
format(filestring,sizeof(filestring),"VehicleOwner=%d\n", PlayerInfo[playerid][vowner]); fwrite(file,filestring);
stock CreatePlayer(playerid) { new fname[256],playername[256],filestring[256]; new SplitDiv[99][V_LIMIT]; new File: file; GetPlayerName(playerid, playername, sizeof(playername)); format(fname,sizeof(fname),P_FILE,udb_encode(playername)); file = fopen(fname, io_write); if(file) { format(filestring,sizeof(filestring),"%s,0,0,%d,1",playername,PlayerInfo[playerid][pass],PlayerInfo[playerid][pcash],PlayerInfo[playerid][phone],PlayerInfo[playerid][niveau]); fwrite(file,filestring); fclose(file); } file = fopen(fname, io_read); if (file) { fread(file, filestring); split(filestring, SplitDiv, ','); strmid(PlayerInfo[playerid][name], SplitDiv[0], 0, strlen(SplitDiv[0]), 255); PlayerInfo[playerid][vowned] = strval(SplitDiv[1]); PlayerInfo[playerid][vowner] = strval(SplitDiv[2]); PlayerInfo[playerid][pass] = strval(SplitDiv[3]); PlayerInfo[playerid][pcash] = strval(SplitDiv[4]); PlayerInfo[playerid][bank] = strval(SplitDiv[5]); PlayerInfo[playerid][admin] = strval(SplitDiv[6]); PlayerInfo[playerid][bowner] = strval(SplitDiv[7]); PlayerInfo[playerid][bowned] = strval(SplitDiv[8]); PlayerInfo[playerid][phone] = strval(SplitDiv[9]); PlayerInfo[playerid][phonenr] = strval(SplitDiv[10]); PlayerInfo[playerid][niveau] = strval(SplitDiv[11]); fclose(file); } }