Change this Please?
#1

Could this be change, That the Player Cant make an Advertisement if he/she aint at the SAN HQ

pawn Код:
if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet!");
                return 1;
            }
            if(PlayerInfo[playerid][pTut] == 0 || PlayerInfo[playerid][pHospital] == 1)
            {
                return 1;
            }
            if(PlayerInfo[playerid][pAdMuted] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "You are Advertisement Muted, If you think this was unfair, Please /report");
                return 1;
            }
            if(PlayerInfo[playerid][pPnumber] == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You don't have a cell phone!");
                SendClientMessage(playerid, COLOR_WHITE,"HINT: You can /buy a cell phone from a 24-7.");
                return 1;
            }
            if(PlayerInfo[playerid][pJailed] != 0 || PlayerCuffed[playerid] != 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You can't do that at this time!");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/ad)vertise [advert text]");
                return 1;
            }
            if((!adds) && (PlayerInfo[playerid][pAdmin] < 3))
            {
                format(string, sizeof(string), "   Please try again later %d seconds between Advertisements !",  (addtimer/1000));
                SendClientMessage(playerid, COLOR_GRAD2, string);
                return 1;

            }
            //------------------------------------------------------------------
            //PaNoULiS
            new ip[15];
            if(ipmatch(result, ip))
            {
                format(string, sizeof(string), "AdmCmd: %s was autokicked, reason: Possible server ad.", sendername);
                SendClientMessageToAll(COLOR_RED, string);
                Kick(playerid);
                for(new Order = 0; Order < 600; Order++)
                {
                    SendClientMessageToAll(COLOR_GREY, " ");
                }
                return 1;
            }
            //------------------------------------------------------------------
            new payout = idx * 25;
            if(PlayerInfo[playerid][pCash] < payout)
            {
                format(string, sizeof(string), "* You used %d characters which cost $%d, you don't have enough.", offset, payout);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                return 1;
            }
            PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-payout;
            GivePlayerMoney(playerid, - payout);
            format(string, sizeof(string), "Advertisement: %s, Contact: %s Ph: %d",  result, sendername,PlayerInfo[playerid][pPnumber]);
            OOCNews(TEAM_GROVE_COLOR,string);
            format(string, sizeof(string), "~r~Paid $%d~n~~w~Message contained: %d Characters", payout, idx);
            GameTextForPlayer(playerid, string, 5000, 5);
            if(PlayerInfo[playerid][pAdmin] < 4)
            {
                SetTimer("AddsOn", addtimer, 0);
                adds = 0;
            }
        }
        return 1;
    }
Reply
#2

Try this but change "range of point" and "coords".

pawn Код:
if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet!");
                return 1;
            }
            if(!PlayerToPoint("range you want - change",playerid,"cords of the point"))
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not at the SAN building!");
                return 1;
            }
            if(PlayerInfo[playerid][pTut] == 0 || PlayerInfo[playerid][pHospital] == 1)
            {
                return 1;
            }
            if(PlayerInfo[playerid][pAdMuted] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "You are Advertisement Muted, If you think this was unfair, Please /report");
                return 1;
            }
            if(PlayerInfo[playerid][pPnumber] == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You don't have a cell phone!");
                SendClientMessage(playerid, COLOR_WHITE,"HINT: You can /buy a cell phone from a 24-7.");
                return 1;
            }
            if(PlayerInfo[playerid][pJailed] != 0 || PlayerCuffed[playerid] != 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You can't do that at this time!");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/ad)vertise [advert text]");
                return 1;
            }
            if((!adds) && (PlayerInfo[playerid][pAdmin] < 3))
            {
                format(string, sizeof(string), "   Please try again later %d seconds between Advertisements !",  (addtimer/1000));
                SendClientMessage(playerid, COLOR_GRAD2, string);
                return 1;

            }
            //------------------------------------------------------------------
            //PaNoULiS
            new ip[15];
            if(ipmatch(result, ip))
            {
                format(string, sizeof(string), "AdmCmd: %s was autokicked, reason: Possible server ad.", sendername);
                SendClientMessageToAll(COLOR_RED, string);
                Kick(playerid);
                for(new Order = 0; Order < 600; Order++)
                {
                    SendClientMessageToAll(COLOR_GREY, " ");
                }
                return 1;
            }
            //------------------------------------------------------------------
            new payout = idx * 25;
            if(PlayerInfo[playerid][pCash] < payout)
            {
                format(string, sizeof(string), "* You used %d characters which cost $%d, you don't have enough.", offset, payout);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                return 1;
            }
            PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-payout;
            GivePlayerMoney(playerid, - payout);
            format(string, sizeof(string), "Advertisement: %s, Contact: %s Ph: %d",  result, sendername,PlayerInfo[playerid][pPnumber]);
            OOCNews(TEAM_GROVE_COLOR,string);
            format(string, sizeof(string), "~r~Paid $%d~n~~w~Message contained: %d Characters", payout, idx);
            GameTextForPlayer(playerid, string, 5000, 5);
            if(PlayerInfo[playerid][pAdmin] < 4)
            {
                SetTimer("AddsOn", addtimer, 0);
                adds = 0;
            }
        }
        return 1;
    }
