SA-MP Forums Archive
[FilterScript] My first FilterScript! /Sos - 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: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+--- Thread: [FilterScript] My first FilterScript! /Sos (/showthread.php?tid=245952)



/sos command (First Filterscript) - Odyssey - 02.04.2011

/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!


Re: My first FilterScript! /Sos - [DOG]irinel1996 - 02.04.2011

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


Re: My first FilterScript! /Sos - Odyssey - 02.04.2011

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


Re: My first FilterScript! /Sos - Geso - 02.04.2011

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


Re: My first FilterScript! /Sos - Odyssey - 02.04.2011

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


Re: My first FilterScript! /Sos - Rokzlive - 02.04.2011

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


Re: My first FilterScript! /Sos - Jason010 - 02.04.2011

Good Job


Re: My first FilterScript! /Sos - Rokzlive - 02.04.2011

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;
}



Re: My first FilterScript! /Sos - Odyssey - 02.04.2011

Thanks! I updated the first post and gave you credit!


Re: My first FilterScript! /Sos - Rokzlive - 02.04.2011

Ty, btw, im Whatcha from pilots life. XD


Re: My first FilterScript! /Sos - Odyssey - 02.04.2011

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


Re: My first FilterScript! /Sos - Odyssey - 02.04.2011

Updated code!


Re: My first FilterScript! /Sos - Odyssey - 30.06.2011

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


Re : My first FilterScript! /Sos - bousla7e - 30.06.2011

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


Re: My first FilterScript! /Sos - juraska - 30.06.2011

Nice for you first, keep it mate


Re: My first FilterScript! /Sos - lolumadd_ - 01.07.2011

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


Re: /sos Filterscript by TechKid100 - Odyssey - 01.07.2011

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