Little help here.
#21

Quote:
Originally Posted by jaksimaksi
Посмотреть сообщение
Now with armour i need to do like that?

pawn Код:
else if(!strcmp(action,"store armour"))
No.. there's an action which would be store/get.. and so that's the first one, then the second one is storewhat e.g. armour and then amount.. so there's 3 different "strcmps" you need, which are: "action" "storewhat" "amount" and I'm not sure how to do that.
Reply
#22

I want to make /trunk store armour, but script works like /trunk armour...

pawn Код:
else if(!strcmp(action,"store"))
{
SendClientMessage( playerid, 0x008700FF, "Store [weapon/armour]" );
}
else if(!strcmp(storewhat,"armour"))
{
SendClientMessage( playerid, 0x008700FF, "armour" );
SetPlayerArmour(playerid, 0);
}
Reply
#23

amm... anybody?
Reply
#24

hello?
Reply
#25

pawn Код:
if(strcmp(cmd, "/trunk", true) == 0)
    {
        if(gPlayerHasCar[playerid] == 0) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"u dont have vehicle keys");
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, -1, ""#COL_GREY"[usage]: "#COL_WHITE"/trunk open / close / store / take");
            return 1;
        }
        if(strcmp(tmp, "open", true) == 0)
        {
            if(TrunkOpen[Vehicle[playerid]] == 1) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"trunk is already opened");
            new engine, lights, alarm, doors, bonnet, boot, objective;
            GetVehicleParamsEx(Vehicle[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
            SetVehicleParamsEx(Vehicle[playerid], engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
            TrunkOpen[Vehicle[playerid]] = 1;
            return 1;
        }
        else if(strcmp(tmp, "store", true) == 0)
        {
            if(TrunkOpen[Vehicle[playerid]] == 0) { SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"open trunk first"); return 1; };
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { SendClientMessage(playerid, -1, ""#COL_GREY"[usage]: "#COL_WHITE"/trunk store armour amount of armour / weapon ... .. . .. . ."); return 1; }
            if(strcmp(tmp, "armour", true) == 0)
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, -1, ""#COL_GREY"[usage]: "#COL_WHITE"/trunk open / close / store / take");
                    return 1;
                }
                new amount = strval(tmp);
                // continue here
            }
        }
        return 1;
    }
Reply
#26

Thank you sir, but now i'm using DCMD. Ive tryed to do it on DCMD:

pawn Код:
}
else if(!strcmp(action,"store"))
{
//if(TrunkOpen[Vehicle[playerid]] == 0) { SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"open trunk first"); return 1; };
SendClientMessage( playerid, 0x008700FF, "store" );
new tmp[128],idx;
tmp = strtok(params, idx);
if(!strlen(tmp)) { SendClientMessage(playerid, -1, ""#COL_GREY"[usage]: "#COL_WHITE"/trunk store armour amount of armour / weapon ... .. . .. . ."); return 1; }
if(strcmp(tmp, "armour", true) == 0)
{
SendClientMessage( playerid, 0x008700FF, "armour" );
SetPlayerArmour(playerid,0);
}
}
return 1;
}
But works only /trunk store. /trunk store armour not.
Reply
#27

pawn Код:
dcmd_trunk(playerid, params[])
{
    new tmp[128], idx;
    if(gPlayerHasCar[playerid] == 0) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"u dont have vehicle keys");
    tmp = strtok(params, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, -1, ""#COL_GREY"[usage]: "#COL_WHITE"/trunk open / close / store / take");
        return 1;
    }
    if(strcmp(tmp, "open", true) == 0)
    {
        if(TrunkOpen[Vehicle[playerid]] == 1) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"trunk is already opened");
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(Vehicle[playerid], engine, lights, alarm, doors, bonnet, boot, objective);
        SetVehicleParamsEx(Vehicle[playerid], engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
        TrunkOpen[Vehicle[playerid]] = 1;
        return 1;
    }
    else if(strcmp(tmp, "store", true) == 0)
    {
        if(TrunkOpen[Vehicle[playerid]] == 0) { SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"open trunk first"); return 1; };
        tmp = strtok(params, idx);
        if(!strlen(tmp)) { SendClientMessage(playerid, -1, ""#COL_GREY"[usage]: "#COL_WHITE"/trunk store armour amount of armour / weapon ... .. . .. . ."); return 1; }
        if(strcmp(tmp, "armour", true) == 0)
        {
            tmp = strtok(params, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, -1, ""#COL_GREY"[usage]: "#COL_WHITE"/trunk open / close / store / take");
                return 1;
            }
            new amount = strval(tmp);
            // continue here
        }
    }
    return 1;
}
Reply
#28

pawn Код:
tmp = strtok(params, idx);
- error 047: array sizes do not match, or destination array is too small

pawn Код:
if(TrunkOpen[Vehicle[playerid]] == 0) { SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"open trunk first"); return 1; };
- error 036: empty statement

pawn Код:
tmp = strtok(params, idx);
- array sizes do not match, or destination array is too small
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)