GameTextForPlayer problem [SOLVED]
#1

Now what im trying to do is make it so when you rob one of the stores, the GameTextForPlayer tells you how much. It compiles without any problems but when it comes to robbing the store, it doesnt tell me how much i was "Given" it just says "$1 Stolen".. Where the minimum amount for the "RobberyCash" is $500. Can someone please check to see why its not showing me the amount that is actually stolen. And let me know how i can fix it.

Thanks to anyone who can help.

Quote:

if(strcmp("/rob",cmdtext,true)==0)
{
if(PlayerToPoint(25.0,playerid,-27.8412,-89.3996,1003.5469) || PlayerToPoint(25.0,playerid,-30.7268,-28.3191,1003.5573))
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "[CRIMINAL]%s just robbed a 24/7 store!.", pName);
SendClientMessageToAll(COLOR_GREY, string);
RobbedRecently[playerid] = 1;
robcash = GivePlayerMoney(playerid, robberycash[random(sizeof(robberycash))]);
format(string, sizeof(string), "~w~$%d ~y~stolen",robcash);
GameTextForPlayer(playerid, string, 5000, 1);
if(robcash <= 1000)
{
SetPlayerWantedLevel(playerid,1);
}
if(robcash <= 2000)
{
SetPlayerWantedLevel(playerid,2);
}
if(robcash <= 3000)
{
SetPlayerWantedLevel(playerid,3);
}
if(robcash <= 4000)
{
SetPlayerWantedLevel(playerid,4);
}
if(robcash <= 5000)
{
SetPlayerWantedLevel(playerid,5);
}
if(robcash <= 6000)
{
SetPlayerWantedLevel(playerid,6);
}
} else return SendClientMessage(playerid, COLOR_LIME, "Your not inside one of the two 24/7's in Los Santos");
return 1;
}

Reply
#2

Код:
   if(strcmp("/rob",cmdtext,true)==0)
  {
     if(PlayerToPoint(25.0,playerid,-27.8412,-89.3996,1003.5469) || PlayerToPoint(25.0,playerid,-30.7268,-28.3191,1003.5573))
      {
      new pName[MAX_PLAYER_NAME];
      GetPlayerName(playerid, pName, sizeof(pName));
      format(string, sizeof(string), "[CRIMINAL]%s just robbed a 24/7 store!.", pName);
      SendClientMessageToAll(COLOR_GREY, string);
      RobbedRecently[playerid] = 1;
      robcash = GivePlayerMoney(playerid, robberycash[random(sizeof(robberycash))]);
       format(string, sizeof(string), "~w~$%s ~y~stolen",robcash);
       GameTextForPlayer(playerid, string, 5000, 1);
      if(robcash <= 1000)
      {
      SetPlayerWantedLevel(playerid,1);
      }
      if(robcash <= 2000)
      {
      SetPlayerWantedLevel(playerid,2);
      }
      if(robcash <= 3000)
      {
      SetPlayerWantedLevel(playerid,3);
      }
      if(robcash <= 4000)
      {
      SetPlayerWantedLevel(playerid,4);
      }
      if(robcash <= 5000)
      {
      SetPlayerWantedLevel(playerid,5);
      }
      if(robcash <= 6000)
      {
      SetPlayerWantedLevel(playerid,6);
      }
     } else return SendClientMessage(playerid, COLOR_LIME, "Your not inside one of the two 24/7's in Los Santos");
   return 1;
  }
Reply
#3

i ended up fixing my problem but what you gave me blink didnt was for displaying someones name.

I ended up doing this..

Quote:

if(strcmp("/rob",cmdtext,true)==0)
{
if(PlayerToPoint(25.0,playerid,-27.8412,-89.3996,1003.5469) || PlayerToPoint(25.0,playerid,-30.7268,-28.3191,1003.5573))
{
new pName[MAX_PLAYER_NAME];
new playercash;
new totalcash;
new stolencash;

playercash = GetPlayerMoney(playerid);
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "[CRIMINAL]%s just robbed a 24/7 store!.", pName);
SendClientMessageToAll(0xFF6347AA, string);
RobbedRecently[playerid] = 1;
GivePlayerMoney(playerid, robberycash[random(sizeof(robberycash))]);
totalcash = GetPlayerMoney(playerid);
stolencash = totalcash - playercash;
format(string, sizeof(string), "~r~Value Stolen ~n~~y~ $%d",stolencash);
GameTextForPlayer(playerid, string, 5000, 1);
SetPlayerColor(playerid,0xFF6347AA);
if(stolencash >= 500 && stolencash <= 1999)
{
SetPlayerWantedLevel(playerid,1);
}
if(stolencash >= 1000 && stolencash <= 2999)
{
SetPlayerWantedLevel(playerid,2);
}
if(stolencash >= 3000 && stolencash <= 3999)
{
SetPlayerWantedLevel(playerid,3);
}
if(stolencash >= 4000 && stolencash <= 4999)
{
SetPlayerWantedLevel(playerid,4);
}
if(stolencash >= 5000 && stolencash <= 5999)
{
SetPlayerWantedLevel(playerid,5);
}
if(stolencash >= 6000)
{
SetPlayerWantedLevel(playerid,6);
}
} else return SendClientMessage(playerid, COLOR_LIME, "Your not inside one of the two 24/7's in Los Santos");
return 1;
}

I just added the parts in bold and it worked fine. If anyone needs a rob command they can use mine if they like.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)