SA-MP Forums Archive
Bug with Double Money - 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: Bug with Double Money (/showthread.php?tid=342310)



Bug with Double Money - Yordan_Kronos - 13.05.2012

I have bug with double money..


Example : i have 2000$ .. i leaving .. after that when i join i have 4000$

What the fuck.. Please help me this is big problem.
Sorry for my english.Thanks


Re: Bug with Double Money - kazekene - 13.05.2012

Maybe because on the script you're always adding $2000 instead of setting the cash $2000, copy the login lines here to check it


Re: Bug with Double Money - Yordan_Kronos - 13.05.2012

No, If i have 12 000 they are will be 24 000$


Re: Bug with Double Money - kazekene - 13.05.2012

Post here the login lines, it's maybe because the server gives the player The Money he had before login off, when he already logs with it


Re: Bug with Double Money - Yordan_Kronos - 13.05.2012

Do you have skype ? i will give you mode or i will give you team viewer .. and + rep


Re: Bug with Double Money - Dan. - 13.05.2012

Post "OnPlayerConnect" and "OnPlayerDisconnect" lines here.


Re: Bug with Double Money - Yordan_Kronos - 13.05.2012

Код:
public OnPlayerConnect(playerid)
{
	if(!IsValidName(playerid))
	{
	    SCM(playerid,COLOR_RED,"Вашето име е невалидно,моля влезте с Roleplay име Пример: Ivan_Ivanov");
	}
	new string[128];
	new plname[MAX_PLAYER_NAME];
	GetPlayerName(playerid, plname, sizeof(plname));
	PlayerInfo[playerid][pLevel] = 0;
	PlayerInfo[playerid][pCash] = 0;
	PlayerInfo[playerid][pDriveLic] = 0;
	PlayerInfo[playerid][pVip] = 0;
	PlayerInfo[playerid][pAdmin] = 0;
	PlayerInfo[playerid][pTester] = 0;
	PlayerInfo[playerid][pPos_x] = 0.0;
	PlayerInfo[playerid][pPos_y] = 0.0;
	PlayerInfo[playerid][pPos_z] = 0.0;
	PlayerInfo[playerid][pSpawn] = 0;
	PlayerInfo[playerid][pSex] = 0;
	RefuelTime[playerid] = 0;
	TrackCar[playerid] = 0;
	PlayerInfo[playerid][pAge] = 0;
	PlayerInfo[playerid][pOrigin] = 0;
	PlayerInfo[playerid][pModel] = 23;
	PlayerInfo[playerid][pLocked] = 0;
	PlayerInfo[playerid][pExp] = 0;
	PlayerInfo[playerid][pWarns] = 0;
	PlayerNeedsHelp[playerid] = 0;
	Mobile[playerid] = 255;
	PlayerInfo[playerid][pMuted] = 0;
	PlayerInfo[playerid][pMuteTime] = 0;
	gPlayerTutorialing[playerid] = 0;
	format(string, sizeof(string), "/Users/%s.ini", plname);
	new DialogString[1024];
    format(DialogString, sizeof DialogString, "%s%s%s%s%s%s%s%s", reg1, reg2, reg3, reg4, reg5, reg6, reg7, reg8);
	ShowPlayerDialog(playerid,1234, DIALOG_STYLE_MSGBOX,"Introduction...", DialogString,"Accept","Refuse");
//===================================[MAPICONS]=================================
	SetPlayerMapIcon(playerid, 1, 597.559509, -1249.448608, 18.307994, 52, 1);
	SetPlayerMapIcon(playerid, 2, 529.425354, -1293.921752, 17.242187, 55, 1);
	SetPlayerMapIcon(playerid, 3, 2127.629394, -1151.914794, 23.988607, 55, 1);
	SetPlayerMapIcon(playerid, 4, 1612.057739, -1892.647338, 13.477849, 55, 1);
	SetPlayerMapIcon(playerid, 5, 2102.669677, -1807.184570, 13.494323, 29, 1);
	SetPlayerMapIcon(playerid, 6, 2218.005126, -1168.782226, 25.655542, 31, 1);
	SetPlayerMapIcon(playerid, 7, 2229.195556, -1722.237670, 13.492409, 54, 1);
	SetPlayerMapIcon(playerid, 8, 2176.778076, -1808.995361, 13.314004, 31, 1);
	SetPlayerMapIcon(playerid, 9, 1552.876464, -1675.246948, 15.951610, 30, 1);
	SetPlayerMapIcon(playerid, 10, 1481.554321, -1769.964111, 18.725217, 32, 1);
	SetPlayerMapIcon(playerid, 11, 1931.436523, -1775.963378, 13.387728, 17, 1);
	SetPlayerMapIcon(playerid, 12, 1832.088745, -1842.122924, 13.516613, 17, 1);
	SetPlayerMapIcon(playerid, 13, 1834.615966, -1682.229736, 13.356820, 49, 1);
	SetPlayerMapIcon(playerid, 14, 1804.492553, -1574.485961, 13.355642, 30, 1);
	SetPlayerMapIcon(playerid, 15, 330.078857, -1518.715820, 35.798629, 30, 1);
	SetPlayerMapIcon(playerid, 16, 212.736221, 1903.069580, 18.079984, 30, 1);
	SetPlayerMapIcon(playerid, 17, 1383.189453, 465.504455, 20.192749, 17, 1);
	SetPlayerMapIcon(playerid, 18, 1365.520019, 249.286941, 19.257095, 29, 1);
	SetPlayerMapIcon(playerid, 19, 1315.100585, -899.391479, 39.282302, 17, 1);
	SetPlayerMapIcon(playerid, 20, 2034.685791, -1404.085327, 16.970668, 22, 1);
	SetPlayerMapIcon(playerid, 21, 1412.8313, -1700.3066, 13.5395, 55, 1);
//==============================================================================
	Textdraw98[playerid] = TextDrawCreate(146.000000, 203.000000, " "); // Tutorial
	TextDrawBackgroundColor(Textdraw98[playerid], 255);
	TextDrawUseBox(Textdraw98[playerid] , 1);
	TextDrawFont(Textdraw98[playerid], 1);
	TextDrawBoxColor(Textdraw98[playerid] ,0x00000066);
	TextDrawLetterSize(Textdraw98[playerid], 0.289899, 1.099900);
	TextDrawColor(Textdraw98[playerid], 13107455);
	TextDrawSetOutline(Textdraw98[playerid], 1);
	TextDrawSetProportional(Textdraw98[playerid], 1);
	TextDrawAlignment(Textdraw98[playerid],2);
	GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);
	SetPlayerSkin(playerid, PlayerInfo[playerid][pModel]);
	SetOriginalColor(playerid);
	return 1;
}
Код:
public OnPlayerDisconnect(playerid, reason)
{
	new INI:File = INI_Open(UserPath(playerid));
	new
		Float:x,
	    Float:y,
		Float:z
	;
	INI_SetTag(File,"data");
	GetPlayerPos(playerid,x,y,z);
	PlayerInfo[playerid][pPos_x] = x;
	PlayerInfo[playerid][pPos_y] = y;
	PlayerInfo[playerid][pPos_z] = z;
    INI_WriteFloat(File,"Pos_x",PlayerInfo[playerid][pPos_x]);
    INI_WriteFloat(File,"Pos_y",PlayerInfo[playerid][pPos_y]);
    INI_WriteFloat(File,"Pos_z",PlayerInfo[playerid][pPos_z]);
    INI_WriteInt(File, "Level",PlayerInfo[playerid][pLevel]);
	INI_WriteInt(File, "Money",PlayerInfo[playerid][pCash]);
	INI_WriteInt(File, "Admin",PlayerInfo[playerid][pAdmin]);
	INI_WriteInt(File, "Tester",PlayerInfo[playerid][pTester]);
	INI_WriteInt(File, "Vip",PlayerInfo[playerid][pVip]);
	INI_WriteInt(File, "Spawn",PlayerInfo[playerid][pSpawn]);
	INI_WriteInt(File, "Model",PlayerInfo[playerid][pModel]);
	INI_WriteInt(File, "Locked",PlayerInfo[playerid][pLocked]);
	INI_WriteInt(File, "FirstJoined", PlayerInfo[playerid][pFirstJoined]);
	INI_WriteInt(File, "Sex", PlayerInfo[playerid][pSex]);
	INI_WriteInt(File, "Age", PlayerInfo[playerid][pAge]);
	INI_WriteInt(File, "Origin", PlayerInfo[playerid][pOrigin]);
	INI_WriteInt(File, "Respect", PlayerInfo[playerid][pExp]);
	INI_WriteInt(File, "Warns", PlayerInfo[playerid][pWarns]);
	INI_WriteInt(File, "Selected", PlayerInfo[playerid][pSelected]);
	INI_WriteInt(File, "Continent", PlayerInfo[playerid][pPlace]);
	INI_WriteInt(File, "Muted", PlayerInfo[playerid][pMuted]);
	INI_WriteInt(File, "MuteTime", PlayerInfo[playerid][pMuteTime]);
	INI_WriteInt(File, "Ph", PlayerInfo[playerid][pNumber]);
	INI_WriteInt(File, "DriveLic", PlayerInfo[playerid][pDriveLic]);
    INI_Close(File);
	return 1;
}



Re: Bug with Double Money - kazekene - 13.05.2012

try to add this over
GivePlayerCash(playerid, PlayerInfo[playerid][pCash]);

Код:
	GivePlayerCash(playerid, PlayerInfo[playerid][-pCash]);



Re: Bug with Double Money - Yordan_Kronos - 13.05.2012

Connect or Disconent ?


Re: Bug with Double Money - kazekene - 13.05.2012

On Connect