What's wrong here?
#1

Hey,what's wrong here?

Код:
#define CONVERTING 1000

CMD:convert( playerid, params[ ] )
{
 	ShowPlayerDialog(playerid, CONVERTING, DIALOG_STYLE_LIST, "Converting Money,Coins,Score.",""COLOR_LIGHTBLUE"1000000$ {FFFFFF}-> {5D66CC}100 Coins\n"COLOR_LIGHTBLUE"1000000$ {FFFFFF}-> {5D66CC}1 Score\n"COLOR_LIGHTBLUE"100 Coins {FFFFFF}-> {5D66CC}1000000$\n"COLOR_LIGHTBLUE"100 Coins {FFFFFF}-> {5D66CC}1 Score\n"COLOR_LIGHTBLUE"1 Score {FFFFFF}-> {5D66CC}1000000$\n"COLOR_LIGHTBLUE"1 Score {FFFFFF}-> {5D66CC}100 Coins","Convert","Cancel");
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  	if(dialogid == CONVERTING)
	{
		if(response)
		{
			if(listitem == 0)
			{
				if ( GetPVarInt( playerid, "Money" ) < 1000000 )
				    return SendClientMessage( playerid, -1, "You need 1000000$ to get 100 Coins!");
				    
				SetPVarInt(playerid, "Coins", GetPVarInt(playerid,"Coins") + 100);
				GivePlayerMoney(playerid, -1000000);
				SCM(playerid,COLOR_DGREY,"You got 100 Coins for 1000000$.");
			}
			if(listitem == 1)
			{
				if ( GetPVarInt( playerid, "Money" ) < 1000000 )
				    return SendClientMessage( playerid, -1, "You need 1000000$ to get 1 Score!");
				    
				SetPlayerScore(playerid,GetPlayerScore(playerid) +1);
				GivePlayerMoney(playerid, -1000000);
				SCM(playerid,COLOR_DGREY,"You got 1 Score for 1000000$.");
			}
			if(listitem == 2)
			{
				if ( GetPVarInt( playerid, "Coins" ) < 100 )
				    return SendClientMessage( playerid, -1, "You need 100 Coins to get 1000000$!");
				    
				GivePlayerMoney(playerid, 1000000);
				SetPVarInt(playerid, "Coins", GetPVarInt(playerid,"Coins") - 100);
				SCM(playerid,COLOR_DGREY,"You got 1000000$ for 100 Coins.");
			}
			if(listitem == 3)
			{
				if ( GetPVarInt( playerid, "Coins" ) < 100 )
				    return SendClientMessage( playerid, -1, "You need 100 Coins to get 1 Score!");

				SetPlayerScore(playerid,GetPlayerScore(playerid) +1);
				SetPVarInt(playerid, "Coins", GetPVarInt(playerid,"Coins") - 100);
				SCM(playerid,COLOR_DGREY,"You got 1 Score for 100 Coins.");
			}
			if(listitem == 4)
			{
				if ( GetPVarInt( playerid, "Score" ) < 2 )
				    return SendClientMessage( playerid, -1, "You need minimum 2 Score to get 1000000$!");

				GivePlayerMoney(playerid, 1000000);
				SetPlayerScore(playerid,GetPlayerScore(playerid) -1);
				SCM(playerid,COLOR_DGREY,"You got 1000000$ for 1 Score.");
			}
			if(listitem == 5)
			{
				if ( GetPVarInt( playerid, "Score" ) < 2 )
				    return SendClientMessage( playerid, -1, "You need minimum 2 Score to get 100 Coins!");

				SetPVarInt(playerid, "Coins", GetPVarInt(playerid,"Coins") + 100);
				SetPlayerScore(playerid,GetPlayerScore(playerid) -1);
				SCM(playerid,COLOR_DGREY,"You got 100 Coins for 1 Score.");
			}
		}
		else
		{
		SCM(playerid,COLOR_DGREY,"You closed.");
		}
	}
	return 1;
}
When I try to convert score to money,score to coins,money to coins,money to score,I get that "return" message: You need minimum 2 Score to convert / You dont have 1000000$ to convert...

What's wrong? When I try to convert Coins to money,coins to score,I dont get the message anymore.
P.S.:Ingame,I have enough money/coins/score
Reply
#2

are you sure you have assigned the value that your score is to the PVar "Score"?
Othervise you could test using this:

pawn Код:
if ( GetPVarInt( playerid, "Score" ) < 2 )//this is your current code, test using
if(GetPlayerScore(playerid) < 2)//test using this and see if you get the same problem, then it's somthing that is badly wrong, othervise you have just forgot to assign the PVar the value of the players score
Hope that helped you somthing
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)