Question about a (z)cmd and vehicles ...
#1

Hi all !
So i need a little bit help for this:

1) A person can't type a cmd twice !

pawn Код:
CMD:addmissiles(playerid,params[])
    {
        if(IsPlayerInDerby[playerid] == 1)
        {
            AddVehicleMissiles(GetPlayerVehicleID(playerid),1.1,-0.2);
            new pName[MAX_PLAYER_NAME], string[128];
            GetPlayerName(playerid, pName,32);
            format(string, sizeof string,"[DERBY] %s added missiles to his/her car !",pName);
            SendClientMessageToAll(COLOR_ORANGE,string);
        }
        else SendClientMessage(playerid,COLOR_RED,"You are not in the derby !");
        return 1;
    }
So if the player types /addmissiles .. it's good but when the player type /addmissiles again, he may not do that ...
So how to do this ? If he type the cmd twice then he must receive this cmd:

pawn Код:
SendClientMessage(playerid,COLOR_RED,"You already used missles !");
2) How to make this ...

So this is a little difficult for me ... i searched alot on the forum and on ****** but my question is:

How to add a bar that show the vehicle health , the bar must be seen for everyone IG ! So it's like the vehicle health bar above the vehicle ... and then when the vehicle lost health the bar must lost health too ofcourse ...

This is (maybe) very difficult for me (i just can't find it how to script) !

------------------------------------------------------------------------------------

SO PLZ HELP ME WITH THESE 2 THINGS !

Reply
#2

Glad to see someone is using my script. You can use the IsVehicleHot function to tell if he already has used it.

pawn Код:
CMD:addmissiles(playerid,params[])
{
    if(IsPlayerInDerby[playerid] == 1)
    {
        new Veh = GetPlayerVehicleID(playerid);
        if(!IsVehicleHot(Veh))
        {
            AddVehicleMissiles(Veh,1.1,-0.2);
            GetPlayerName(playerid, pName,32);
            format(string, sizeof string,"[DERBY] %s added missiles to his/her car !",pName);
            SendClientMessageToAll(COLOR_ORANGE,string);
            return 1;
        }
        else
        {
            SendClientMessage(playerid,COLOR_RED,"You already equipped missiles !");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"You are not in the derby !");
        return 1;
    }
    return 1;
}
Now with that, he'll be able to use it again once he fires his missiles. If you want him to just be able to equip them once, you'll need a PVar or something else specific to that playerid. For that purpose, try this. You will have to switch the PVar back after the derby for him to be able to use them again.

pawn Код:
CMD:addmissiles(playerid,params[])
{
    if(IsPlayerInDerby[playerid] == 1)
    {
        if(!GetPVarInt(playerid,"Missiles"))
        {
            SetPVarInt(playerid,"Missiles",1);
            AddVehicleMissiles(GetPlayerVehicleID(playerid),1.1,-0.2);
           
            GetPlayerName(playerid, pName,32);
            format(string, sizeof string,"[DERBY] %s added missiles to his/her car !",pName);
            SendClientMessageToAll(COLOR_ORANGE,string);
            return 1;
        }
        else
        {
            SendClientMessage(playerid,COLOR_RED,"You already equipped missiles !");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"You are not in the derby !");
        return 1;
    }
    return 1;
}
Reply
#3

Quote:

SO PLZ HELP ME WITH THESE 2 THINGS !
Avoid from saying stuff like this, some people will read this and then not even attempt to help you. Just a future reference.
Reply
#4

Quote:
Originally Posted by Backwardsman97
Посмотреть сообщение
Glad to see someone is using my script. You can use the IsVehicleHot function to tell if he already has used it.

pawn Код:
CMD:addmissiles(playerid,params[])
{
    if(IsPlayerInDerby[playerid] == 1)
    {
        new Veh = GetPlayerVehicleID(playerid);
        if(!IsVehicleHot(Veh))
        {
            AddVehicleMissiles(Veh,1.1,-0.2);
            GetPlayerName(playerid, pName,32);
            format(string, sizeof string,"[DERBY] %s added missiles to his/her car !",pName);
            SendClientMessageToAll(COLOR_ORANGE,string);
            return 1;
        }
        else
        {
            SendClientMessage(playerid,COLOR_RED,"You already equipped missiles !");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"You are not in the derby !");
        return 1;
    }
    return 1;
}
Now with that, he'll be able to use it again once he fires his missiles. If you want him to just be able to equip them once, you'll need a PVar or something else specific to that playerid. For that purpose, try this. You will have to switch the PVar back after the derby for him to be able to use them again.

pawn Код:
CMD:addmissiles(playerid,params[])
{
    if(IsPlayerInDerby[playerid] == 1)
    {
        if(!GetPVarInt(playerid,"Missiles"))
        {
            SetPVarInt(playerid,"Missiles",1);
            AddVehicleMissiles(GetPlayerVehicleID(playerid),1.1,-0.2);
           
            GetPlayerName(playerid, pName,32);
            format(string, sizeof string,"[DERBY] %s added missiles to his/her car !",pName);
            SendClientMessageToAll(COLOR_ORANGE,string);
            return 1;
        }
        else
        {
            SendClientMessage(playerid,COLOR_RED,"You already equipped missiles !");
            return 1;
        }
    }
    else
    {
        SendClientMessage(playerid,COLOR_RED,"You are not in the derby !");
        return 1;
    }
    return 1;
}
Yeah thanks !
And your script is awesome when i use it in a derby xD hahah


Quote:
Originally Posted by Steven82
Посмотреть сообщение
Avoid from saying stuff like this, some people will read this and then not even attempt to help you. Just a future reference.
Mmm ok thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)