Money is mutliplying - 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: Money is mutliplying (
/showthread.php?tid=290288)
Money is mutliplying -
manchestera - 15.10.2011
So i think ive messed up here somewhere and ive tried editing GivePlayerMoney to Setplayermoney but it says it in undefined. Here is what i have right now what causes the players money to double everytime they spawn.
Here is on spawn
Код:
public OnPlayerSpawn(playerid)
{
if( PVar[ playerid ][ pLastX ] == 0.0 && PVar[ playerid ][ pLastY ] == 0.0 )
{
new
RPos = random( sizeof ( RandSpawns ) );
SetPlayerPos( playerid, RandSpawns[ RPos ][ 0 ], RandSpawns[ RPos ][ 1 ], RandSpawns[ RPos ][ 2 ] );
}
else SetPlayerPos( playerid, PVar[ playerid ][ pLastX ], PVar[ playerid ][ pLastY ], PVar[ playerid ][ pLastZ ] );
GivePlayerMoney( playerid, PVar[ playerid ][ pMoney ] );
return 1;
}
And dialog for when you log in.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new File[50];
format(File, sizeof(File), PFiles, pName(playerid));
switch(dialogid)
{
case LOGIN:
{
if(response)
{
if(strlen(inputtext) == 0)
{
new
iStr[128];
format(iStr, sizeof(iStr), ""#CBLUE"Welcome back: "#CDGREEN"%s(%d)\n"#CBLUE"Enter your password to login:", pName(playerid), playerid);
return ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT, ""#CBLUE"Login", iStr, "Login", "Leave");
}
if(strcmp(inputtext, dj(File, "Password", 40), true) == 0)
{
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You are now logged in!");
GivePlayerMoney( playerid, PVar[ playerid ][ pMoney ] );
PVar[playerid][pKills] = djInt (File, "Kills");
PVar[playerid][pMoney] = djInt (File, "Money");
PVar[playerid][pDeaths] = djInt (File, "Deaths");
PVar[playerid][pLevel] = djInt (File, "Level");
PVar[playerid][pMuted] = djInt (File, "Muted");
format(PVar[playerid][pMutedReason], 52, "%s", dj(File, "MutedReason"));
PVar[playerid][pLastX] = djFloat (File, "LastX");
PVar[playerid][pLastY] = djFloat (File, "LastY");
PVar[playerid][pLastZ] = djFloat (File, "LastZ");
}
else
{
Re: Money is mutliplying -
SmiT - 15.10.2011
Remove
pawn Код:
GivePlayerMoney( playerid, PVar[ playerid ][ pMoney ] );
from OnPlayerSpawn.
At dialog response:
pawn Код:
SendClientMessage( playerid, COLOR_LIGHTGREEN, #You are now logged in! );
ResetPlayerMoney( playerid );
GivePlayerMoney( playerid, PVar[ playerid ][ pMoney ] );
Re: Money is mutliplying -
Sinner - 15.10.2011
For setplayermoney add:
pawn Код:
forward SetPlayerMoney(playerid, money);
stock SetPlayerMoney(playerid, money) {
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, money);
}
Re: Money is mutliplying -
manchestera - 15.10.2011
I tried Sinner method what worked but thanks both of you.
Re: Money is mutliplying -
Buzzbomb - 15.10.2011
Put This Under OnPlayerConnect
GivePlayerMoney( playerid, PVar[ playerid ][ pMoney ] );