Wierd Problem with changing values - 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: Wierd Problem with changing values (
/showthread.php?tid=168581)
Wierd Problem with changing values -
Blt950 - 16.08.2010
>>> Before you read and start saying this is a GF script, please don't. The script is inspired by the Godfather saving/storing systems, which looks pretty same as in the GF in my script. So: It's not a GF script (!) <<<
Hey there, I got this weird problem.
I made a function that bans people named
BanX(playerid, by(who you got banned by), reason, bool: silent)
The function looks as following:
pawn Код:
public BanX(playerid, by[], reason[], bool:silent)
{
if(IsPlayerConnected(playerid))
{
new string[256];
new sendername[MAX_PLAYERS];
GetPlayerName(playerid, sendername, sizeof(sendername));
if(strcmp(by, "nill", true) == 0)
{
format(string, sizeof(string), "AdmCmd: %s was banned [Reason: %s]", sendername, reason);
}
else
{
format(string, sizeof(string), "AdmCmd: %s was banned by %s [Reason: %s]", sendername, by, reason);
}
if(!silent) { OOCNews(COLOR_LIGHTRED, string); }
PlayerInfo[playerid][pBans] += 1;
PlayerInfo[playerid][pBanned] = 1;
OnPlayerUpdate(playerid);
printf(string);
BanLog(string);
Ban(playerid);
}
}
Example of use:
pawn Код:
BanX(i, "ANTI-CHEAT", "Weapon Hack", false);
The two lines here
PlayerInfo[playerid][pBans] += 1;
PlayerInfo[playerid][pBanned] = 1;
Does not work, or apply. The playerid's file doesnt get the values saved.
I have checked the code that saves/loads the values, it's nothing wrong there. It's all correct. And should work.
So to double check that that it really didn't work I made a command like
/testban that just applied those two lines I showed to you.
When I ran the command in game, the values saved and stored. So now is the question, what is wrong? Why doesn't those values do the same as in
/testban at the
BanX() function ?
Do you have any ideas?