SA-MP Forums Archive
error 001: expected token: "#endif", but found "-end of file-" - 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: error 001: expected token: "#endif", but found "-end of file-" (/showthread.php?tid=422605)



error 001: expected token: "#endif", but found "-end of file-" - Fitri - 14.03.2013

HELLO I MAKE A MONEYBAG SCRIPT AND ERROR

Quote:

// This is a comment
// uncomment the line below if you want to write a filterscript
//created on 12/1/2013
#define FILTERSCRIPT

#include <a_samp>
#include <sscanf2>
#include <streamer>
#include <foreach>
#include <zcmd>


#if defined FILTERSCRIPT

#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))

new eventcp ,
eventcppickup ,
Float:eventcpx,
Float:eventcpy,
Float:eventcpz ,
eventcpdaset ,
eventreward ,
Text3D:eventmtext,
eventstart ,
eventformattext[128];

CMD:createmevent(playerid,params[])
{
new Float,Float:y,Float:z , f[128] ,amount;
if(sscanf(params,"i",amount)) return SendClientMessage(playerid,-1,"stynx usage /createmevent [price reward(number only)]");
if(eventcpdaset == 1) return SendClientMessage(playerid,-1,"|you already creating the moneybag |");
else
{
GetPlayerPos(playerid,x,y,z);
eventreward = amount;
eventcpx = x;
eventcpy = y;
eventcpz = z;
eventcpdaset = 1;
format(f,sizeof(f),"you has set mb event at %d,%d,%d || reward : %d",x,y,z,amount);
SendClientMessage(playerid,-1,f);
}
return 1;
}

CMDtartmevent(playerid,params[])
{
new f[128];
if(isnull(params)) return SendClientMessage(playerid,-1,"stynx usage /startmevent [name or words or clue or something nice xD]");
if(eventcpdaset == 0) return SendClientMessage(playerid,-1,"you did't not have create moneybag yet");
if(eventstart == 1)
{
format(f,128,"%s",eventformattext);
SendClientMessageToAll(-1,f);
}
if(eventstart == 0)
{
eventcppickup = CreateDynamicPickup(1550,1,eventcpx, eventcpy, eventcpz,-1,-1,-1,100.0);
eventcp = CreateDynamicCP(eventcpx, eventcpy, eventcpz,1,-1,-1,-1,1.0);
eventmtext = CreateDynamic3DTextLabel("> moneybag <", 0xFF8040FF, eventcpx, eventcpy, eventcpz,3.0);
format(f,sizeof(f),"*** MoneyBagEvent(find the hidden moneybag) !!! at %s |reward : %d ***={FF8040}REAL",params,eventreward);
eventformattext = f;
eventstart = 1;
SendClientMessageToAll(-1,f);
}
return 1;
}

CMD:cancelmevent(playerid,params[])
{
if(eventcpdaset == 1)
{
eventcpdaset = 0;
eventstart = 0;
DestroyDynamicPickup(eventcppickup);
DestroyDynamicCP(eventcp);
DestroyDynamic3DTextLabel(eventmtext);
SendClientMessage(playerid,-1,"| kau da cancel event moneybags |");
}
else return SendClientMessage(playerid,-1,"you did't not set the any moneybag");
return 1;
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == eventcp && IsValidDynamicCP(eventcp) && eventcpdaset == 1)
{
new f[128];
format(f,sizeof(f),"***%s has found the moneybag and won $%d (moneybag event over)***={FF8040}REAL ",GetName(playerid),eventreward);
SendClientMessageToAll(-1,f);
GivePlayerMoney(playerid,eventreward);
eventcpdaset = 0;
DestroyDynamicPickup(eventcppickup);
DestroyDynamicCP(eventcp);
DestroyDynamic3DTextLabel(eventmtext);
eventstart = 0;
PlaySoundForAll(36205 , 0.0, 0.0, 0.0);
return 1;
}
return 1;
}


public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" mb event jajaja");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

//#else

main()
{
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 0;
}

PlaySoundForAll(soundid, Float, Float:y, Float:z)
{
foreach(new i : Player)
{
if (IsPlayerConnected(i))
{
PlayerPlaySound(i, soundid, x, y, z);
}
}
}

stock GetName(playerid)
{
new
name[24];
GetPlayerName(playerid, name, sizeof(name));
//strreplace(name, '_', ' ';
return name;
}

#endif

ERROR

Quote:

error 001: expected token: "#endif", but found "-end of file-"

WARNING

Quote:

warning 209: function "SSCANF_OnFilterScriptInit" should return a value




Re: error 001: expected token: "#endif", but found "-end of file-" - Gamer_007 - 14.03.2013

I think u need to put
pawn Код:
#endif
before the main().


Re: error 001: expected token: "#endif", but found "-end of file-" - Fitri - 14.03.2013

=_=''


Re: error 001: expected token: "#endif", but found "-end of file-" - Gamer_007 - 14.03.2013

Quote:
Originally Posted by Fitri
Посмотреть сообщение
=_=''
EDITED See now


Re: error 001: expected token: "#endif", but found "-end of file-" - Fitri - 14.03.2013

not work


