Difference problem
#1

I want it to prevent the player from fishing any further when the player's fish value is greater than 16,000 ounces. However, when a player just starts fishing, it says, "You've reached the fishing limit!" when you have 0 ounces.

pawn Код:
new fish[MAX_PLAYERS];

CMD:fish(playerid,params[])
{
   if(pInfo[playerid][Job]==2)
   {
       if(GetVehicleModel(GetPlayerVehicleID(playerid))==453)
       {
           if(IsPlayerInRangeOfPoint(playerid,32,-1086.7250,651.5926,-0.3300))
           {
               if(fish[playerid]>16000) // here
               {
                   if(worms[playerid]>1)
                   {
                       new str[128];
                       format(str,sizeof(str),"** %s cast out their fishing line.",GetName(playerid));
                       ProxDetector(30,playerid,str,COLOR_PURPLE);
                       worms[playerid]--;
                       defer fWait(playerid);
                   }
                   else SendClientMessage(playerid,COLOR_RED,"You have no worms!");
               }
               else SendClientMessage(playerid,COLOR_RED,"You've reached the fishing limit!");
           }
           else CreateDynamicCP(-1086.7250,650.5926,-0.3300,32,-1,-1,-1,320);
       }
       else SendClientMessage(playerid,COLOR_RED,"You're not in a Reefer!");
   }
   return 1;
}
Reply
#2

Код:
new fish[MAX_PLAYERS];

CMD:fish(playerid,params[])
{
   if(pInfo[playerid][Job]==2)
   {
       if(GetVehicleModel(GetPlayerVehicleID(playerid))==453)
       {
           if(IsPlayerInRangeOfPoint(playerid,32,-1086.7250,651.5926,-0.3300))
           {
               if(fish[playerid]<16000) // here
               {
                   if(worms[playerid]>1)
                   {
                       new str[128];
                       format(str,sizeof(str),"** %s cast out their fishing line.",GetName(playerid));
                       ProxDetector(30,playerid,str,COLOR_PURPLE);
                       worms[playerid]--;
                       defer fWait(playerid);
                   }
                   else SendClientMessage(playerid,COLOR_RED,"You have no worms!");
               }
               else SendClientMessage(playerid,COLOR_RED,"You've reached the fishing limit!");
           }
           else CreateDynamicCP(-1086.7250,650.5926,-0.3300,32,-1,-1,-1,320);
       }
       else SendClientMessage(playerid,COLOR_RED,"You're not in a Reefer!");
   }
   return 1;
}
You used the "greater than" symbol instead of the "less than" symbol, copy the code above into your gm.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)