need help with this code
#1

well the title says it all here you go

pawn Код:
stock CreatePlate(vehicleid)
{
    topofcreateplate:
    new pstring[128];
    format(pstring,sizeof(pstring),"%s",RandomizePlate(vehicleid));
    if(PlateExist(pstring))
    {
        goto topofcreateplate;
    }
    SetVehicleNumberPlate(vehicleid,pstring);
    format(existplate[existplatecount],sizeof(existplate),"%s",pstring);
    existplatecount ++;
    return pstring;
}
stock PlateExist(platestring)
{
    for(new count;count < existplatecount;count++)
    {
        if(strcmp(existplate[count],platestring,true,7)==0)
        {
            return true;
        }
    }
    return false;
}
stock RandomizePlate(vehicleid)
{
    new platestring[128];
    for(new platecount;platecount < 7;platecount++)
    {
        if((platecount)==3)
        {
            new addplatestring[128];
            format(addplatestring,sizeof(addplatestring),"%s",platestring);
            format(platestring,sizeof(platestring),"%s ",addplatestring);
            continue;
        }
        new rand = random(1);
        if((rand)==0)
        {
            rand = random(9);
            if(isnull(platestring))
            {
                format(platestring,sizeof(platestring),"%i",rand);
            }
            else
            {
                new addplatestring[128];
                format(addplatestring,sizeof(addplatestring),"%s",platestring);
                format(platestring,sizeof(platestring),"%s%i",addplatestring,rand);
            }
        }
        else if((rand)==1)
        {
            rand = random(25);
            if(isnull(platestring))
            {
                format(platestring,sizeof(platestring),"%c",randomletters[rand]);
            }
            else
            {
                new addplatestring[128];
                format(addplatestring,sizeof(addplatestring),"%s",platestring);
                format(platestring,sizeof(platestring),"%s%c",addplatestring,randomletters[rand]);
            }
        }
    }
    return platestring;
}
some error code
Код:
C:\Users\joshua\Desktop\sampserver\filterscripts\jbcars.pwn(6206) : error 035: argument type mismatch (argument 1)
C:\Users\joshua\Desktop\sampserver\filterscripts\jbcars.pwn(6219) : error 035: argument type mismatch (argument 2)
C:\Users\joshua\Desktop\sampserver\filterscripts\jbcars.pwn(6215) : warning 203: symbol is never used: "platestring"
C:\Users\joshua\Desktop\sampserver\filterscripts\jbcars.pwn(6226) : warning 203: symbol is never used: "vehicleid"
C:\Users\joshua\Desktop\sampserver\filterscripts\jbcars.pwn(8626) : warning 203: symbol is never used: "carlisenceplate"
Reply
#2

How are we meant to know which lines the errors are on..?
Reply
#3

first,
Код:
stock PlateExist(platestring)
platestring should be an array:
Код:
stock PlateExist(platestring[])
Reply
#4

Quote:
Originally Posted by Scottas
Посмотреть сообщение
first,
Код:
stock PlateExist(platestring)
platestring should be an array:
Код:
stock PlateExist(platestring[])
Thanks
Reply
#5

Don't use goto! My god. Never heard of do-while loops, have you?

pawn Код:
new pstring[128];

    do format(pstring,sizeof(pstring),"%s",RandomizePlate(vehicleid));
    while(PlateExist(pstring));

    SetVehicleNumberPlate(vehicleid,pstring);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)