[QUESTION] Why do this script not work?
#1

I have made a filterscript with a cop commend. But i don't work.

Can anybody tell, why not?


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

Quote:

#include <a_samp>

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#if defined FILTERSCRIPT
#if defined

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}

public OnFilterScriptExit()
{
return 1;
}

#else

main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
return 1;
}

public OnGameModeExit()
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/ticket", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] != 2)
{
SendClientMessage(playerid, COLOR_GREY, " You are not a Cop!");
return 1;
}
if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " You are not on Duty!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, " Ticket Money can't be below 1 or higher then 99999 !"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
return 1;
}
format(string, sizeof(string), "* You gave %s a Ticket costing $%d, reason: %s", giveplayer, moneys, (result));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Officer %s has given you a Ticket costing $%d, reason: %s", sendername, moneys, (result));
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Type /accept ticket, to accept it.");
TicketOffer[giveplayerid] = playerid;
TicketMoney[giveplayerid] = moneys;

return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
return 1;
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
return 1;
}
}
return 1;
}
{
// Do something here

return 1;
}
return 0;
}

Reply
#2

Im not so sure, the commands seem to have the correct functions.
You should clean up your script abit if this is a filterscript you don't need to have

Код:
public OnGameModeInit()
{
  // Don't use these lines if it's a filterscript
  SetGameModeText("Blank Script");
  return 1;
}

public OnGameModeExit()
{
  return 1;
}
Reply
#3

Quote:
Originally Posted by Battleman
pawn Код:
#include <a_samp>

// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

#else

main()
{
    print("\n----------------------------------");
    print(" Blank Gamemode by your name here");
    print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
    // Don't use these lines if it's a filterscript
    SetGameModeText("Blank Script");
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/ticket", true) == 0)
    {
     if(IsPlayerConnected(playerid))
     {
       if(gTeam[playerid] != 2)
            {
             SendClientMessage(playerid, COLOR_GREY, " You are not a Cop!");
             return 1;
            }
       if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
            {
             SendClientMessage(playerid, COLOR_GREY, " You are not on Duty!");
             return 1;
            }
        tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
      tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
                return 1;
            }
            moneys = strval(tmp);
            if(moneys < 1 || moneys > 99999) { SendClientMessage(playerid, COLOR_GREY, " Ticket Money can't be below 1 or higher then 99999 !"); return 1; }
            if(IsPlayerConnected(giveplayerid))
            {
             if(giveplayerid != INVALID_PLAYER_ID)
             {
               if (ProxDetectorS(8.0, playerid, giveplayerid))
                    {
                     GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        new length = strlen(cmdtext);
                        while ((idx < length) && (cmdtext[idx] <= ' '))
                        {
                            idx++;
                        }
                        new offset = idx;
                        new result[64];
                        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                        {
                            result[idx - offset] = cmdtext[idx];
                            idx++;
                        }
                        result[idx - offset] = EOS;
                        if(!strlen(result))
                        {
                            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ticket [playerid/PartOfName] [price] [reason]");
                            return 1;
                        }
                        format(string, sizeof(string), "* You gave %s a Ticket costing $%d, reason: %s", giveplayer, moneys, (result));
                        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                        format(string, sizeof(string), "* Officer %s has given you a Ticket costing $%d, reason: %s", sendername, moneys, (result));
                        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
                        SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Type /accept ticket, to accept it.");
                        TicketOffer[giveplayerid] = playerid;
                        TicketMoney[giveplayerid] = moneys;

                        return 1;
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, " That player is not near you !");
                        return 1;
                    }
                }
            }
            else
            {
             SendClientMessage(playerid, COLOR_GREY, " That player is Offline !");
             return 1;
            }
        }
        return 1;
 }
    {
        // Do something here

        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)