[FilterScript] My first FilterScript! /Sos
#1

/sos Filterscript by TechKid100
Edit: I know this is really old now, but I want to show you how much progess I have made! :P

So you crashed a plane or a car, and you have survived, what do you do? Most people will do /kill, thats boring, so thats why I made this SOS system. When you do /sos, your icon turns red, and this message goes to all: "[PlayerName] has called a distress signal! Their icon has turnend red, please save them!", then this message goes to the person who called SOS:"Enter /saved when you have been rescued!".

Here a some screen shots!





The server seen will be public soon!

Here is the code:

Requires ZCMD, can be easily changed to strcmp or dcmd.

pawn Код:
#include <a_samp>
#include <ZCMD>

#define COLOR_BLUE 0x0000FFFF
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_RED 0xFF0000FF
#define COLOR_YELLOW 0xFFFF00FF

enum Player
{
    SOSon,
}

new PlayerInfo[MAX_PLAYERS][Player];
new SOSColor[MAX_PLAYERS];

COMMAND:sos(playerid, params[])
        {
                new string[192];
                if (PlayerInfo[playerid][SOSon] == 1)
                {
                        SendClientMessage(playerid, COLOR_RED, "ERROR: Use /saved to come back from SOS!");
                        return 1;
                }

                else if (PlayerInfo[playerid][SOSon] == 0)
                {
                        new pname[MAX_PLAYER_NAME];
                        SOSColor[playerid]=GetPlayerColor(playerid);
                        GetPlayerName(playerid, pname, sizeof(pname));
                        format(string, sizeof(string), "{FF8000}%s({FFFFFF}%d{FF8000}){FFFFFF} has called a distress signal! There icon has turned {FF0000}red{FFFFFF}! Please save them!", pname,playerid);
                        SendClientMessageToAll(COLOR_WHITE, string);
                        SendClientMessage(playerid, COLOR_BLUE, "Use /saved when you are rescued!");
                        SetPlayerColor(playerid, COLOR_RED);
                        PlayerInfo[playerid][SOSon] = 1;
                        return 1;
                }
                return 0;
}

COMMAND:saved(playerid, params[])
{
    new string [128];
    if (PlayerInfo[playerid][SOSon] == 0)
    {
        SendClientMessage(playerid, COLOR_RED, "ERROR: Your are not in need of rescue!");
        return 1;
    }
    else if (PlayerInfo[playerid][SOSon] == 1)
    {
        new pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));
        format(string, sizeof(string), "{FF8000}%s({FFFFFF}%d{FF8000}){FFFFFF} has been saved! And no longer needs help!", pname,playerid);
        SendClientMessageToAll(COLOR_YELLOW, string);
        SetPlayerColor(playerid, SOSColor[playerid]);
        PlayerInfo[playerid][SOSon] = 0;
        return 1;
    }
    return 0;
}
Credits:

TechKid100 - Making the script
Rokzlive - Making it so the play icon color returns to what it was before

Thanks for taking interest!

Have fun!
Reply
#2

Nice man, but it's really simple to do. But it's ok for your first FS.
Reply
#3

Ty, I just downloaded you name tag script, but I need some help, if it is possible to move it more to the right.
Reply
#4

Hey, atleast it works, doesn't matter if it's simple. And to be honest, the scripting looks very neat to me.
Reply
#5

Thanks! Also could someone help me with the Icon Color going back to the original color before they did /Sos
Reply
#6

Techkid i can do that just send me your msn or somthing to contact you.
Reply
#7

Good Job
Reply
#8

Use this to get players color then set it back on /saved.

pawn Код:
#include <a_samp>
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
new Color[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/sos", true) == 0) {
        new pName [MAX_PLAYER_NAME], string[128];
        Color[playerid]=GetPlayerColor(playerid);
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "%s has called a distress signal! There icon has turnend red, please save them!", pName);
        SendClientMessageToAll(COLOR_RED, string);
        SendClientMessage(playerid, COLOR_YELLOW, "Enter /saved when you have been rescued!");
        SetPlayerColor(playerid, 0xFF0000AA);
        return 1;
    }
    if(strcmp(cmdtext, "/saved", true) == 0) {
        new pName [MAX_PLAYER_NAME], string[128];
        GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
        format(string, sizeof(string), "%s has been rescued! And no longer needs saving!", pName);
        SendClientMessageToAll(COLOR_YELLOW, string);
        SetPlayerColor(playerid, Color[playerid]);
        return 1;
    }
    return 0;
}
Reply
#9

Thanks! I updated the first post and gave you credit!
Reply
#10

Ty, btw, im Whatcha from pilots life. XD
Reply
#11

Quote:
Originally Posted by Rokzlive
Посмотреть сообщение
Ty, btw, im Whatcha from pilots life. XD
XD! Who would of guessed?
Reply
#12

Updated code!
Reply
#13

I know this is old now, but I updated it anyway! :P
Reply
#14

good job fr ur first fs keep it up and good luck for ur futur server
Reply
#15

Nice for you first, keep it mate
Reply
#16

Considering your new at scripting (first filterscript), your scripting style is very neat. Keep it up man!
Reply
#17

Thanks guys, but remember, I only just remembered about this so I just updated it. I am working on a VIP system soon.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)