SA-MP Forums Archive
Need help with this code! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with this code! (/showthread.php?tid=115470)



Need help with this code! - sean5874 - 24.12.2009

Hello,
Today i have made a jobsystem that save the players job after relog. The system save your job, but after relog it don't load the job. I don't now whats the problem. Here you have a little piece of my login-script that (if everything works correctly ) will load your job:
Код:
logged[playerid] = 1;
          money[playerid] = dini_Int(udb_encode(playername), "money");
          adminlevel[playerid] = dini_Int(udb_encode(playername), "adminlevel");
          job[playerid] = dini_Int(udb_encode(playername), "job");
          format(string, sizeof(string), "%s, je bent nu ingelogd. Je hebt adminlevel %d en je hebt %d dollar", playername, adminlevel[playerid], money[playerid]);
          SendClientMessage(playerid, COLOR_GREEN, string);
          GivePlayerMoney(playerid, money[playerid]);
					SetPlayerTeam(playerid, job[playerid]);

        }
      }
Have I made a mistake in this section?

Happy Christmas!
sean5874

PS: The script that save the jobs and the script that load the job are not the same!



Re: Need help with this code! - MadeMan - 24.12.2009

Can you also show the script that saves it?


Re: Need help with this code! - Calon - 24.12.2009

Just to verify, because you're using dini, what function are you using to SAVE it? dini_IntSet(params)?




Re: Need help with this code! - sean5874 - 24.12.2009

@Mademan:

Here you have the script:
Код:
if(strcmp(cmdtext, "/jobTaxi", true) == 0) {
     new pname[MAX_PLAYER_NAME];
     GetPlayerName(playerid, pname, sizeof (pname));
     format(string3, sizeof(string3), " %s is now working an taxi driver.", pname);
     SendClientMessageToAll(COLOR_GREEN, string3); //
     SetPlayerCheckpoint(playerid, 1729.9542,-1852.2616,13.5064, 4);
     SendClientMessage(playerid, TEAM_TAXI_COLOR,"Follow the marker and pick up your taxi");
     GameTextForAll(string3 ,3000,5);
     dini_IntSet(pname, "Job", 2); //the save-section
     gTeam[playerid] = TEAM_TAXI;
@Calon

yes, I use dini_Inset with a param that gets the players name.


Re: Need help with this code! - MadeMan - 25.12.2009

How do you know it doesn't work?


Re: Need help with this code! - Calon - 30.12.2009

pawn Код:
dini_IntSet(udb_encode(playername), "Job", 2);