[HELP] with /agiveweapon -
Stefand - 30.05.2012
Hello,
I have changed my Agiveweapon command so i can decide how much ammo i want.
but when i do it in game you see very fast the weapon icon in the right top, but then it dissapears.
Maybe someone can look at it
pawn Код:
command(agiveweapon, playerid, params[])
{
new WeaponN[60], Names[2][MAX_PLAYER_NAME], string[128], id, weaponid, ammo;
if(sscanf(params, "ud", id, weaponid, ammo))
{
if(Player[playerid][AdminLevel] >= 3)
{
SendClientMessage(playerid, WHITE, "SYNTAX: /agiveweapon [playerid] [weaponid] [ammo]");
}
}
else
{
if(Player[playerid][AdminLevel] >= 3)
{
if(IsPlayerConnectedEx(id))
{
if(weaponid >= 1 && weaponid < 47)
{
GetPlayerName(id, Names[0], MAX_PLAYER_NAME);
GetPlayerName(playerid, Names[1], MAX_PLAYER_NAME);
if(weaponid == 19)
{
SetPlayerSpecialAction(id, SPECIAL_ACTION_USEJETPACK);
format(string, sizeof(string), "You have given %s a Jetpack (Weapon ID: 19).", GetName(id), weaponid);
SendClientMessage(playerid, WHITE, string);
format(string, sizeof(string), "You have been given a Jetpack, from %s.", GetName(playerid));
SendClientMessage(id, WHITE, string);
Player[id][HasJetpack] = 1;
format(string, sizeof(string), "%s has been given weapon %d by %s.", Names[0], weaponid, Names[1]);
AdminActionsLog(string);
}
else
{
GetWeaponName(weaponid, WeaponN, sizeof(WeaponN));
GivePlayerWeapon(id, weaponid, ammo);
format(string, sizeof(string), "You have given %s a %s (Weapon ID: %d).", GetName(id), WeaponN, weaponid);
SendClientMessage(playerid, WHITE, string);
format(string, sizeof(string), "You have been given a %s, from %s.", WeaponN, GetName(playerid));
SendClientMessage(id, WHITE, string);
format(string, sizeof(string), "%s has been given weapon %d by %s.", Names[0], weaponid, Names[1]);
AdminActionsLog(string);
}
}
else
{
SendClientMessage(playerid, WHITE, "Invalid weapon ID.");
}
}
else
{
SendClientMessage(playerid, WHITE, "That player is not connected or isn't logged in.");
}
}
}
return 1;
}
Re: [HELP] with /agiveweapon -
ViniBorn - 30.05.2012
pawn Код:
if(sscanf(params, "rdd", id, weaponid, ammo))
Re: [HELP] with /agiveweapon -
Stefand - 31.05.2012
Still the same doesnt work
Re: [HELP] with /agiveweapon -
Stefand - 01.06.2012
Still not someone help?
Re: [HELP] with /agiveweapon -
Sandiel - 01.06.2012
Hope this helps, you'll need ZCMD, and sscanf.
Код:
COMMAND:agiveweapon(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4) // Dunno what your admin ranks are, but yeh..
{
new targetid, weaponid, ammo;
if(!sscanf(params, "uii", targetid, weaponid, ammo))
{
if(targetid != INVALID_PLAYER_ID)
{
GivePlayerWeapon(targetid, weaponid, ammo);
// now create strings, get names, and send messages to both players..
}
}
}
return 1;
}
Re: [HELP] with /agiveweapon -
Stefand - 03.06.2012
Works thanks