15.10.2011, 08:19
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
And dialog for when you log in.
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;
}
Код:
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
{

