Errors with plates..
#1

Not sure what's wrong,c an anyone help?

pawn Код:
if(strcmp(cmd, "/plate", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!IsAtDealership(playerid))
            {
                return 1;
            }
            if(!strlen(tmp))
            {
            if(PlayerToPoint(3.0, playerid,2130.7195,-1147.0983,24.3918))
            new length = strlen(cmdtext);  // 24559
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[128];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            idx++;
            if(!strlen(result)) return SendClientMessage(playerid, COLOR_GREY, "USE: {AA3333}/plate{AFAFAF} [plate number]");
            SetVehicleNumberPlate(GetPlayerVehicleID(playerid), result);
        } //24575
        return 1;
    }
}
Код:
(24559) : error 003: declaration of a local variable must appear in a compound block
(24559) : error 017: undefined symbol "length"
(24560) : error 017: undefined symbol "length"
(24566) : error 017: undefined symbol "length""
Reply
#2

Well the error for line 24575 is pretty simple to fix. Add a ; at the end of line 24574, you forgot it
Reply
#3

SetVehicleNumberPlate(GetPlayerVehicleID(playerid) , result);// <
and you need to have made a variable called length, ie: new length;
Reply
#4

pawn Код:
new length = strlen(cmdtext);  // 24559
I did
Reply
#5

use dcmd insteas strcmp... Looks how is that easier ( I use this command on my server):
pawn Код:
dcmd_plate(playerid,params[])
{
   
   new ID = GetPlayerVehicleID(playerid);
   new string[128];
   if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, azul, "You're not in a vehicle");
   if(!strlen(params)) return SendClientMessage(playerid, azul, "Usage: /plate <number/name>");
   else
   {
       SetVehicleNumberPlate(ID, params);
       SetVehicleToRespawn(ID);
       format(string,sizeof(string),"{F216FA}You've changed your{00EEFF} VehicleID: {D9FA00}%d {FAD900}plate's for: {00FF88}%s",GetVehicleModel(ID),params);
       SendClientMessage(playerid, vermelho, string);
       PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
   }
   return 1;
}
on OnPlayerCommandText add the line:
pawn Код:
dcmd(plate,5,cmdtext);
Reply
#6

pawn Код:
if(strcmp(cmd, "/plate", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!IsAtDealership(playerid))
            {
                return 1;
            }
            if(!strlen(tmp))
            {
            if(PlayerToPoint(3.0, playerid,2130.7195,-1147.0983,24.3918)) //You're using if
            new length = strlen(cmdtext); //But not adding a bracket! (' { ')
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[128];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            idx++;
            if(!strlen(result)) return SendClientMessage(playerid, COLOR_GREY, "USE: {AA3333}/plate{AFAFAF} [plate number]");
            SetVehicleNumberPlate(GetPlayerVehicleID(playerid), result);
        } //24575
        return 1;
    }
}
So:

pawn Код:
if(blabla)
{
  morebla();
}
return;
Reply
#7

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/plate", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!IsAtDealership(playerid))
            {
                return 1;
            }
            if(!strlen(tmp))
            {
            if(PlayerToPoint(3.0, playerid,2130.7195,-1147.0983,24.3918)) //You're using if
            new length = strlen(cmdtext); //But not adding a bracket! (' { ')
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[128];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            idx++;
            if(!strlen(result)) return SendClientMessage(playerid, COLOR_GREY, "USE: {AA3333}/plate{AFAFAF} [plate number]");
            SetVehicleNumberPlate(GetPlayerVehicleID(playerid), result);
        } //24575
        return 1;
    }
}
So:

pawn Код:
if(blabla)
{
  morebla();
}
return;
Undefined symbol length about three times, if you fix that I'm going to add price maybe $2000 to change your license plates.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)