Problem passing command
#1

I tried to pass the order on zcmd but it gives me error
Код HTML:
(22013) : error 017: undefined symbol "idx"
(22015) : error 017: undefined symbol "idx"
(22015) : warning 215: expression has no effect
(22017) : error 017: undefined symbol "idx"
(22019) : error 017: undefined symbol "idx"
(22021) : error 017: undefined symbol "idx"
(22022) : error 017: undefined symbol "idx"
(22022) : warning 215: expression has no effect
(22024) : error 017: undefined symbol "idx"
(22033) : error 017: undefined symbol "string"
(22033) : error 017: undefined symbol "string"
(22033) : error 029: invalid expression, assumed zero
(22033) : fatal error 107: too many error messages on one line
I have added new idx; but all crashes

Код HTML:
CMD:ad( playerid, params [ ] )
{
	new
        sendername[25];
  if(IsPlayerConnected(playerid))
  {
    if(P_DATA[playerid][pMuted] >= 1)
    {
      SendClientMessage(playerid, TEAM_CYAN_COLOR, "Nu poti da un /ad, ai mute!");
      return 1;
    }
    if(gPlayerLogged[playerid] == 0)
    {
      SendClientMessage(playerid, COLOR_GREY, "** Nu esti logat inca !");
      return 1;
    }
    if(P_DATA[playerid][pLevel] < 2)
    {
      SendClientMessage(playerid, COLOR_GREY, "** Iti trebuie minim level 2 !");
      return 1;
    }
    if(!PlayerToPoint(3.0, playerid, SBizzInfo[7][sbEntranceX], SBizzInfo[7][sbEntranceY], SBizzInfo[7][sbEntranceZ]) && !PlayerToPoint(3.0, playerid, SBizzInfo[8][sbEntranceX], SBizzInfo[8][sbEntranceY], SBizzInfo[8][sbEntranceZ]))
    {
      SendClientMessage(playerid, COLOR_GREY, "** Nu esti la sediul CNN.");
      return 1;
    }
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(params);
    while ((idx < length) && (params[idx] <= ' '))
    {
      idx++;
    }
    new offset = idx;
    new result[164];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
      result[idx - offset] = params[idx];
      idx++;
    }
    result[idx - offset] = EOS;
    result[0] = toupper(result[0]);
    if(!strlen(result))
    {
      SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /ad [text]");
      return 1;
    }
    if (AdTimer[playerid] > 0)
    {
      format(string, sizeof(string), "** Asteapta %d secunde inainte de a mai plasa un anunt !",  (addtimerls/1000));
      SendClientMessage(playerid, COLOR_GRAD2, string);
      return 1;
    }
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "{0066FF}AD: {FFFFFF}Nu poti plasa un anunt dintr-un vehicul!");

         for(new i; i < sizeof(TLD); i++)
         {
             if(strfind(result, TLD[i], true) != -1)
             {
                    new reclama2[MAX_PLAYER_NAME];
               GetPlayerName(playerid, reclama2, sizeof(reclama2));
                 SendClientMessage(playerid, COLOR_RED, "{0066FF}Reclama: {FFFFFF}Nu face reclama!");
                 format(string, 256, "{0066FF}Warnings: {FF0000}%s {FFFFFF}a incercat sa faca reclama. {0066FF}Mesaj : {FFFFFF}%s .", reclama2, result);
               ABroadCast(COLOR_YELLOW,string,1);
                 return 0;
             }

         }
            if(GoIP(result))
         {
            new reclama[MAX_PLAYER_NAME];
            GetPlayerName(playerid, reclama, sizeof(reclama));
            SendClientMessage(playerid, 0xFF0000FF, "{0066FF}Reclama: {FFFFFF}Nu face reclama!");
            format(string, 256, "{0066FF}Warnings: {FF0000}%s {FFFFFF}a incercat sa faca reclama. {0066FF}Mesaj : {FFFFFF}%s .", reclama, result);
            ABroadCast(COLOR_YELLOW,string,1);
            return 0;
         }
         if(PlayerToPoint(3.0,playerid,SBizzInfo[7][sbEntranceX], SBizzInfo[7][sbEntranceY], SBizzInfo[7][sbEntranceZ]) || PlayerToPoint(3.0,playerid,SBizzInfo[8][sbEntranceX], SBizzInfo[8][sbEntranceY], SBizzInfo[8][sbEntranceZ]))
         {
             new payout;
            if(PlayerToPoint(3.0,playerid,SBizzInfo[8][sbEntranceX], SBizzInfo[8][sbEntranceY], SBizzInfo[8][sbEntranceZ])) payout = idx * SBizzInfo[8][sbEntranceCost]; else payout = idx * SBizzInfo[7][sbEntranceCost];
            if(GetPlayerCash(playerid) < payout)
              {
                  format(string, sizeof(string), "** Ai folosit %d caractere costand $%s, si nu detii aceasta suma.", offset, FormatNumber(payout));
                  SendClientMessage(playerid, COLOR_WHITE, string);
                  return 1;
              }
            GivePlayerMoneyEx(playerid, - payout);
            if(PlayerToPoint(3.0,playerid,SBizzInfo[7][sbEntranceX], SBizzInfo[7][sbEntranceY], SBizzInfo[7][sbEntranceZ]))
            {
               SBizzInfo[7][sbTill] += payout;
                ExtortionSBiz(7, payout);
             }
             if(PlayerToPoint(3.0,playerid,SBizzInfo[8][sbEntranceX], SBizzInfo[8][sbEntranceY], SBizzInfo[8][sbEntranceZ]))
            {
               SBizzInfo[8][sbTill] += payout;
                ExtortionSBiz(8, payout);
             }

			for(new x = 0; x < sizeof(AdList); x++) {
				if(!strlen(AdList[x])) {
					new string[40];
					format(AdList[x], 200, "Advertisement placed by %s (Phone: {FFFFFF}%d{00D900}): %s", sendername, P_DATA[playerid][pPnumber], (result));
					format(string, sizeof(string), "~r~-~g~$~r~%s", FormatNumber(strlen(result)*SBizzInfo[1][sbEntranceCost]));
					GameTextForPlayer(playerid, string, 5000, 5);
					SendClientMessage(playerid,COLOR_WHITE,"{C90000}Advertisement: {FFFFFF}Your ad has been added to the list. An ad is sent every 10 seconds!");
					SBizzInfo[1][sbTill] += strlen(result)*SBizzInfo[1][sbEntranceCost];
					SBizzInfo[1][sbProducts]--;
					format(string,sizeof(string),"UPDATE sbizz SET `Till`='%d',`Products`='%d' WHERE `ID`='1'",SBizzInfo[1][sbTill],SBizzInfo[1][sbProducts]);
					mysql_query(SQL,string);
					AdTimer[playerid] = 1;
					return 1;
				}
			}
			SendClientMessage(playerid, -1, "Error: Message queue is full!");
          }
      }
      return 1;
}
Reply
#2

