SA-MP Forums Archive
Remove Score Offline? - 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)
+--- Thread: Remove Score Offline? (/showthread.php?tid=516901)



Remove Score Offline? - Blackazur - 02.06.2014

Hello, this removes score offline but how to make that it works online too also both?

Код:
		    new tname[24],givexp,string[256],filestring[79];
			if(sscanf(params, "s[24]i", tname, givexp)) return SendClientMessage(playerid,-1,""chat" Usage: /removexp [playername] [amount]");
			if(givexp < 0) return SendClientMessage(playerid,-1,""chat""COL_RED" XP can't go below 0.");
            format(filestring, sizeof(filestring), "/Users/%s.ini", tname);
            if(!fexist(filestring)) return SendClientMessage(playerid,-1,""chat""COL_RED" That player name doesn't exist in the database!");
            else
            {
            new INI:File = INI_Open(filestring);
            INI_SetTag(File, "data");
            INI_WriteInt(File, "pXP", givexp);
            INI_Close(File);
            format(string, sizeof(string), ""chat""COL_RED" %s %s (%d) has removed %s %d XP",GetAdminName(playerid),PlayerName(playerid),playerid,tname,givexp);
			SendClientMessageToAll(-1,string);
	return 1;



Re: Remove Score Offline? - Parallex - 02.06.2014

Using the SetPlayerScore function, like this:
pawn Код:
SetPlayerScore(playerid, GetPlayerScore(playerid) - SCORE HERE);
Use SSCANF, to make playerid into ID and also the score.