Make a command cost monay
#1

How do i make the below command cost 25,000 to use. It is a dialog that opens with the command, but the dialog won't appear if the player doesn't have enough money.


pawn Код:
if (strcmp(cmdtext, "/airstrike", true) == 0)
    {
        ShowPlayerDialog(playerid,DS,2,"Airstrikes","Vehicle Smasher \nEnemy Wave Attack \nTank Buster \nCarpet Bomb \nNuke \nAir Attack \nAir Bomber \nMegaNuke \nVehicle Nuke \nAircracker bomb \nAirCluster Bomb \nDestructorBomb \nFireCluster \nSplitterMissile \nMOAB ","Ok","Cancel");
        return 1;
    }

    return 0;
}
Reply
#2

pawn Код:
if (strcmp(cmdtext, "/airstrike", true) == 0)
{
    if(GetPlayerMoney(playerid) >= 25000)
    {
        ShowPlayerDialog(playerid,DS,2,"Airstrikes","Vehicle Smasher \nEnemy Wave Attack \nTank Buster \nCarpet Bomb \nNuke \nAir Attack \nAir Bomber \nMegaNuke \nVehicle Nuke \nAircracker bomb \nAirCluster Bomb \nDestructorBomb \nFireCluster \nSplitterMissile \nMOAB ","Ok","Cancel");
        return 1;
    }
    else SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You do not have enough money to perform this command!");
    return 1;
}
return 0;
}
Try.
Reply
#3

Quote:
Originally Posted by Denying
Посмотреть сообщение
pawn Код:
if (strcmp(cmdtext, "/airstrike", true) == 0)
{
    if(GetPlayerMoney(playerid) >= 25000)
    {
        ShowPlayerDialog(playerid,DS,2,"Airstrikes","Vehicle Smasher \nEnemy Wave Attack \nTank Buster \nCarpet Bomb \nNuke \nAir Attack \nAir Bomber \nMegaNuke \nVehicle Nuke \nAircracker bomb \nAirCluster Bomb \nDestructorBomb \nFireCluster \nSplitterMissile \nMOAB ","Ok","Cancel");
        return 1;
    }
    else SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You do not have enough money to perform this command!");
    return 1;
}
return 0;
}
Try.
But that doesn't take the 25,000 away, it only let's the player open the dialog if he has 25,000 or more.
Reply
#4

Quote:
Originally Posted by Denying
Посмотреть сообщение
pawn Код:
if (strcmp(cmdtext, "/airstrike", true) == 0)
{
    if(GetPlayerMoney(playerid) >= 25000)
    {
        GivePlayerMoney(playerid, -25000);
        ShowPlayerDialog(playerid,DS,2,"Airstrikes","Vehicle Smasher \nEnemy Wave Attack \nTank Buster \nCarpet Bomb \nNuke \nAir Attack \nAir Bomber \nMegaNuke \nVehicle Nuke \nAircracker bomb \nAirCluster Bomb \nDestructorBomb \nFireCluster \nSplitterMissile \nMOAB ","Ok","Cancel");
        return 1;
    }
    else SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You do not have enough money to perform this command!");
    return 1;
}
return 0;
}
Try.
Try this now.
Reply
#5

Quote:
Originally Posted by Denying
Посмотреть сообщение
pawn Код:
if (strcmp(cmdtext, "/airstrike", true) == 0)
{
    if(GetPlayerMoney(playerid) >= 25000)
    {
        ShowPlayerDialog(playerid,DS,2,"Airstrikes","Vehicle Smasher \nEnemy Wave Attack \nTank Buster \nCarpet Bomb \nNuke \nAir Attack \nAir Bomber \nMegaNuke \nVehicle Nuke \nAircracker bomb \nAirCluster Bomb \nDestructorBomb \nFireCluster \nSplitterMissile \nMOAB ","Ok","Cancel");
        return 1;
    }
    else SendClientMessage(playerid, 0xFFFFFFFF, "ERROR: You do not have enough money to perform this command!");
    return 1;
}
return 0;
}
Try.
You forgot to remove money from the player.
Try this.
pawn Код:
if (strcmp(cmdtext, "/airstrike", true) == 0)
{
        if(GetPlayerMoney(playerid) < 25000)return SendClientMessage(playerid,-1,"You don't have enough money");//Will stop players with less cash than 25000$
        ShowPlayerDialog(playerid,DS,2,"Airstrikes","Vehicle Smasher \nEnemy Wave Attack \nTank Buster \nCarpet Bomb \nNuke \nAir Attack \nAir Bomber \nMegaNuke \nVehicle Nuke \nAircracker bomb \nAirCluster Bomb \nDestructorBomb \nFireCluster \nSplitterMissile \nMOAB ","Ok","Cancel");
GivePlayerMoney(playerid,-25000);//Will remove money from the player.

    return 1;
}
return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)