CMD:import(playerid, params[])
{
new string[128], weapon[32], amount, drugs[32];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You need to login first before using any command.");
if(!PlayerInfo[playerid][pFam]) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You have to be in a offical organisation.");
if(sscanf(params, "s[32]", weapon))
{
SCM(playerid, COLOR_WHITE, "USAGE: /import [weapon/drugs]");
return 1;
}
if(!strcmp(params, "weapon", true))
{
if(!PlayerInfo[playerid][pFam]) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You have to be in a offical organisation.");
{
if(sscanf(params, "s[32]d", weapon, amount))
{
SCM(playerid, COLOR_WHITE, "USAGE: /import [weapon] [amount]");
return 1;
}
}
}
if(!strcmp(params, "drugs", true))
{
if(!PlayerInfo[playerid][pFam]) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You have to be in a offical organisation.");
{
if(sscanf(params, "s[32]d", drugs, amount))
{
SCM(playerid, COLOR_WHITE, "USAGE: /import [drugs] [amount]");
return 1;
}
}
}
return 1;
}
These are two types of command processors so you can not use the both command processors in a same script.
|
if RETURN VALUE from sscanf == empty call error else put all values in the variables (I thought it does that automatically by the last call) if is the player in an organisation do your action
CMD:import(playerid, params[])
{
new string[128], weapon[32], amount, drugs[32];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You need to login first before using any command.");
if(!PlayerInfo[playerid][pFam]) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You have to be in a offical organisation.");
if(sscanf(params, "s[32]d", weapon, amount))
{
SCM(playerid, COLOR_WHITE, "USAGE: /import [weapon/drugs] [amount]");
return 1;
}
if(!strcmp(params, "weapon", true))
{
if(!PlayerInfo[playerid][pFam]) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You have to be in a offical organisation.");
{
}
}
if(!strcmp(params, "drugs", true))
{
if(!PlayerInfo[playerid][pFam]) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You have to be in a offical organisation.");
{
}
}
return 1;
}
Do it this way:
pawn Код:
|
Do it this way:
pawn Код:
|
CMD:import(playerid, params[])
{
new option[32];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You need to login first before using any command.");
if(!PlayerInfo[playerid][pFam]) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You have to be in a offical organisation.");
if(sscanf(params, "s[32]", option))
{
SCM(playerid, COLOR_WHITE, "USAGE: /import [weapon/drugs]");
return 1;
}
if(!strcmp(params, "weapon", true))
{
new weapon1[32], weapon2[32];
if(!PlayerInfo[playerid][pFam]) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You have to be in a offical organisation.");
{
if(sscanf(params, "s[32]s[32]", weapon1, weapon2))
{
SCM(playerid, COLOR_WHITE, "USAGE: /import [weapon] [weaponname]");
return 1;
}
if(!strcmp(weapon2, "deagle", true))
{
SCM(playerid, COLOR_FADE2, "YOU'VE IMPORTED A DEAGLE");
return 1;
}
}
}
if(!strcmp(params, "drugs", true))
{
if(!PlayerInfo[playerid][pFam]) return SendClientMessage(playerid, COLOR_GREY, "ERROR: You have to be in a offical organisation.");
{
}
}
return 1;
}