SA-MP Forums Archive
Loading a vehicle - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Loading a vehicle (/showthread.php?tid=261493)



Loading a vehicle - futuretrucker - 13.06.2011

Hey guys Im making a vehicle system and when I compile I get these errors. Anyone know whats wrong?
Код:
C:\Users\zack\Desktop\SAMP03CSVR_WIN32 (1)\gamemodes\MYSQLgm.pwn(401) : error 035: argument type mismatch (argument 1)
C:\Users\zack\Desktop\SAMP03CSVR_WIN32 (1)\gamemodes\MYSQLgm.pwn(402) : error 035: argument type mismatch (argument 1)
C:\Users\zack\Desktop\SAMP03CSVR_WIN32 (1)\gamemodes\MYSQLgm.pwn(465) : warning 217: loose indentation
pawn Код:
stock LoadCars(playerid)
{
    new query[100], stats[1000], Type[100],ID[100],Owner[100],X[100],Y[100],Z[100],A[25],R[25],C1[5],C2[5];
    format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE `Owner` = '%s'", Name(playerid));
    mysql_query(query);
    mysql_store_result();
    if(mysql_num_rows())
    {
        if(mysql_fetch_row_format(stats))
        {
            sscanf(stats, "p<|>ds[100]dddddddd", SetPVarString(playerid, "ID", stats), SetPVarString(playerid, "Owner", stats), SetPVarString(playerid, "X", stats),SetPVarString(playerid, "Y", stats),SetPVarString(playerid, "Z", stats),SetPVarString(playerid, "A", stats),SetPVarString(playerid, "R", stats),SetPVarString(playerid, "C1", stats),SetPVarString(playerid, "C2", stats),SetPVarString(playerid, "Type", stats));
            GetPVarString(playerid, "Type", Type, sizeof(Type));
            GetPVarString(playerid, "ID", ID, sizeof(ID));
            GetPVarString(playerid, "Owner", Owner, sizeof(Owner));
            GetPVarString(playerid, "X", X, sizeof(X));
            GetPVarString(playerid, "Y", Y, sizeof(Y));
            GetPVarString(playerid, "Z", Z, sizeof(Z));
            GetPVarString(playerid, "A", A, sizeof(A));
            GetPVarString(playerid, "R", R, sizeof(R));
            GetPVarString(playerid, "C1", C1, sizeof(C1));
            GetPVarString(playerid, "C2", C2, sizeof(C2));
            CreateVehicle(Type,X,Y,Z,R,C1,C2,60000);
            Attach3DTextLabelToVehicle(Vehicle,ID,0,10,0);
        }
    }
}



Re: Loading a vehicle - Donya - 13.06.2011

well u didnt specific the lines but it looks like
pawn Код:
CreateVehicle(strval(Type), X, Y, Z, R, C1, C2, 60000);
            Attach3DTextLabelToVehicle(Vehicle, strval(ID), 0, 10, 0);
i also suggest

pawn Код:
new query[96], stats[256], Type[12],ID[12],Owner[24],X[16],Y[16],Z[16],A[25],R[25],C1[5],C2[5];



Re: Loading a vehicle - futuretrucker - 13.06.2011

The 2 problem lines
pawn Код:
CreateVehicle(Type, X, Y, Z, R, C1, C2, 60000);
            Attach3DTextLabelToVehicle(Vehicle,ID,0,10,0);



Re: Loading a vehicle - randomkid88 - 14.06.2011

There are several things wrong here.

First, all your variables are defined as strings. Then in your sscanf line, you use integers for all of them except the string. THEN, you use GetPVarString for all of them. This is where your "argument type mismatch" errors are coming from.

Second, you are then trying to use these strings for Float values (position) and Integers (model, colors).


Re: Loading a vehicle - Donya - 14.06.2011

urgh you are so hardened

also what the heck is A if R is the angle?

pawn Код:
stock LoadCars(playerid)
{
    new query[96], stats[256], Type, id, Owner[24], Float:x, Float:y, Float:z, Float:A, Float:R, Color1, Color2[5];
    format(query, sizeof(query), "SELECT * FROM `vehicles` WHERE `Owner` = '%s'", Name(playerid));
    mysql_query(query);
    mysql_store_result();
    if(mysql_num_rows())
    {
        if(mysql_fetch_row_format(stats))
        {
            sscanf(stats, "p<|>ds[24]fffffddd", id, Owner, x, y, z, A, R, Color1, Color2, Type);
            SetPVarInt(playerid, "ID", id);
            SetPVarString(playerid, "Owner", Owner);
            SetPVarFloat(playerid, "X", x);
            SetPVarFloat(playerid, "Y", y);
            SetPVarFloat(playerid, "Z", z);
            SetPVarFloat(playerid, "A", A);
            SetPVarFloat(playerid, "R", R);
            SetPVarInt(playerid, "C1", Color1);
            SetPVarInt(playerid, "C2", Color2);
            SetPVarInt(playerid, "Type", Type);
            CreateVehicle(Type, x, y, z, R, Color1, Color2, 60000);
            Attach3DTextLabelToVehicle(Vehicle, id, 0, 10, 0);
        }
    }
}