13.03.2012, 00:36
It doesn't process past "Usage: /trunk [usage]" Well, it's to do with SSCANF, I think i'm using it incorrectly.
pawn Код:
CMD:trunk(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
new item[32], amount,usage[24], vehicleid = GetClosestVehicle(playerid, 3);
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOUR_GREY, "You must get out of the vehicle to use this.");
SendClientMessage(playerid, COLOUR_GREY, "USAGE: Store, Get, View");
if(VehWep1[vehicleid] > 0 && VehWep2[vehicleid] > 0)return SendClientMessage(playerid, COLOUR_GREY, "You do not have any free weapon slots.");
if(sscanf(params, "s[24]",usage)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk [usage]");
VehicleSQLID[vehicleid] = MySQL_GetValue(VehicleSQLID[vehicleid], "id", "vehicles");
if(vehicleid == TrunkOpened[playerid])
{
if(!(strcmp(usage, "store", true)))
{
if(sscanf(usage, "s[24]", item)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /trunk store [item]");
SendClientMessage(playerid, COLOUR_GREY, "Available Items: Weapon, Weed, Cocaine, Money, Armour");
if(!(strcmp(item, "weapon", true)))
{
new weapon = GetPlayerWeapon(playerid);
new ammo = GetPlayerAmmo(playerid);
new string[128];
if(weapon > 1)
{
if(VehWep1[vehicleid] == 0)
{
VehWep1[vehicleid] = weapon;
VehWepA1[vehicleid] = ammo;
MySQL_SetInteger(VehicleSQLID[vehicleid], "VehWep1", weapon, "vehicles");
MySQL_SetInteger(VehicleSQLID[vehicleid], "VehWepA1", ammo, "vehicles");
RemovePlayerWeapon(playerid, weapon);
format(string, sizeof(string), "You have stored a %s in your vehicles trunk.", WeaponNames[weapon]);
SendClientMessage(playerid, COLOUR_BLUE, string);
format(string, sizeof(string), "* %s has stored a weapon in the %s's trunk.", GetNameEx(playerid), VehicleNames[vehicleid]);
ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
}
else if(VehWep2[vehicleid] == 0)
{
VehWep2[vehicleid] = weapon;
VehWepA2[vehicleid] = ammo;
MySQL_SetInteger(VehicleSQLID[vehicleid], "VehWep2", weapon, "vehicles");
MySQL_SetInteger(VehicleSQLID[vehicleid], "VehWepA2", ammo, "vehicles");
RemovePlayerWeapon(playerid, weapon);
format(string, sizeof(string), "You have stored a %s in your vehicles trunk.", WeaponNames[weapon]);
SendClientMessage(playerid, COLOUR_BLUE, string);
format(string, sizeof(string), "* %s has stored a weapon in the %s's trunk.", GetNameEx(playerid), VehicleNames[vehicleid]);
ProxDetector(30.0, playerid, string, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE, COLOUR_PURPLE);
}
}
}
}
}
return 1;
}