Can you help me with this job scripting prob? -
Facepunch - 03.01.2011
Im trying to create multiple checkpoints for my job.
And this is how mine looks right now:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp("/startsweep", cmdtext, true, 6) == 0)
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehid = GetPlayerVehicleID(playerid);
if(GetVehicleModel(vehid) == 574)
{
SetPlayerCheckpoint(playerid, -2272.1460,2354.0540,4.5454, 3.0);
}
else SendClientMessage(playerid, 0xFFFFFFAA, "You need to be in a sweeper, to use this command!");
}
else SendClientMessage(playerid, 0xFFFFFFAA, "You need to be in a vehicle, to use this command!");
return 1;
}
return 0;
}
I want to IN that script, do some kind of cmd that says: Now that you have entered that checkpoint, go to the next one: SetPlayerCheckpoint etc etc.
Please help me guys. Appreciate it
If you can help me through msn, please do add me!
remihayek1994@hotmail.com
Re: Can you help me with this job scripting prob? -
Krx17 - 03.01.2011
In the OnPlayerEnterCheckpoint callback, check to see if he is near that checkpoint(-2272.14,2354.05,4.54) and if he is, set the next checkpoint.
Re: Can you help me with this job scripting prob? -
Sascha - 03.01.2011
or just create a "new checkpoint[MAX_PLAYERS];" as global variable...
set it to "checkpoint[playerid] = checkpoint[playerid] + 1;"
and check for the checkpoint number

less to write hehe
Re: Can you help me with this job scripting prob? -
Dj_maryo1993 - 03.01.2011
Lol i just did that 1 day ago (same job , sweeper ).
Here is how i made it .
I defined some checkpoints around sf :
pawn Код:
new Float:Sweeptrack[][3] =
{
{-1772.2838, 943.3796, 24.4672},
{-1788.5369, 936.3648, 24.4674},
{-1796.0505, 898.3031, 24.4674},
{-1798.1755, 856.0757, 24.4664},
{-1830.2357, 852.6179, 30.1938},
{-1865.9396, 853.9900, 34.7385},
{-1897.5032, 829.1100, 34.7408},
{-1902.3038, 754.9763, 45.0221},
{-1962.1851, 734.4586, 45.0221},
{-2006.0667, 700.4453, 45.0222},
{-2008.7322, 593.5717, 34.7410},
{-2008.1777, 469.8763, 34.7410},
{-2006.7596, 301.4298, 34.4502},
{-2009.8104, 131.7179, 27.2642},
{-2003.3231, 166.8427, 27.2642},
{-1996.1572, 185.2009, 27.2642},
{-1991.1730, 118.9228, 27.2643},
{-2023.7284, 110.3986, 27.5615},
{-2142.8159, 111.2377, 34.8971},
{-2145.0068, 163.2093, 34.8971},
{-2144.6497, 311.3270, 34.8971},
{-2140.4749, 487.1611, 34.7410},
{-2139.8030, 560.7528, 34.7410},
{-2139.7222, 628.8521, 51.9908},
{-2139.5479, 705.4181, 69.1392},
{-2122.4653, 727.9626, 69.1393},
{-2066.7522, 729.0329, 64.5960},
{-1916.7188, 729.3860, 45.0221},
{-1825.8031, 728.8007, 37.9356},
{-1711.7887, 768.2540, 24.4597},
{-1710.7534, 918.3055, 24.4674},
{-1730.1176, 957.1575, 24.6079}
};
Made a global variabile PlayerInfo[playerid][Sweep]
at /startsweep ,i did PlayerInfo[playerid][Sweep] = 1;
Here is the cool part
Under public OnPlayerEnterCheckpoint(playerid)
pawn Код:
if(PlayerInfo[playerid][Sweep] > 0)
{
if(PlayerInfo[playerid][Sweep]==32)
{
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid,culoare,"Sweep Complete");
new var = random(3000);
SafeGivePlayerMoney(playerid,1500+var);
PlayerInfo[playerid][Sweep] = 0;
return 1;
}
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,Sweeptrack[PlayerInfo[playerid][Sweep]][0],Sweeptrack[PlayerInfo[playerid][Sweep]][1],Sweeptrack[PlayerInfo[playerid][Sweep]][2],1.5);
PlayerInfo[playerid][Sweep]++;
return 1;
}
PS : 32 represent the last checkpoint i have .
[/pawn]