Jump to content
  • 0

Problema adaugare timer pe /ad


J.Yolo

Question

Nick: J.Yolo

Problema: Nu are treaba ca imi da vreo eroare, dar am nevoie de ajutor ca nu stiu cum sa pun un timer pe comanda. Adica, dupa ce dai /ad cu anuntul tau, sa apara mai intai adminilor si helperilor si mai apoi dupa un minut sa apara si celorlalti playeri.

Erori / warnings: -

Lini/script: -

Ai incercat sa rezolvi singur ?: Da. Am cautat pe net, dar nu am gasit. Inca invat cu scriptingul.

Asta e comanda:

[list type=decimal]

[*] if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)

{

    if(IsPlayerConnected(playerid))

    if(PlayerToPoint(2.0,playerid,648.340087,-1357.425415,13.571000))

    {

        if(PlayerInfo[playerid][pLevel] < 2)

        {

        SendClientMessage(playerid, COLOR_GREY, "You need level 2 to use this !");

            return 1;

        }

        if(PlayerInfo[playerid][pMuted] == 1)

{

SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced/disabled");

return 1;

}

        if(gPlayerLogged[playerid] == 0)

        {

            SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet !");

            return 1;

        }

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_GREY, "Type: (/ad)vertise [advert text]");

return 1;

}

if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))

{

format(string, sizeof(string), "Incearca  peste %d secunde, au fost trimise alte advertismente inainte !",  (addtimer/1000));

SendClientMessage(playerid, COLOR_GRAD2, string);

return 1;

}

new payout = idx * 25;

if(PlayerInfo[playerid][pCash] < payout)

        {

            format(string, sizeof(string), "* You used %d characters which cost %d Lei, you don't have enough.", offset, payout);

            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

            return 1;

        }

            GivePlayerCash(playerid, -payout);

SBizzInfo[7][sbTill] += payout;

ExtortionSBiz(7, payout);

            SBizzInfo[7][sbProducts]--;

format(string, sizeof(string), "{2BC700}Anunt: %s, {F2EE00}By: %s Tel: %d",  result, sendername,PlayerInfo[playerid][pPnumber]);

SendClientMessageToAll(COLOR_WHITE, string);

format(string, sizeof(string), "~r~Paid %d Lei~n~~w~Message contained: %d Characters", payout, idx);

NextAd[playerid] = 0;

GameTextForPlayer(playerid, string, 5000, 5);

if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}

}

else if(PlayerToPoint(2.0,playerid, 2368.9646,2121.4871,10.8401))

{

        if(PlayerInfo[playerid][pLevel] < 2)

        {

        SendClientMessage(playerid, COLOR_GREY, "You need level 2 to use this !");

            return 1;

        }

        if(PlayerInfo[playerid][pMuted] == 1)

{

SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced/disabled");

return 1;

}

        if(gPlayerLogged[playerid] == 0)

        {

            SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet !");

            return 1;

        }

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_GREY, "Type: (/ad)vertise [advert text]");

return 1;

}

if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))

{

format(string, sizeof(string), "Incearca  peste %d secunde, au fost trimise alte advertismente inainte !",  (addtimer/1000));

SendClientMessage(playerid, COLOR_GRAD2, string);

return 1;

}

new payout = idx * 25;

if(PlayerInfo[playerid][pCash] < payout)

        {

            format(string, sizeof(string), "* You used %d characters which cost %d Lei, you don't have enough.", offset, payout);

            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

            return 1;

        }

GivePlayerCash(playerid, -payout);

SBizzInfo[13][sbTill] += payout;

ExtortionSBiz(13, payout);

            SBizzInfo[13][sbProducts]--;

            NextAd[playerid] = 0;

format(string, sizeof(string), "{2BC700}Anunt: %s, {F2EE00}By: %s Tel: %d",  result, sendername,PlayerInfo[playerid][pPnumber]);

            SendClientMessageToAll(COLOR_WHITE, string);

format(string, sizeof(string), "~r~Paid %d Lei~n~~w~Message contained: %d Characters", payout, idx);

GameTextForPlayer(playerid, string, 5000, 5);

if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}

}

else

{

SCM(playerid,COLOR_LIGHTRED,"Nu esti la agentie de anunturi.");

}

