Hello guys, I want Adding Parameters Within Parameters!
my code;
it provides no return
my code;
Code:
COMMAND:give(playerid, params[])
{
new option[10];
if(sscanf(params, "s[10]", option)) return SendClientMessage(playerid, 0xff0000ff, "USAGE: /give [money | weapon]");
if(!strcmp(option, "money", true))
{
new TargetID,
Cash;
if(sscanf(params, "ui", TargetID, Cash)) return SendClientMessage(playerid, 0xff0000ff, "USAGE: /give money [PlayerID] [Cash]");
{
if(TargetID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xff0000ff, "Invalid Player ID!");
if(GetPlayerMoney(playerid) < Cash) return SendClientMessage(playerid, 0xff0000ff, "You do not have that much money!");
new paystring[128],
paidstring[128],
player[MAX_PLAYER_NAME],
target[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
GetPlayerName(TargetID, target, sizeof(target));
format(paystring, sizeof(paystring), "You have given $%i to %s.", Cash, target);
format(paidstring, sizeof(paidstring), "%s has paid you %i.", player, Cash);
SendClientMessage(playerid, 0xff0000ff, paystring);
SendClientMessage(TargetID, 0xff0000ff, paidstring);
GivePlayerMoney(playerid, -Cash);
GivePlayerMoney(TargetID, Cash);
return 1;
}
}
if(!strcmp(option, "weapon", true))
{
new TargetID;
if(sscanf(params, "u", TargetID)) return SendClientMessage(playerid, 0xff0000ff, "USAGE: /give weapon [PlayerID]");
{
if(TargetID == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xff0000ff, "Invalid Player ID!");
// Your own weapon code here.
return 1;
}
}
return 1;
}