number problems? -
Bek_Loking - 25.06.2014
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
if(job[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1863.3562,1743.2107,10.2508,5 ); // checkpoint 2
job[playerid] = 2;
}
if(job[playerid] == 2)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1856.5803,1728.6243,10.3893,5 ); // checkpoint 2
job[playerid] = 3;
}
if(job[playerid] == 3)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1842.2550,1728.1792,10.3816,5 ); // checkpoint 2
job[playerid] = 4;
}
if(job[playerid] == 4)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1827.1217,1730.1421,8.4328,5 ); // checkpoint 2
job[playerid] = 5;
}
if(job[playerid] == 5)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1819.2875,1739.3157,6.8927,5 ); // checkpoint 2
job[playerid] = 6;
}
if(job[playerid] == 6)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1819.8635,1750.2288,6.9478,5 ); // checkpoint 2
job[playerid] = 7;
}
if(job[playerid] == 7)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1825.9081,1773.3228,7.7519,5 ); // checkpoint 2
job[playerid] = 8;
}
if(job[playerid] == 8)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1826.9011,1784.0930,7.8584,5); // checkpoint 2
job[playerid] = 9;
}
if(job[playerid] == 9)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1824.7766,1796.8481,7.2158,5 );
job[playerid] = 10;
}
if(job[playerid] == 10)
{
DisablePlayerCheckpoint(playerid);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "You've finished the job! Here's your money!");
GivePlayerMoney(playerid, 750);
job[playerid] = 0;
}
return 1;
}
This is the script of checkpoints while this is the script of mowing:
PHP код:
CMD:mowland(playerid, params[])
{
new vid = GetPlayerVehicleID(playerid);
if(lawnmower[playerid] == 0) SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You're not employed as lawnmower!") ;
else if(!IsPlayerInRangeOfPoint(playerid, 5,1878.5900,1758.6154,10.4470)) SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You're not near mowers' job starting line!");
else if(vid == 572 || IsPlayerInRangeOfPoint(playerid,5,1878.5900,1758.6154,10.4470))
{
job[playerid] = 1;
SendClientMessage(playerid, COLOR_LIGHTGREEN, "[SUCCESS!]{FFFFFF}You've started lawnmowing. Go through checkpoints to finish your job!");
SetPlayerCheckpoint(playerid,1880.6528,1759.2567,10.1134,2);
}
return 1;
}
This is the script of mowing, why does it give me money in instant as if I finished the job? :S Like I finished the job when passing through last checkpoint? Why?
Respuesta: number problems? -
SickAttack - 25.06.2014
That's how the script is made.
Remove: "GivePlayerMoney(playerid, 750);" if you don't want to give them money.
Re: number problems? -
Bek_Loking - 25.06.2014
It's not made to give the player money on first checkpoint? I made it to make 10 checkpoints until it gives the player money, whats wrong?
edit: i did not make it to give the player money on first checkpoint :S whats wrong
Respuesta: number problems? -
SickAttack - 25.06.2014
Return 1 when you enter a checkpoint because you are setting the value to go up and then checking the value again.
Re: number problems? -
Bek_Loking - 25.06.2014
Could you show me an example?
Respuesta: number problems? -
SickAttack - 25.06.2014
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(job[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1863.3562,1743.2107,10.2508,5 ); // checkpoint 2
job[playerid] = 2;
return 1;
}
if(job[playerid] == 2)
{
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid,1856.5803,1728.6243,10.3893,5 ); // checkpoint 2
job[playerid] = 3;
return 1;
}
// The rest...
}
Re: number problems? -
Bek_Loking - 25.06.2014
Thanks. It's finished, I get this error : C:\Users\MARKO\Desktop\Learning\gamemodes\Tutorial .pwn(870) : warning 209: function "Streamer_OnPlayerEnterCP" should return a value
At this line:
PHP код:
if(vid == 572) SendClientMessage(playerid, COLOR_RED, "You're not in mower vehicle!!!");
else if(job[playerid] == 20)
{
DisablePlayerCheckpoint(playerid);
GivePlayerMoney(playerid, 1000);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "Well done! You've finished your work.");
SendClientMessage(playerid, COLOR_GREEN, "[MONEY]{FFFFFF}You've received 1000$");
return 1;
}
} <--- this line
edit : Nevermind, fixed it with this:
PHP код:
if(vid == 572) SendClientMessage(playerid, COLOR_RED, "You're not in mower vehicle!!!");
else if(job[playerid] == 20)
{
DisablePlayerCheckpoint(playerid);
GivePlayerMoney(playerid, 1000);
SendClientMessage(playerid, COLOR_LIGHTGREEN, "Well done! You've finished your work.");
SendClientMessage(playerid, COLOR_GREEN, "[MONEY]{FFFFFF}You've received 1000$");
return 1;
}
return 0;
}