Re: error 001: expected token: "#endif", but found "-end of file-" - Scrillex - 14.03.2013

At bottom of your script
#endif


Re: error 001: expected token: "#endif", but found "-end of file-" - Scenario - 14.03.2013

Remove this:

pawn Код:
#define FILTERSCRIPT
Change this:

pawn Код:
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
to this:

pawn Код:
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
Remove this from the bottom of your script:

pawn Код:
#endif



Re: error 001: expected token: "#endif", but found "-end of file-" - KP2 - 14.03.2013

Hey bro,
Fixed it for you
PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//created on 12/1/2013
#define FILTERSCRIPT
#include <a_samp>
#include <sscanf2>
#include <streamer>
#include <foreach>
#include <zcmd>
#if defined FILTERSCRIPT
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
new 
eventcp ,
eventcppickup ,
Float:eventcpx,
Float:eventcpy,
Float:eventcpz ,
eventcpdaset ,
eventreward ,
Text3D:eventmtext,
eventstart ,
eventformattext[128];
CMD:createmevent(playerid,params[])
{
new 
Float,Float:y,Float:f[128] ,amount;
if(
sscanf(params,"i",amount)) return SendClientMessage(playerid,-1,"stynx usage /createmevent [price reward(number only)]");
if(
eventcpdaset == 1) return SendClientMessage(playerid,-1,"|you already creating the moneybag |");
else
{
GetPlayerPos(playerid,x,y,z);
eventreward amount;
eventcpx x;
eventcpy y;
eventcpz z;
eventcpdaset 1;
format(f,sizeof(f),"you has set mb event at %d,%d,%d || reward : %d",x,y,z,amount);
SendClientMessage(playerid,-1,f);
}
return 
1;
}
CMDtartmevent(playerid,params[])
{
new 
f[128];
if(
isnull(params)) return SendClientMessage(playerid,-1,"stynx usage /startmevent [name or words or clue or something nice xD]");
if(
eventcpdaset == 0) return SendClientMessage(playerid,-1,"you did't not have create moneybag yet");
if(
eventstart == 1)
{
format(f,128,"%s",eventformattext);
SendClientMessageToAll(-1,f);
}
if(
eventstart == 0)
{
eventcppickup CreateDynamicPickup(1550,1,eventcpxeventcpyeventcpz,-1,-1,-1,100.0);
eventcp CreateDynamicCP(eventcpxeventcpyeventcpz,1,-1,-1,-1,1.0);
eventmtext CreateDynamic3DTextLabel("> moneybag <"0xFF8040FFeventcpxeventcpyeventcpz,3.0);
format(f,sizeof(f),"*** MoneyBagEvent(find the hidden moneybag) !!! at %s |reward : %d ***={FF8040}REAL",params,eventreward);
eventformattext f;
eventstart 1;
SendClientMessageToAll(-1,f);
}
return 
1;
}
CMD:cancelmevent(playerid,params[])
{
if(
eventcpdaset == 1)
{
eventcpdaset 0;
eventstart 0;
DestroyDynamicPickup(eventcppickup);
DestroyDynamicCP(eventcp);
DestroyDynamic3DTextLabel(eventmtext);
SendClientMessage(playerid,-1,"| kau da cancel event moneybags |");
}
else return 
SendClientMessage(playerid,-1,"you did't not set the any moneybag");
return 
1;
}
public 
OnPlayerEnterDynamicCP(playeridcheckpointid)
{
if(
checkpointid == eventcp && IsValidDynamicCP(eventcp) && eventcpdaset == 1)
{
new 
f[128];
format(f,sizeof(f),"***%s has found the moneybag and won $%d (moneybag event over)***={FF8040}REAL ",GetName(playerid),eventreward);
SendClientMessageToAll(-1,f);
GivePlayerMoney(playerid,eventreward);
eventcpdaset 0;
DestroyDynamicPickup(eventcppickup);
DestroyDynamicCP(eventcp);
DestroyDynamic3DTextLabel(eventmtext);
eventstart 0;
PlaySoundForAll(36205 0.00.00.0);
return 
1;
}
return 
1;
}
public 
OnFilterScriptInit()
{
print(
"\n--------------------------------------");
print(
" mb event jajaja");
print(
"--------------------------------------\n");
return 
1;
}
public 
OnFilterScriptExit()
{
return 
1;
}
//#else
main()
{
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
return 
0;
}
PlaySoundForAll(soundidFloatFloat:yFloat:z)
{
foreach(new 
Player)
{
if (
IsPlayerConnected(i))
{
PlayerPlaySound(isoundidxyz);
}
}
}
stock GetName(playerid)
{
new
name[24];
GetPlayerName(playeridnamesizeof(name));
//strreplace(name, '_', ' ';
return name;
}
#endif 
#endif 
Well, I compiled it I get no errors, hope it's the same for you...


Re: error 001: expected token: "#endif", but found "-end of file-" - davve95 - 14.03.2013

If it won't work, test with this in bottom:

pawn Код:
#else

#endif



Re: error 001: expected token: "#endif", but found "-end of file-" - dr.lozer - 14.03.2013

all noobs