new cmd[128];
if(sscanf(params, "s[128]", cmd)) return SFM(playerid, COLOR_GREY, "[USAGE] vtrunk (option)"), SFM(playerid, COLOR_GREY, "[OPTIONS] view take put");
if(strfind(cmd, "view") == 0)
{
new count = 0;
SFM(playerid, COLOR_GREY, "Trunk Items");
for(new x = 0; x < 5; x++)
{
//getitems pass = count++ and print else nothing
}
if(count == 0) SFM(playerid, COLOR_YELLOWGREEN, "No items found in trunk.");
count = 0;
SFM(playerid, COLOR_GREY, "Trunk Weapons");
for(new x = 0; x < 5; x++)
{
//getweapons pass = count++ and print else nothing
}
if(count == 0) SFM(playerid, COLOR_YELLOWGREEN, "No weapons found in trunk.");
}
else if(strfind(cmd, "take") == 0)
{
new cmdex[128];
if(sscanf(cmd, "s[128]", cmdex)) return SFM(playerid, COLOR_GREY, "[USAGE] vtrunk take (weapon/item)");
if(strfind(cmdex, "weapon") == 0)
{
SFM(playerid, COLOR_GREY, "Under Construction!");
}
else if(strfind(cmdex, "item") == 0)
{
//under construncton
}
else
{
SFM(playerid, COLOR_GREY, "[USAGE] vtrunk take (weapon/item)");
}
}
else if(strfind(cmd, "put") == 0)
{
new cmdex[128];
if(sscanf(cmd, "s[128]", cmdex)) return SFM(playerid, COLOR_GREY, "[USAGE] vtrunk put (weapon/item)");
if(strfind(cmdex, "weapon") == 0)
{
SFM(playerid, COLOR_GREY, "Under Construction!");
}
else if(strfind(cmdex, "item") == 0)
{
//under construncton
}
else
{
SFM(playerid, COLOR_GREY, "[USAGE] vtrunk take (weapon/item)");
}
}
else
{
return 1;
}
[03:05:36] [USAGE] vtrunk take (weapon/item) [03:05:45] [USAGE] vtrunk put (weapon/item)
/vtrunk take (and now anything that falls under this) /vtrunk put (and now anything that falls under this)
COMMAND:give(playerid, params[])
{
new targetid, option[14], param[32], amount;
if(sscanf(params, "us[14]S()[32]", targetid, option, param))
{
SendClientMessage(playerid, -1, "[Usage]: /give [playerid] [option]");
SendClientMessage(playerid, -1, "List of options: Weapon, Cash.");
return 1;
}
if(!strcmp(option, "weapon", true))
{
// Give the weapon the player is currently holding...
}
else if(!strcmp(option, "cash", true))
{
if(sscanf(param, "i", amount))
{
return SendClientMessage(playerid, -1, "[Usage]: /give [playerid] [cash] [amount]");
}
// Give the player some cash..
}
return 1;
}
|
Use something similar to this.
Код:
COMMAND:give(playerid, params[])
{
new targetid, option[14], param[32], amount;
if(sscanf(params, "us[14]S()[32]", targetid, option, param))
{
SendClientMessage(playerid, -1, "[Usage]: /give [playerid] [option]");
SendClientMessage(playerid, -1, "List of options: Weapon, Cash.");
return 1;
}
if(!strcmp(option, "weapon", true))
{
// Give the weapon the player is currently holding...
}
else if(!strcmp(option, "cash", true))
{
if(sscanf(param, "i", amount))
{
return SendClientMessage(playerid, -1, "[Usage]: /give [playerid] [cash] [amount]");
}
// Give the player some cash..
}
return 1;
}
|