Script BUG help
#1

PHP код:
stock BuyBusiness(playeridbizid)
{
  new 
string2[256];
  new 
name[24];
  
GetPlayerName(playeridnamesizeof(name));
  
#if defined PRINT_HOUSES
    
printf("%s Bought Store ID %d"namebizid);
  
#endif
  
GivePlayerMoney(playerid, -bInfo[bizid][bCost]);
  
format(string2,sizeof(string2), BIZ_FILEbizid);
  
INI_Open(string2);
  
INI_WriteString("Name"name);
  
INI_WriteInt("Locked"0);
  
INI_Save();
  
INI_Close();
  
bInfo[bizid][bName] = name;
  
bInfo[bizid][bLocked] = 0;
  
SetPlayerScore(playerid, - 80000);
  
ShowBoughtStoreMessage(playerid);
  
  return 
1;

What is wrong here I wont when player buy a bussiness to get - 80000 score
Reply
#2

remove SetPlayerScore(playerid, - 80000);
Reply
#3

Problem solved. You were setting them to -80000 instead to give them.

pawn Код:
stock BuyBusiness(playerid, bizid)
{
  new string2[256];
  new name[24];
  GetPlayerName(playerid, name, sizeof(name));
  #if defined PRINT_HOUSES
    printf("%s Bought Store ID %d", name, bizid);
  #endif
  GivePlayerMoney(playerid, -bInfo[bizid][bCost]);
  format(string2,sizeof(string2), BIZ_FILE, bizid);
  INI_Open(string2);
  INI_WriteString("Name", name);
  INI_WriteInt("Locked", 0);
  INI_Save();
  INI_Close();
  bInfo[bizid][bName] = name;
  bInfo[bizid][bLocked] = 0;
  GivePlayerScore(playerid, - 80000);
  ShowBoughtStoreMessage(playerid);
   
  return 1;
}

EDIT: Xaviour212 was faster
Reply
#4

but I want to take their score (80000)
Reply
#5

change SetPlayerScore(playerid, - 80000); to SetPlayerScore(playerid, 80000);
Reply
#6

PHP код:
stock BuyBusiness(playeridbizid)
{
  new 
string2[256];
  new 
name[24];
  
GetPlayerName(playeridnamesizeof(name));
  
#if defined PRINT_HOUSES
    
printf("%s Bought Store ID %d"namebizid);
  
#endif
  
GivePlayerMoney(playerid, -bInfo[bizid][bCost]);
  
format(string2,sizeof(string2), BIZ_FILEbizid);
  
INI_Open(string2);
  
INI_WriteString("Name"name);
  
INI_WriteInt("Locked"0);
  
INI_Save();
  
INI_Close();
  
bInfo[bizid][bName] = name;
  
bInfo[bizid][bLocked] = 0;
  
ShowBoughtStoreMessage(playerid);
  
SetPlayerScore(playerid80000);
  
  return 
1;

but this do not get from them 80000 score and try with SetPlayerScore(playerid, -80000); and again do not get from them the score
Reply
#7

pawn Код:
stock BuyBusiness(playerid, bizid)
{
  new string2[256], score = GetPlayerScore(playerid);
  new name[24];
  GetPlayerName(playerid, name, sizeof(name));
  #if defined PRINT_HOUSES
    printf("%s Bought Store ID %d", name, bizid);
  #endif
  GivePlayerMoney(playerid, -bInfo[bizid][bCost]);
  format(string2,sizeof(string2), BIZ_FILE, bizid);
  INI_Open(string2);
  INI_WriteString("Name", name);
  INI_WriteInt("Locked", 0);
  INI_Save();
  INI_Close();
  bInfo[bizid][bName] = name;
  bInfo[bizid][bLocked] = 0;
  ShowBoughtStoreMessage(playerid);
  SetPlayerScore(playerid, score - 80000);
   
  return 1;
}
Reply
#8

and this don't work
Reply
#9

someone ?
Reply
#10

SetPlayerScore(killerid, GetPlayerScore(killerid) + 80000);
to add 80000 to their score
SetPlayerScore(killerid, GetPlayerScore(killerid) - 80000);
to take 80000 from their score
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)