Job capacity
#1

Hey there. I am currently scripting a job including lawnmowing, I will briefly explain what I am doing and want to do.

***What I made***
"/lawn start" spawns a red marker.
When you enter a red marker another marker will spawn.

***What I need***
I need to script a capacity of the lawnmower. So that when you enter a red marker, the capacity will go like this:
0markers: 0/100
1markers: 5/100
2markers: 10/100
3markers: 15/100 and so on.
When you reach 100/100 the red markers will disable and you will have to type "/lawn dispose" to get rid of the full capacity and start lawnmowing again.
Reply
#2

To create the "red markers" A.K.A. checkpoints, you must use SetPlayerCheckpoint. When the player enters the checkpoint (IsPlayerInCheckpoint), you'll have to disable the old checkpoint (DisablePlayerCheckpoint), and create a new check point (SetPlayerCheckpoint).
Reply
#3

Quote:
Originally Posted by еddy
To create the "red markers" A.K.A. checkpoints, you must use SetPlayerCheckpoint. When the player enters the checkpoint (IsPlayerInCheckpoint), you'll have to disable the old checkpoint (DisablePlayerCheckpoint), and create a new check point (SetPlayerCheckpoint).
I already did that.. I need to add capacity stuff you know
Reply
#4

Then the PlayerData A.K.A. PlayerInfo would maybe be good. Try to start with this:

pawn Код:
enum PlayerInfo
{
checkpoints
}
Then add a:

pawn Код:
new PlayerData[MAX_PLAYERS][PlayerInfo];
And then, on the IsPlayerInCheckpoint, add this:

pawn Код:
PlayerData[playerid][checkpoints]++;
That's one way you can control the capacity on.
Reply
#5

Ummh I didn't really understand that :/ Can you explain a bit more on how to?
Reply
#6

This is an example script that I made:

pawn Код:
#include <a_samp>

enum PlayerInfo
{
checkpoints
}

new PlayerData[MAX_PLAYERS][PlayerInfo];

public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext,"/test",true))
{
if(IsPlayerInCheckpoint(playerid))
{
PlayerData[playerid][checkpoints]++;
return 1;
}
SendClientMessageToAll(0xFFFFAAAA, "Test Successfull");
return 1;
}
return 0;
}
Try to take a look at that.
Reply
#7

i'de probably do it more like this, although i havnt tested it yet, so you will have to let me know if its not working right

pawn Код:
new TotalGrass[MAX_PLAYERS];


public OnPlayerEnterRaceCheckpoint(playerid)
{
    new vehicleid = GetPlayerVehicleID(playerid);

    if (GetVehicleModel(vehicleid) == 572)
    {
        if (PlayerToPoint(4, playerid, 779.9626, -1259.1793, 13.5719))
        {
            TotalGrass[playerid] += 5;
            new NeededGrass = 200-TotalGrass[playerid];
            new gString[80];
           
            format(gString, sizeof(gString),"(5 GRASS COLLECTED) You Have A Total Of %i Grass, You Still Need %i More.",TotalGrass,NeededGrass);
            SendClientMessage(playerid,0xBBFFFFFF,gString);
            PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
           
            SendClientMessage(playerid, 0xBBFFFFFF, "You Have Arived At Checkpoint One! Head To The Next Checkpoint!");
            SetPlayerRaceCheckpoint(playerid, 2, X, Y, Z, 0, 0, 0, 6.0);// Set the X, Y, Z
        }
        else if (PlayerToPoint(4, playerid, X, Y, Z))// Set the X, Y, Z
        {
            TotalGrass[playerid] += 5;
            new NeededGrass = 200-TotalGrass[playerid];
            new gString[80];

            format(gString, sizeof(gString),"(5 GRASS COLLECTED) You Have A Total Of %i Grass, You Still Need %i More.",TotalGrass,NeededGrass);
            SendClientMessage(playerid,0xBBFFFFFF,gString);
            PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);

            SendClientMessage(playerid, 0xBBFFFFFF, "You Have Arived At Checkpoint Two! Head To The Next Checkpoint!");
            SetPlayerRaceCheckpoint(playerid, 2, X, Y, Z, 0, 0, 0, 6.0);// Set the X, Y, Z
        }
        return 1;
    }
    return 1;
}
Reply
#8

Quote:
Originally Posted by happyface
pawn Код:
public OnPlayerEnterRaceCheckpoint(playerid)
Aaah, shit. I forgot that. XD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)