number problems?
#1

PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
        if(
job[playerid] == 1)
        {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,1863.3562,1743.2107,10.2508,); // checkpoint 2
        
job[playerid] = 2;
        }
        if(
job[playerid] == 2)
        {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,1856.5803,1728.6243,10.3893,); // checkpoint 2
        
job[playerid] = 3;
        }
        if(
job[playerid] == 3)
        {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,1842.2550,1728.1792,10.3816,); // checkpoint 2
        
job[playerid] = 4;
        }
        if(
job[playerid] == 4)
        {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,1827.1217,1730.1421,8.4328,); // checkpoint 2
        
job[playerid] = 5;
        }
        if(
job[playerid] == 5)
        {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,1819.2875,1739.3157,6.8927,); // checkpoint 2
        
job[playerid] = 6;
        }
        if(
job[playerid] == 6)
        {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,1819.8635,1750.2288,6.9478,); // checkpoint 2
        
job[playerid] = 7;
        }
        if(
job[playerid] == 7)
        {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,1825.9081,1773.3228,7.7519,); // 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,);
        
job[playerid] = 10;
        }
        if(
job[playerid] == 10)
        {
        
DisablePlayerCheckpoint(playerid);
        
SendClientMessage(playeridCOLOR_LIGHTGREEN"You've finished the job! Here's your money!");
        
GivePlayerMoney(playerid750);
        
job[playerid] = 0;
        }
        return 
1;

This is the script of checkpoints while this is the script of mowing:

PHP код:
CMD:mowland(playeridparams[])
{
new 
vid GetPlayerVehicleID(playerid);
if(
lawnmower[playerid] == 0SendClientMessage(playeridCOLOR_RED"[ERROR]{FFFFFF}You're not employed as lawnmower!") ;
else if(!
IsPlayerInRangeOfPoint(playerid5,1878.5900,1758.6154,10.4470)) SendClientMessage(playeridCOLOR_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(playeridCOLOR_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?
Reply
#2

That's how the script is made.

Remove: "GivePlayerMoney(playerid, 750);" if you don't want to give them money.
Reply
#3

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
Reply
#4

Return 1 when you enter a checkpoint because you are setting the value to go up and then checking the value again.
Reply
#5

Could you show me an example?
Reply
#6

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...
}
Reply
#7

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 == 572SendClientMessage(playeridCOLOR_RED"You're not in mower vehicle!!!");
        else if(
job[playerid] == 20)
        {
        
DisablePlayerCheckpoint(playerid);
        
GivePlayerMoney(playerid1000);
        
SendClientMessage(playeridCOLOR_LIGHTGREEN"Well done! You've finished your work.");
        
SendClientMessage(playeridCOLOR_GREEN"[MONEY]{FFFFFF}You've received 1000$");
        return 
1;
        }
  } <--- 
this line 
edit : Nevermind, fixed it with this:

PHP код:
    if(vid == 572SendClientMessage(playeridCOLOR_RED"You're not in mower vehicle!!!");
        else if(
job[playerid] == 20)
        {
        
DisablePlayerCheckpoint(playerid);
        
GivePlayerMoney(playerid1000);
        
SendClientMessage(playeridCOLOR_LIGHTGREEN"Well done! You've finished your work.");
        
SendClientMessage(playeridCOLOR_GREEN"[MONEY]{FFFFFF}You've received 1000$");
        return 
1;
        }
        return 
0;
  } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)