Reply
#3

My script uses IsPlayerInRangeOfPoint
Is this Right?

pawn Код:
if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   You havent logged in yet!");
                return 1;
            }
            if(!IsPlayerInRangeOfPoint(playerid,5.0.0,649.3247,-1353.9393,13.5470))
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not at the SAN building!");
                return 1;
            }
            if(PlayerInfo[playerid][pTut] == 0 || PlayerInfo[playerid][pHospital] == 1)
            {
                return 1;
            }
            if(PlayerInfo[playerid][pAdMuted] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "You are Advertisement Muted, If you think this was unfair, Please /report");
                return 1;
            }
            if(PlayerInfo[playerid][pPnumber] == 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You don't have a cell phone!");
                SendClientMessage(playerid, COLOR_WHITE,"HINT: You can /buy a cell phone from a 24-7.");
                return 1;
            }
            if(PlayerInfo[playerid][pJailed] != 0 || PlayerCuffed[playerid] != 0)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You can't do that at this time!");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[96];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/ad)vertise [advert text]");
                return 1;
            }
            if((!adds) && (PlayerInfo[playerid][pAdmin] < 3))
            {
                format(string, sizeof(string), "   Please try again later %d seconds between Advertisements !",  (addtimer/1000));
                SendClientMessage(playerid, COLOR_GRAD2, string);
                return 1;

            }
            //------------------------------------------------------------------
            //PaNoULiS
            new ip[15];
            if(ipmatch(result, ip))
            {
                format(string, sizeof(string), "AdmCmd: %s was autokicked, reason: Possible server ad.", sendername);
                SendClientMessageToAll(COLOR_RED, string);
                Kick(playerid);
                for(new Order = 0; Order < 600; Order++)
                {
                    SendClientMessageToAll(COLOR_GREY, " ");
                }
                return 1;
            }
            //------------------------------------------------------------------
            new payout = idx * 25;
            if(PlayerInfo[playerid][pCash] < payout)
            {
                format(string, sizeof(string), "* You used %d characters which cost $%d, you don't have enough.", offset, payout);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                return 1;
            }
            PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-payout;
            GivePlayerMoney(playerid, - payout);
            format(string, sizeof(string), "Advertisement: %s, Contact: %s Ph: %d",  result, sendername,PlayerInfo[playerid][pPnumber]);
            OOCNews(TEAM_GROVE_COLOR,string);
            format(string, sizeof(string), "~r~Paid $%d~n~~w~Message contained: %d Characters", payout, idx);
            GameTextForPlayer(playerid, string, 5000, 5);
            if(PlayerInfo[playerid][pAdmin] < 4)
            {
                SetTimer("AddsOn", addtimer, 0);
                adds = 0;
            }
        }
        return 1;
    }
Reply
#4

I guess, although I have to sigh every time I see one of those godfather commands. IsPlayerConnected .. Duh, he is connected? And whoever wrote it was so immensely stupid to copy the whole strtok code into every single command.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)