Declare the variable and compile the code -d3 flag.Let the crash happen and post the log here.
Reply
#3

Dude, why are you even trying to mix the old OnPlayerCommandText way into zcmd, simply do
Код:
    if (isnull(params))
        SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /ad [text]");
and remove all of your other stuff.
Reply
#4

The script is obviously too old since it uses strtok, PlayerToPoint etc.

Use sscanf for splitting parameters or isnull+params as GoldenLion suggested for a single string and IsPlayerInRangeOfPoint (a native function since 0.3a). While you're at it, remove the IsPlayerConnected check as this issue has been fixed many years ago.
Reply
#5

Quote:
Originally Posted by Sreyas
Посмотреть сообщение
Declare the variable and compile the code -d3 flag.Let the crash happen and post the log here.
not crash just eror on complie
(22013) : error 017: undefined symbol "idx"
(22015) : error 017: undefined symbol "idx"
(22015) : warning 215: expression has no effect
(22017) : error 017: undefined symbol "idx"
(22019) : error 017: undefined symbol "idx"
(22021) : error 017: undefined symbol "idx"
(22022) : error 017: undefined symbol "idx"
(22022) : warning 215: expression has no effect
(22024) : error 017: undefined symbol "idx"
(22033) : error 017: undefined symbol "string"
(22033) : error 017: undefined symbol "string"
(22033) : error 029: invalid expression, assumed zero
(22033) : fatal error 107: too many error messages on one line
i try add new idx; but fail...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)