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;
}
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;
}
Okay... Now i tryed to do this on dcmd, but even /trunk open not working.
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;
}
if(!strcmp(action,"open")
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
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;
}
if(!strcmp(action,"open"))
TrunkOpen[Vehicle[playerid] = 1;
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;
}
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;
}
if(sscanf(params, "s[8]zd", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
if(sscanf(params, "zzd", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
if(sscanf(params, "zzz", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
if(sscanf(params, "zzz", action, storewhat, amount)) return SendClientMessage(playerid, -1, "/trunk [open/store/get] [armor/gun] [amount]");
Finally. Working with:
pawn Код:
|
else if(!strcmp(action,"store armour"))