Filterscript
#1

plz help me to make this is an filterscript (+rep}



so i can just add more missions as filterscripts
Reply
#2

Your Made this FS ?
Reply
#3

PHP код:
#include <a_samp>
 
#define COLOR_ORANGE        0xFFA500FF
#define COLOR_LIMEGREEN     0x32CD32FF
#define COLOR_ROYALBLUE     0x4169E1FF
#define COLOR_PINK          0xFA8072FF
#define COLOR_GREY          0xAFAFAFAA
#define COLOR_GREEN         0x33AA33AA
#define COLOR_RED           0xAA3333AA
#define COLOR_YELLOW        0xFFFF00AA
#define COLOR_WHITE         0xFFFFFFAA
#define COLOR_BLUE          0x0000BBAA
#define COLOR_LIGHTBLUE     0x33CCFFAA
 
enum {
    
STAGE_NONE,
    
STAGE_PICKUP,
    
STAGE_ONROUTE
}
 
new 
MissionStage[MAX_PLAYERS];
 
new 
FloatgPickupCPs[][] = {
    { 
2798.1702, -1576.292610.9272 },
    { 
3798.1702,-1576.2926,10.9272 },
    { 
1798.1702,-1576.2926,10.9272 }
};
 
new 
FloatgDeliverCPs[][] = {
    { 
2060.4375, -2091.212613.5469 },
    { 
070.8125, -2384.616013.5469 },
    { 
900.7358, -1204.077916.9832 },
    { 
800.1103, -1542.825813.5526 }
};
public 
OnFilterScriptInit()
{
    print(
"\n----------------------------------");
    print(
"::::::::your fs name:::::::");
    print(
"----------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    print(
"\n----------------------------------");
    print(
"::::::::your fs name:::::::");
    print(
"----------------------------------\n");
    return 
1;
}
public 
OnPlayerConnect(playerid) {
    
MissionStage[playerid] = STAGE_NONE;
    return 
true;
}
 
DeliveryMission(playerid) {
    if(
MissionStage[playerid] == STAGE_NONE) {
        if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 455) {
            new
                
idx,
                
Floattmp,
                
Floatdist GetPlayerDistanceFromPoint(playeridgPickupCPs[0][0], gPickupCPs[0][1], gPickupCPs[0][2])
            ;
            for(new 
1sizeof gPickupCPs; ++i) {
                
tmp GetPlayerDistanceFromPoint(playeridgPickupCPs[i][0], gPickupCPs[i][1], gPickupCPs[i][2]);
 
                if(
tmp dist) {
                    
dist tmp;
                    
idx i;
                }
            }
            
MissionStage[playerid] = STAGE_PICKUP;
            return 
SetPlayerCheckpoint(playeridgPickupCPs[idx][0], gPickupCPs[idx][1], gPickupCPs[idx][2], 10.0);
        }
    } else {
        
MissionStage[playerid] = STAGE_NONE;
        return 
DisablePlayerCheckpoint(playerid);
    }
    return 
false;
}
 
public 
OnPlayerCommandText(playeridcmdtext[]) {
    if (
strcmp("/work"cmdtexttrue) == 0) {
        if(
MissionStage[playerid] != STAGE_NONE) {
            return 
SendClientMessage(playeridCOLOR_RED"You are already doing a work!");
        }
        if(
DeliveryMission(playerid)) {
            new
                
string[64]
            ;
            
GameTextForPlayer(playerid"~g~You started the job, good luck!"30003);
            
GetPlayerName(playeridstringMAX_PLAYER_NAME);
            
strcat(string" is now doing Courrier mission.");
            return 
SendClientMessageToAll(COLOR_YELLOWstring);
        }
    }
    if (
strcmp("/stopwork"cmdtexttrue) == 0) {
        if(
MissionStage[playerid] == STAGE_NONE) {
            return 
SendClientMessage(playeridCOLOR_RED"You aren't doing any work!");
        }
        if(
DeliveryMission(playerid)) {
            return 
SendClientMessage(playeridCOLOR_RED"You aborted the delivery job!");
        }
    }
    return 
true;
}
 
 
public 
OnPlayerEnterCheckpoint(playerid) {
    switch(
MissionStage[playerid]) {
        case 
STAGE_PICKUP: {
            new
                
rand random(sizeof gDeliverCPs)
            ;
            
DisablePlayerCheckpoint(playerid);
            
SendClientMessage(playeridCOLOR_RED"Loading Courrier");
            
GameTextForPlayer(playerid"~g~Deliver the Courrier!"30003);
            
SetPlayerCheckpoint(playeridgDeliverCPs[rand][0], gDeliverCPs[rand][1], gDeliverCPs[rand][2], 10.0);
 
            
MissionStage[playerid] = STAGE_ONROUTE;
        }
        case 
STAGE_ONROUTE: {
            
DisablePlayerCheckpoint(playerid);
 
            
SendClientMessage(playeridCOLOR_RED"Unloading Package");
            
SetPlayerScore(playeridGetPlayerScore(playerid) + 1);
            
GivePlayerMoney(playerid5000);
 
            
MissionStage[playerid] = STAGE_NONE;
        }
    }
    return 
true
Reply
#4

Quote:
Originally Posted by Amunra
Посмотреть сообщение
Your Made this FS ?
i had edited and got some errors
i have a gamemode and it has some commands when i add this filterscript into server.cfg the commands in gamemmode doesnt works so plz can u prefer a solution ??
Reply
#5

compile and put fs .amx to filterscrift folder and write at server.cfg in line filterscrift your fs name
Reply
#6

Quote:
Originally Posted by bugmenotlol
Посмотреть сообщение
i had edited and got some errors
i have a gamemode and it has some commands when i add this filterscript into server.cfg the commands in gamemmode doesnt works so plz can u prefer a solution ??
Why Not Send a Error Code !
Maybe I Can Help you .. Because I Can't See your Problem
Reply
#7

Quote:
Originally Posted by Amunra
Посмотреть сообщение
Why Not Send a Error Code !
Maybe I Can Help you .. Because I Can't See your Problem
its not an error
i just mean that plz take a look at

but after loading i can use /work commands in filterscript but cant use the comands which are in gamemodes

hope u understood
Reply
#8

or can anyone help me to merge this 2 fitlerscripts as one ??
Reply
#9

In your filterscript, in callback OnPlayerCommandText, change the last return to
PHP код:
return false
Returning true will stop the server from trying to execute any commands in other scripts, because you should only return true when the command has been executed.
If the command doesn't exist in that script, you need to return false.
Reply
#10

seems like all isuue has been fixed
thnx all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)