Airstrike Command Not Working
#1

Problem 1
pawn Код:
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;
}
Alright i have that command for my server what it does is

When a player types /airstrike a timer of 5 seconds will countdown and than explosions around the player.
But the problem now is when i do the command and i manage too kill someone the player who does /airstike won't get any kills the other player will just die cause of the explosions.

I want it when the player does /airstrike and manage to kill someone that he GETS the kill.

Problem 2

I have this command
pawn Код:
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;
}
But it when i do example /giveallweapon 38 200 it automaticly gives all players 0 ammo.
I want too let the admin chose how many ammo he gives.
Reply
#2

Anyone?
Reply
#3

Hi Biess,

@problem 1: when the players die, get the killer id and increment some value (their kills perhaps?)

@problem 2: if(sscanf(params, "dd", gun,ammo))
Reply
#4

@ Arbit

pawn Код:
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;
}
Managed to fix it but now second problem, the string doesn't show the ammount inside the string.
Reply
#5

^ well, that's because nothing's being done to "ammount" (spelled wrong btw).

Код:
format(string,sizeof(string),"Administrator %s has given all players a %s with %d ammo", pname, WeapName, ammo);
remove "new ammount" so the compiler doesn't get mad.
Reply
#6

Works now! >.< Stupid mistake.
is there also a way to make /giveallweapon m4 instead of the id?
Reply
#7

Quote:
Originally Posted by Biess
Посмотреть сообщение
Works now! >.< Stupid mistake.
is there also a way to make /giveallweapon m4 instead of the id?
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"))
{
    //...
}
Reply
#8

Quote:
Originally Posted by arbit
Посмотреть сообщение
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"))
{
    //...
}
Do i have to do that for every single weapon?
Reply
#9

mhm.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)