STRFIND issues
#1

What I want it to do: Get it to send the client what model (name) car they are in.

Errors i have:
Код:
(32761) : error 035: argument type mismatch (argument 2)
(32755) : warning 204: symbol is assigned a value that is never used: "Model"
And the argument type mismatch is for the strfind line, it looks for the model of the car, that goes with its name. Its looking for the VehID of the car that the player is in, then it gets the modelID from the VehID it just gave.
pawn Код:
new VehiID = GetPlayerVehicleID( playerid );       
new Model = GetVehicleModel( VehiID );
error 035: argument type mismatch (argument 2)
Line:
pawn Код:
if(strfind(VehicleNames[i], Model, true) != -1)
If you are wondering what VehicleNames[i] is :
pawn Код:
new VehicleNames[ 212 ][] =
{
    "400 - Landstalker",   "401 - Bravura",   "402 - Buffalo",   "403 - Linerunner",
It goes on for all the vehicles.


Here is the full code:
pawn Код:
new string[ 128 ], Model;
        new VehiID = GetPlayerVehicleID( playerid );       
        new Model = GetVehicleModel( VehiID );//32755
       
        SendClientMessage(playerid, WHITE, "CAR!"); // just to prove that its actually working, and the vehname thing isnt
       
        for(new i; i < sizeof(VehicleNames); i++)
        {
            if(strfind(VehicleNames[i], Model, true) != -1) //32761
            {

                format( string, sizeof( string), "%d", VehicleNames[i]);
                SendClientMessage(playerid, COLOR_ORANGE, string);
            }
        }
I have checked the wiki for strfind, but it doesnt help at all.
Thanks : )
Reply
#2

Quote:
Originally Posted by Christian_Larrabure
Посмотреть сообщение
Model but the MODEL ID, in strfind you find a string in another string.
strfind(stringtofind, stringtosearch...
so you are saying that i have them (strings) backwards?
Reply
#3

error 035: argument type mismatch (argument 1)
on
pawn Код:
if(strfind(ModelID(playerid), VehicleNames[i], false) != -1)
I made a public for ModelID, it returns the model number back. ( i made it b/c ima use it often in this sys)
Reply
#4

Quote:
Originally Posted by Christian_Larrabure
Посмотреть сообщение
If i understand correctly you are searching

VehicleNames[i] in Model
So basically fx. let's say model id 201 is Sultan
You are searching the word "Sultan" in the number 201. that sends ovbiously a error. i will give you a example of strfind:

pawn Код:
new playername[128];
GetPlayerName(playerid, playername, sizeof(playername));
if(strfind("_", playername, true) != -1)
{
    return 0;
}
Fx. if the name of the user is Matthew_Larrabure
it will search "_" in "Mathew_Larrabure" and return the POSITION of the
_ thing.
If you need live help you can add me on msn.

Best Regard,

Christian
But what if i want to seach ModelID(playerid) in VehicleName , it returns the model but i get an error still.
how would that look

and my vehicle names, each one is like this "ID - NAME" so its all in one thing, so it would return ex: "560 - Sultan"
Reply
#5

Its [pawn] Not [pawno]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)