Help with edit (rep+)
#1

PHP код:
stock BuyHouse(playeridhouseid)
{
  new 
string2[256];
  new 
name[24];
  
GetPlayerName(playeridnamesizeof(name));
  
#if defined PRINT_HOUSES
    
printf("%s Bought House ID %d"namehouseid);
  
#endif
  
GivePlayerMoney(playerid, -hInfo[houseid][Cost]);
  
format(string2,sizeof(string2), HOUSE_FILEhouseid);
  
INI_Open(string2);
  
INI_WriteString("Name"name);
  
INI_WriteInt("Locked"0);
  
INI_Save();
  
INI_Close();
  
hInfo[houseid][Name] = name;
  
hInfo[houseid][Locked] = 0;
  
DestroyPickup(HousePickup[houseid]);
  
HousePickup[houseid] = CreatePickup(127223hInfo[houseid][ExteriorX], hInfo[houseid][ExteriorY], hInfo[houseid][ExteriorZ]);
  
ShowBoughtHouseMessage(playerid);
  return 
1;

Can you do if a player has 1000 score for example then you can buy it
Reply
#2

add
pawn Код:
if(GetPlayerScore(playeerid) >= 1000) return SendClientMessage(playerid, [color], "You have to get 1000 score before you can use this command");
Reply
#3

i have error C:\Users\User\Desktop\house.pwn(748 ) : error 035: argument type mismatch (argument 2)

Code
PHP код:
stock BuyHouse(playeridhouseid)
{
if(
GetPlayerScore(playerid) >= 1000) return SendClientMessage(playerid"You have to get 1000 score before you can use this command");
  new 
string2[256];
  new 
name[24];
  
GetPlayerName(playeridnamesizeof(name));
  
#if defined PRINT_HOUSES
    
printf("%s Bought House ID %d"namehouseid);
  
#endif
  
GivePlayerMoney(playerid, -hInfo[houseid][Cost]);
  
format(string2,sizeof(string2), HOUSE_FILEhouseid);
  
INI_Open(string2);
  
INI_WriteString("Name"name);
  
INI_WriteInt("Locked"0);
  
INI_Save();
  
INI_Close();
  
hInfo[houseid][Name] = name;
  
hInfo[houseid][Locked] = 0;
  
DestroyPickup(HousePickup[houseid]);
  
HousePickup[houseid] = CreatePickup(127223hInfo[houseid][ExteriorX], hInfo[houseid][ExteriorY], hInfo[houseid][ExteriorZ]);
  
ShowBoughtHouseMessage(playerid);
  return 
1;

Line of error
PHP код:
if(GetPlayerScore(playerid) >= 1000) return SendClientMessage(playerid"You have to get 1000 score before you can use this command"); 
Reply
#4

You didn't replace [color] with your desired colour. Also, that snippet has flawed logic. It'll fail if the player HAS more than 1000 score.

pawn Код:
if(GetPlayerScore(playerid) <= 1000) return SendClientMessage(playerid, REPLACE_ME_WITH_YOUR_COLOR,  "You have to get 1000 score before you can use this command");
PS: You should use [pawn] shortcode instead of [php]
Reply
#5

SendClientMessage has a color argument. add a color there.
eg
pawn Код:
SendClientMessage(playerid, 0xFFFFFFAA, "text"); //white

EDIT:
Quote:
Originally Posted by JamesC
Посмотреть сообщение
You didn't replace [color] with your desired colour. Also, that snippet has flawed logic. It'll fail if the player HAS more than 1000 score.

pawn Код:
if(GetPlayerScore(playerid) <= 1000) return SendClientMessage(playerid, REPLACE_ME_WITH_YOUR_COLOR,  "You have to get 1000 score before you can use this command");

o thanks for pointing that out. i often mix the greater than and the less than symbol :3
Reply
#6

i give rep to all
Reply
#7

i add and here but don't work
PHP код:
stock OpenHouseDialog(playeridhouseid)
{
  if(
strcmp(hInfo[houseid][Name], "ForSale",true) == 0)
  {
    new 
string[180];
    if(
GetPlayerScore(playerid) >= 1000) return SendClientMessage(playerid0xFFFFFFAA"You have to get 1000 score before you can use this command");
    if(
GetPlayerMoney(playerid) >= hInfo[houseid][Cost]) { format(string,sizeof(string),"{33AA33}Buy this house for $%d"hInfo[houseid][Cost]); }
    else { 
format(string,sizeof(string),"{FF0000}Buy this house for $%d"hInfo[houseid][Cost]); }
    
ShowPlayerDialog(playeridDIALOG_FORSALE_HOUSEDIALOG_STYLE_LIST"{33AA33}For Sale!"string"OK""Close");
    return 
1;
  }
  else
  {
    new 
string2[180];
    new 
name[24];
    
GetPlayerName(playerid,name,sizeof(name));
    if(
strcmp(hInfo[houseid][Name], nametrue) == 0)
    {
      
ShowPlayerDialog(playeridDIALOG_MY_HOUSE,DIALOG_STYLE_LIST"{33AA33}Welcome back to your house""{33AA33}Enter in your house\n{33AA33}Open/Close the door\n{33AA33}Sell your house""OK""Close");
      return 
0;
    } 
Reply
#8

pawn Код:
stock OpenHouseDialog(playerid, houseid)
{
  if(strcmp(hInfo[houseid][Name], "ForSale",true) == 0)
  {
    new string[180];
    if(GetPlayerScore(playerid) <= 1000) return SendClientMessage(playerid, 0xFFFFFFAA, "You have to get 1000 score before you can use this command");
    if(GetPlayerMoney(playerid) >= hInfo[houseid][Cost]) { format(string,sizeof(string),"{33AA33}Buy this house for $%d", hInfo[houseid][Cost]); }
    else { format(string,sizeof(string),"{FF0000}Buy this house for $%d", hInfo[houseid][Cost]); }
    ShowPlayerDialog(playerid, DIALOG_FORSALE_HOUSE, DIALOG_STYLE_LIST, "{33AA33}For Sale!", string, "OK", "Close");
    return 1;
  }
  else
  {
    new string2[180];
    new name[24];
    GetPlayerName(playerid,name,sizeof(name));
    if(strcmp(hInfo[houseid][Name], name, true) == 0)
    {
      ShowPlayerDialog(playerid, DIALOG_MY_HOUSE,DIALOG_STYLE_LIST, "{33AA33}Welcome back to your house", "{33AA33}Enter in your house\n{33AA33}Open/Close the door\n{33AA33}Sell your house", "OK", "Close");
      return 0;
    }
like "JamesC said its looking at a value at "1000" or more !
but you want it to look at "1000" or less


== When looking for something if its the same then a Value
>= When looking for something if its the same Or More then a Value
<= When looking for something if its the same Or Less then a Value
> When looking for something More then a Value
< When looking for something Less then a Value
Reply
#9

pawn Код:
if(GetPlayerScore(playerid) <= 1000) return SendClientMessage(playerid, 0xFFFFFFAA, "You have to get 1000 score before you can use this command");
you have to use " < " less than symbol. i wrote wrong. JamesC corrected, didnt you see?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)