SA-MP Forums Archive
Drugs Help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Drugs Help (/showthread.php?tid=83256)



Drugs Help - joeri55 - 23.06.2009

This is my error code:

pawn Код:
C:\Documents and Settings\Joeri\Bureaublad\penls.pwn(9273) : warning 209: function "GetDistanceBetweenPlayers" should return a value
C:\Documents and Settings\Joeri\Bureaublad\penls.pwn(9273) : warning 209: function "GetDistanceBetweenPlayers" should return a value
C:\Documents and Settings\Joeri\Bureaublad\penls.pwn(9455) : warning 209: function "GetDistanceBetweenPlayers" should return a value
C:\Documents and Settings\Joeri\Bureaublad\penls.pwn(9488) : warning 209: function "GetDistanceBetweenPoints" should return a value
C:\Documents and Settings\Joeri\Bureaublad\penls.pwn(9503) : warning 209: function "GetDistanceBetweenPoints" should return a value
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase

Header size:      5812 bytes
Code size:      754996 bytes
Data size:      508576 bytes
Stack/heap size:   16384 bytes; estimated max. usage=4910 cells (19640 bytes)
Total requirements: 1285768 bytes

5 Warnings.
and this is the script

pawn Код:
if (strcmp(cmd,"/drugsearch",true)==0) {
      new a;
        if(gTeam[playerid] == 2) {
          for(new i=0; i < MAX_PLAYERS; i++)
            {
            if (IsPlayerConnected(i) && i != playerid)
            {
            [b]if (GetDistanceBetweenPlayers(i,playerid) < 4) {[/b]
                if (Drugs[i] > 0) {
                    new txt[256];
                  new pname[MAX_PLAYER_NAME];
                            GetPlayerName(i,pname,sizeof(pname));
                            format(txt,sizeof(txt),"You have confiscated %d grams of drugs off %s",Drugs[i],pname);
                  SendClientMessage(playerid,COLOR_GREEN,txt);
                  format(txt,sizeof(txt),"You have been caught with %d grams of drugs on you",Drugs[i]);
                  SendClientMessage(i,COLOR_RED,txt);
              FlashTime[i] = 10;
                            Drugs[i] = 0;
                  a++;
                  return 1;
                    }
                    }
  }
        }
        } else {
          SendClientMessage(playerid,COLOR_RED,"Only cops can do this");
          return 1;
      }
      if (a==0) {
        SendClientMessage(playerid,COLOR_RED,"Nobody near you had any drugs");
        return 1;
    }
    }
Does anyone knows what the problem is? The first 2 errors are in the bold line if someone knows how to fix it then I will try to fix the other on my own.


Re: Drugs Help - Haegon - 24.06.2009

Try putting

Код:
return 1;
Between the last two curly brackets. If not - try putting it after the last bracket. Your code is oddly indented, so its hard to count the number of curly brackets.

Goodluck.