Little help here.
#1

Hello.

I'm trying to make a trunk system. I made that you can open trunk with /trunk open, but now I want to make /trunk store armour [amount of armour]. How can i make that 3'nd word? Armour saving ill do my selft, just need help with how to make armour [amount of armour]
Sorry for poor english.





pawn Код:
new idx, tmp[128], cmd[128];
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmd, "/trunk", true) == 0)
    {
        if(gPlayerHasCar[playerid] == 0) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"u dont have vehicle keys");
        new x_nr[256];
        x_nr = strtok(cmdtext, idx);
        if(!strlen(x_nr))
        {
            SendClientMessage(playerid, -1, ""#COL_GREY"[usage]: "#COL_WHITE"/trunk open / close / store / take");
            return 1;
        }
        if(strcmp(x_nr, "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;
        }


        if(strcmp(x_nr, "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; }
            return 1;
            }



// /trunk open works well, but how to make /trunk store armour [amount of armour]
// Here is little code for armour storing

new Float:plyArmour;
GetPlayerArmour(playerid, plyArmour);
if(plyArmour != 0)
{
SetPlayerArmour(playerid, 0);
vehTrunkArmour[result] = plyArmour;
format(string, sizeof(string), "* %s takes off his/her body armour and puts it into car trunk.", sendername);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
}
return 1;
}
Reply
#2

My advice, switch to DCMD, ZCMD or YCMD, a lot easier, other then that I can't help anymore, just take my advice and switch to something newer.
Reply
#3

Okay... Now i tryed to do this on dcmd, but even /trunk open not working.

pawn Код:
dcmd_trunk(playerid, params[])
{
if(gPlayerHasCar[playerid] == 0) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"dont have keys");
new x_nr[256], idx;
x_nr = strtok(params, idx);
if (strlen(params))
{
SendClientMessage(playerid, -1, ""#COL_GREY"[usage]: "#COL_WHITE"/trunk open / close / store / get ...");
}
return 1;
}


dcmd_open(playerid, params[])
{
#pragma unused params
if(TrunkOpen[Vehicle[playerid]] == 1) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: already oepend");
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;
}


dcmd_close(playerid, params[])
{
#pragma unused params
if(TrunkOpen[Vehicle[playerid]] == 0) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"trunk is already closed");
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_OFF, objective);
TrunkOpen[Vehicle[playerid]] = 0;
return 1;
}
Reply
#4

Quote:
Originally Posted by jaksimaksi
Посмотреть сообщение
Okay... Now i tryed to do this on dcmd, but even /trunk open not working.

pawn Код:
dcmd_trunk(playerid, params[])
{
if(gPlayerHasCar[playerid] == 0) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"dont have keys");
new x_nr[256], idx;
x_nr = strtok(params, idx);
if (strlen(params))
{
SendClientMessage(playerid, -1, ""#COL_GREY"[usage]: "#COL_WHITE"/trunk open / close / store / get ...");
}
return 1;
}


dcmd_open(playerid, params[])
{
#pragma unused params
if(TrunkOpen[Vehicle[playerid]] == 1) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: already oepend");
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;
}


dcmd_close(playerid, params[])
{
#pragma unused params
if(TrunkOpen[Vehicle[playerid]] == 0) return SendClientMessage(playerid, -1, ""#COL_RED"[error]: "#COL_WHITE"trunk is already closed");
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_OFF, objective);
TrunkOpen[Vehicle[playerid]] = 0;
return 1;
}
Because "dcmd_open" would make the command "/open" not "/trunk open".

Add me on msn, I'll try and code it with you.
leslie@live.com.au (if you haven't got MSN pm me)
Reply
#5

pawn Код:
dcmd_trunk(playerid, params[])
{
new action, storewhat, amount; //this defines the first input as "action" and obviously the rest...
if(sscanf(params, "zzd", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]"); // I said add this above
if(action == "open")
{
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;
}
else if(action == "close")
{
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_OFF, objective);
TrunkOpen[Vehicle[playerid]] = 0;
} // << Closing bracket was closed?
//else if{action == store) //so if the player types /trunk store
//{
//if(storewhat == armour)
//{
//store the armour code
//}
//if(storewhat == gun)
//{
//store the gun code
//}
return 1;
}

Okay why i get errors error 033: array must be indexed (variable "-unknown-")

here:

if(action == "open")
if(action == "close")
Reply
#6

pawn Код:
if(!strcmp(action,"open")
Reply
#7

error 035: argument type mismatch (argument 1)
error 035: argument type mismatch (argument 1)
Reply
#8

pawn Код:
new action[8], storewhat, amount; //this defines the first input as "action" and obviously the rest...
if(sscanf(params, "s[8]zd", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]"); // I said add this above
Reply
#9

pawn Код:
dcmd_trunk(playerid, params[])
{
new action[8], storewhat, amount;
if(sscanf(params, "s[8]zd", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]"); // I said add this above
//if(action == "open")
if(!strcmp(action,"open")
{ // ERROR HERE!!! error 001: expected token: ")", but found "{"
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;
}
//else if(action == "close")
else if(!strcmp(action,"close")
{ // ERROR HERE!!! error 001: expected token: ")", but found "{"
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_OFF, objective);
TrunkOpen[Vehicle[playerid]] = 0;
}
//else if{action == store) //so if the player types /trunk store
//{
//if(storewhat == armour)
//{
//store the armour code
//}
//if(storewhat == gun)
//{
//store the gun code
//}
return 1;
}
error 001: expected token: ")", but found "{"
error 001: expected token: ")", but found "{"
Reply
#10

pawn Код:
if(!strcmp(action,"open"))

TrunkOpen[Vehicle[playerid] = 1;
Reply
#11

Now always repeating: /trunk [open/store/get] [armor/gun] [amount]

pawn Код:
dcmd_trunk(playerid, params[])
{
new action[8], storewhat, amount;
if(sscanf(params, "s[8]zd", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
if(!strcmp(action,"open"))
{
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;
}
else if(!strcmp(action,"close"))
{
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_OFF, objective);
TrunkOpen[Vehicle[playerid]] = 0;
}
return 1;
}
Reply
#12

any ideas how to make "/trunk open" , "/trunk close" ?.
Reply
#13

nevermind this post.
Reply
#14

bump...
Reply
#15

pawn Код:
dcmd_trunk(playerid, params[])
{
new action[8], storewhat, amount;
if(sscanf(params, "s[8]zd", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
if(!strcmp(action,"open"))
{
new veh = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_ON, objective);
TrunkOpen[Vehicle[playerid]] = 1;
}
else if(!strcmp(action,"close"))
{
new veh = GetPlayerVehicleID(playerid);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(veh, engine, lights, alarm, doors, bonnet, VEHICLE_PARAMS_OFF, objective);
TrunkOpen[Vehicle[playerid]] = 0;
}
return 1;
}
Reply
#16

Still always says: /trunk [open/store/get] [armor/gun] [amount]
Reply
#17

Change:
pawn Код:
if(sscanf(params, "s[8]zd", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
To:
pawn Код:
if(sscanf(params, "zzd", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
If not, try:
pawn Код:
if(sscanf(params, "zzz", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
Reply
#18

Finally. Working with:

pawn Код:
if(sscanf(params, "zzz", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
Thank you.
Reply
#19

Quote:
Originally Posted by jaksimaksi
Посмотреть сообщение
Finally. Working with:

pawn Код:
if(sscanf(params, "zzz", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
Thank you.
Private Message me if you still have troubles with any future references to that piece of coding.
Reply
#20

Now with armour i need to do like that?

pawn Код:
else if(!strcmp(action,"store armour"))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)