COMMAND:airstrike(playerid, params[])
{
if(PInfo[playerid][Level] < 7) return SendClientMessage(playerid,0xFF0000AA,"ERROR: Sorry this command is under construction! Greets Max");
if(PInfo[playerid][Logged] == 0) return SendClientMessage(playerid,0xFF0000AA,"Login to use this command");
if(GetPlayerScore(playerid) < 2000) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough score, you need 2000 score(Rank 7)");
if(GetPlayerMoney(playerid) < 10000) return SendClientMessage(playerid, 0xFF0000FF, "You don't have enough money.");
GivePlayerMoney(playerid,-10000);
new Float:Pos[3];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
SendClientMessage(playerid, 0xFF0000FF, "Air Strike Successfully Done!");
SetTimerEx("ExplodeBomb", 5000, false, "ifff", playerid, Pos[0], Pos[1], Pos[2]);
return 1;
}
forward ExplodeBomb(playerid, Float:PosX, Float:PosY, Float:PosZ);
public ExplodeBomb(playerid, Float:PosX, Float:PosY, Float:PosZ)
{
SendClientMessage(playerid, GREEN, "Sir! The bombs have been detonated!");
CreateExplosion(PosX, PosY, PosZ, 7, 20.0);
return 1;
}
COMMAND:giveallweapon(playerid,params[])
{
if(PInfo[playerid][Level] < 4) return SendClientMessage(playerid,0xFF0000AA,"ERROR: You are not allowed to use this command!");
{
new gun, WeapName[64], ammo, string[128];
if(sscanf(params, "d", gun,ammo))
{
SendClientMessage(playerid,RED,"Usage: /giveallweapon <weapon id> <ammount>");
return 1;
}
new ammount;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
PlayerPlaySound(i,1057,0.0,0.0,0.0);
GivePlayerWeapon(i,gun,ammo);
}
}
new pname[24];
GetWeaponName(gun, WeapName, sizeof(WeapName));
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),"Administrator %s has given all players a %s with %d ammo", pname, WeapName, ammount);
SendClientMessageToAll(blue, string);
//
}
return 1;
}
COMMAND:giveallweapon(playerid,params[])
{
if(PInfo[playerid][Level] < 4) return SendClientMessage(playerid,0xFF0000AA,"ERROR: You are not allowed to use this command!");
{
new gun, WeapName[64], ammo, string[128];
if(sscanf(params, "dd", gun,ammo))
{
SendClientMessage(playerid,RED,"Usage: /giveallweapon <weapon id> <ammount>");
return 1;
}
new ammount;
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
PlayerPlaySound(i,1057,0.0,0.0,0.0);
GivePlayerWeapon(i,gun,ammo);
}
}
new pname[24];
GetWeaponName(gun, WeapName, sizeof(WeapName));
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),"Administrator %s has given all players a %s with %d ammo", pname, WeapName, ammount);
SendClientMessageToAll(blue, string);
//
}
return 1;
}
format(string,sizeof(string),"Administrator %s has given all players a %s with %d ammo", pname, WeapName, ammo);
Works now! >.< Stupid mistake.
is there also a way to make /giveallweapon m4 instead of the id? |
new weap[3]; if(sscanf(params, "s[3]d", weap,ammo)) if(!strcmp(weap, "m4")) { //... }
sure, but you'll need to modify the code a bit.
Код:
new weap[3]; if(sscanf(params, "s[3]d", weap,ammo)) if(!strcmp(weap, "m4")) { //... } |