return 1;

}

[*]

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

[pawn]if(strcmp(cmd, "/advertise", true) == 0 || strcmp(cmd, "/ad", true) == 0)

  {

      if(IsPlayerConnected(playerid))

      if(PlayerToPoint(2.0,playerid,648.340087,-1357.425415,13.571000))

      {

          if(PlayerInfo[playerid][pLevel] < 2)

          {

              SendClientMessage(playerid, COLOR_GREY, "You need level 2 to use this !");

              return 1;

          }

          if(PlayerInfo[playerid][pMuted] == 1)

        {

            SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced/disabled");

            return 1;

        }

          if(gPlayerLogged[playerid] == 0)

          {

              SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet !");

              return 1;

          }

        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_GREY, "Type: (/ad)vertise [advert text]");

            return 1;

        }

        if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))

        {

            format(string, sizeof(string), "Incearca  peste %d secunde, au fost trimise alte advertismente inainte !",  (addtimer/1000));

            SendClientMessage(playerid, COLOR_GRAD2, string);

            return 1;

        }

        new payout = idx * 25;

        if(PlayerInfo[playerid][pCash] < payout)

          {

              format(string, sizeof(string), "* You used %d characters which cost %d Lei, you don't have enough.", offset, payout);

              SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

              return 1;

          }

            GivePlayerCash(playerid, -payout);

        SBizzInfo[7][sbTill] += payout;

        ExtortionSBiz(7, payout);

            SBizzInfo[7][sbProducts]--;

        format(string, sizeof(string), "{2BC700}Anunt: %s, {F2EE00}By: %s Tel: %d",  result, sendername,PlayerInfo[playerid][pPnumber]);

        SendClientMessageToAll(COLOR_WHITE, string);

        format(string, sizeof(string), "~r~Paid %d Lei~n~~w~Message contained: %d Characters", payout, idx);

        NextAd[playerid] = 0;

        GameTextForPlayer(playerid, string, 5000, 5);

        if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}

      }

      else if(PlayerToPoint(2.0,playerid, 2368.9646,2121.4871,10.8401))

      {

          if(PlayerInfo[playerid][pLevel] < 2)

          {

              SendClientMessage(playerid, COLOR_GREY, "You need level 2 to use this !");

              return 1;

          }

          if(PlayerInfo[playerid][pMuted] == 1)

        {

            SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced/disabled");

            return 1;

        }

          if(gPlayerLogged[playerid] == 0)

          {

              SendClientMessage(playerid, COLOR_GREY, "You havent logged in yet !");

              return 1;

          }

        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_GREY, "Type: (/ad)vertise [advert text]");

            return 1;

        }

        if ((!adds) && (PlayerInfo[playerid][pAdmin] >= 1))

        {

            format(string, sizeof(string), "Incearca  peste %d secunde, au fost trimise alte advertismente inainte !",  (addtimer/1000));

            SendClientMessage(playerid, COLOR_GRAD2, string);

            return 1;

        }

        new payout = idx * 25;

        if(PlayerInfo[playerid][pCash] < payout)

          {

              format(string, sizeof(string), "* You used %d characters which cost %d Lei, you don't have enough.", offset, payout);

              SendClientMessage(playerid, COLOR_LIGHTBLUE, string);

              return 1;

          }

        GivePlayerCash(playerid, -payout);

        SBizzInfo[13][sbTill] += payout;

        ExtortionSBiz(13, payout);

            SBizzInfo[13][sbProducts]--;

            NextAd[playerid] = 0;

        format(string, sizeof(string), "{2BC700}Anunt: %s, {F2EE00}By: %s Tel: %d",  result, sendername,PlayerInfo[playerid][pPnumber]);

            SendClientMessageToAll(COLOR_WHITE, string);

        format(string, sizeof(string), "~r~Paid %d Lei~n~~w~Message contained: %d Characters", payout, idx);

        GameTextForPlayer(playerid, string, 5000, 5);

        if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;}

      }

      else

      {

        SCM(playerid,COLOR_LIGHTRED,"Nu esti la agentie de anunturi.");

      }

      return 1;

  }[/pawn]

Link to comment
Share on other sites

Topic inchis , 48h fara reply.

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.