to add nos or nitro to all players cars
#1

if i want to add nos to all players cars when they use the command /nos how i make it that they need 100 score , points and if not got 100 score it says error u need 100 score points

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/nitro", cmdtext, true, 10) == 0)
    {
        AddVehicleComponent(154, 1010); // x10 nitro <<---- how to put to x2 nos
        SendClientMessage(playerid, COLOR_RED, " You have add Nitro!");
        return 1;
    }
    return 0;
please note i am new at scripting so dont be saying easy etc ,, because if it was easy i wouldnt be asking
Reply
#2

pawn Код:
if (strcmp("/nitro", cmdtext, true, 10) == 0)
{
    if(GetPlayerScore(playerid) < 100) // checks if your playerscore is lower then 100
    {
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1009); // This is 2x nitro
        SendClientMessage(playerid, COLOR_RED, " You have add Nitro!");      
    }
    return 1;
}
If you need anything, pm me, or just post again
Edit:
This is one is to all players: just saw that you needed it aswell
pawn Код:
if (strcmp("/nitro", cmdtext, true, 10) == 0)
{
    if(GetPlayerScore(playerid) < 100) // checks if your playerscore is lower then 100
    {
        for(new i = 0; i < MAX_PLAYERS; i++) // This loops through all players
        {
            if(GetPlayerScore(i) < 100) // Gets the score of everyone and checks if its lower then 100
            {
                new string[128], name[24];
                GetPlayerName(playerid, name, 24);
                format(string, sizeof string, "%s sended nitro to you! Sadly, you dont have 100 score, so no nitro for you.", name);
                SendClientMessage(i, -1, string);
            } else { // If the score is higher as 100, this gets excecuted
                AddVehicleComponent(GetPlayerVehicleID(i), 1009);
                new string[128], name[24];
                GetPlayerName(playerid, name, 24);
                format(string, sizeof string, "%s sended nitro to you! Say thanks to him :\)", name);
                SendClientMessage(i, -1, string);
            }
        }
    } else return SendClientMessage(playerid, -1, "You cant use this command, you need 100 score for this");
    return 1;
}
Reply
#3

ty so much for help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)