SA-MP Forums Archive
Errores - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Errores (/showthread.php?tid=602017)



Errores - marcos04 - 01.03.2016

El siguiente codigo me da errores.

pawn Код:
CMD:v(playerid,params[])
{
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"Ya tienes un vehiculo. Baja e intenta de nuevo.");
new id;
new vehiculo;
if(sscanf(params,"i",id)) return SendClientMessage(playerid,COLOR_RED,"USO: /v [Nombre del vehiculo o ID");
if(!IsNumeric(id))
{
vehiculo = GetVehicleModelIDFromName(id);
}


return 1;
}
pawn Код:
error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
Definicion de las funciones:
pawn Код:
stock GetVehicleModelIDFromName(vname[])
{
    for(new i = 0; i < 211; i++)
    {
        if ( strfind(VehicleNames[i], vname, true) != -1 )
            return i + 400;
    }
    return -1;
}
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}



Respuesta: Errores - KEAVELBIN - 01.03.2016

Pero pasa las lineas exactamente en donde te da el error.


Respuesta: Errores - GranaT3 - 01.03.2016

ignorar mensaje. Post equivocado


Respuesta: Errores - marcos04 - 01.03.2016

pawn Код:
if(!IsNumeric(id))
{
vehiculo = GetVehicleModelIDFromName(id);
}



Respuesta: Errores - Juance - 01.03.2016

Es porque en la funciуn estбs indicando que vname sea un string, y luego en el comando estбs pasando un entero sobre la funciуn. Crea una variable que sea tipo string en el comando y luego usala en el sscanf tambiйn.

pawn Код:
new var[20];

if(sscanf(params,"s[20]",var)) return SendClientMessage(playerid,COLOR_RED,"USO: /v [Nombre del vehiculo o ID");
Y luego llamas a la funciуn con esa variable.

pawn Код:
vehiculo = GetVehicleModelIDFromName(var);