SA-MP Forums Archive
Fishing - 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)
+--- Thread: Fishing (/showthread.php?tid=391264)



Fishing - Joshswag - 10.11.2012

I'm trying to create a fishing system, but i get errors, and i've barely started.
Код:
#include <a_samp>

#if defined FILTERSCRIPT

#include <a_samp>
#include <ZCMD>
#include <sscanf2>

new HasRod[MAX_PLAYERS], HasBait[MAX_PLAYERS], Fishing[MAX_PLAYERS], Fish[MAX_PLAYERS][5];

#define WHITE 0xFFFFFFAA
#define RED 0xAA3333AA

forward FishCatchTimer(playerid);

#endif

public OnPlayerConnect(playerid)
{
    Fishing[playerid] = 0;
    HasBait[playerid] = 0;
    HasRod[playerid] = 0;
    Fish[playerid][1] = 0;
    Fish[playerid][2] = 0;
    Fish[playerid][3] = 0;
    Fish[playerid][4] = 0;
    return 1;
}
errors:
Код:
C:\Users\Josh\Desktop\FCSLRP\filterscripts\Fishing.pwn(20) : error 017: undefined symbol "Fishing"
C:\Users\Josh\Desktop\FCSLRP\filterscripts\Fishing.pwn(20) : warning 215: expression has no effect
C:\Users\Josh\Desktop\FCSLRP\filterscripts\Fishing.pwn(20) : error 001: expected token: ";", but found "]"
C:\Users\Josh\Desktop\FCSLRP\filterscripts\Fishing.pwn(20) : error 029: invalid expression, assumed zero
C:\Users\Josh\Desktop\FCSLRP\filterscripts\Fishing.pwn(20) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.



Re: Fishing - Plovix - 10.11.2012

Try this:

PHP код:
#include <a_samp>
#if defined FILTERSCRIPT
#include <a_samp>
#include <ZCMD>
#include <sscanf2>
#define WHITE 0xFFFFFFAA
#define RED 0xAA3333AA
forward FishCatchTimer(playerid);
#endif
new HasRod[MAX_PLAYERS], HasBait[MAX_PLAYERS], Fishing[MAX_PLAYERS], Fish[MAX_PLAYERS][5];
public 
OnPlayerConnect(playerid)
{
    
Fishing[playerid] = 0;
    
HasBait[playerid] = 0;
    
HasRod[playerid] = 0;
    
Fish[playerid][1] = 0;
    
Fish[playerid][2] = 0;
    
Fish[playerid][3] = 0;
    
Fish[playerid][4] = 0;
    return 
1;




Re: Fishing - Joshswag - 10.11.2012

Worked thanks, +rep.


Re: Fishing - Mmartin - 10.11.2012

Plovix's solution is not a solution. You have to realize what was the actual problem. It was you having the variables defined in a false condition, between #if defined FILTERSCRIPT and #endif. You have nowhere defined that it's a filterscript. There are two solutions - because now the forwards/defines you made won't work either.

Either delete the "#if defined FILTERSCRIPT" and "#endif" lines or put "#define FILTERSCRIPT" at the very beginning of your script.