/car command
#1

(I'm a beginner)
Hey I am making a command /car (engine/lights/hood/trunk)
but when I compile the compiler stops working (doesn't even compile and give errors..)
(pawno compiler library has stopped working)
Please just tell me how to fix, don't write the command in your way, give me a solution! I'm a beginner, and I'm still learning,
pawn Код:
CMD:car(playerid, params[])
{
    new string[12];
    new vehicleid=GetPlayerVehicleID(playerid);
    new engine, lights, hood, trunk, a, d, o;
    GetVehicleParamsEx(vehicleid, engine, lights, a, d, hood, trunk, o);
    if (sscanf(params, "s", string)) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /car [engine / lights / hood / trunk]");
    else if (!strcmp(string, "engine"))
        {
            if (engine == 0)
            SetVehicleParamsEx(vehicleid, 1, lights, a, d, hood, trunk, o);
            else
            SetVehicleParamsEx(vehicleid, 0, lights, a, d, hood, trunk, o);
        }
    else if (!strcmp(string, "lights"))
        {
            if (lights == 0)
            SetVehicleParamsEx(vehicleid, engine, 1, a, d, hood, trunk, o);
            else
            SetVehicleParamsEx(vehicleid, engine, 0, a, d, hood, trunk, o);
         }
    else if (!strcmp(string, "hood"))
        {
            if (hood == 0)
            SetVehicleParamsEx(vehicleid, engine, lights, a, d, 1, trunk, o);
            else
            SetVehicleParamsEx(vehicleid, engine, lights, a, d, 1, trunk, o);
         }
    else if (!strcmp(string, "trunk"))
        {
            if (trunk == 0)
            SetVehicleParamsEx(vehicleid, engine, lights, a, d, hood, 1, o);
            else
            SetVehicleParamsEx(vehicleid, engine, lights, a, d, hood, 0, o);
        }
    return 1;
 }
again: please just give me where the problem is, don't give your command
Reply
#2

any replies?
Reply
#3

Not soure but try to make it like this :
pawn Код:
if (engine == 0)
{ //add this
   SetVehicleParamsEx(vehicleid, 1, lights, a, d, hood, trunk, o);
} // and close this
else
{ //add this
  SetVehicleParamsEx(vehicleid, 0, lights, a, d, hood, trunk, o);
}//close this
Reply
#4

I've said this MANY times.
Don't use sscanf for 1 string.

Remove the sscanf line and put this instead.
pawn Код:
if (isnull(params)) // Send the error message
And then change 'string' to 'params' in the strcmp lines.
Reply
#5

I'm just a beginner , don't blame me -_-
anyway I've tried this
pawn Код:
CMD:say(playerid, params[])
{
    new string;
    if (sscanf(params, "s", string) return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /say [Anything you want to say]");
    else SendClientMessage (playerid, 0xFFFFFFFF, "Hello there!");
    return 1;
}
and it works, as you see I used sscanf for one string (Take it easy I might say ridiculous things since I started learning pawno few days ago :P)
Reply
#6

I don't mean anything, everyone starts from zero. I didn't know anything about scripting when I started.

I'm just saying that it's much better to use params instead of sscanf if you're ONLY USING 1 string.
Can you try what I said before please?
Reply
#7

Actually, the pawno compiler at the beginning was crashing when I compile(says pawno compiler library stopped working...) But Surprisingly it's now compiling and giving me the errors, It's okay I'll fix the errors
and thanks for the information, I'll try using the "isnull" thanks +rep
Reply
#8

What's meant by "Tag Mismatch"? last warning left; I updated the post, it's now okay, but it has just the tag mismatch warning, can you tell me what it is so I can fix it?
Reply
#9

Fixed it thanks
maybe I should rep+ myself :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)