SA-MP Forums Archive
/mission and get Money - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /mission and get Money (/showthread.php?tid=385143)



/mission and get Money - Saize - 14.10.2012

Heyho, I have a Problem:S

When I write /mission I want to set a PlayerCheckpoint and when the Player runs into the CP then have a new CP to spawn, and when he is at the last CP he has to get 500$
But when I write I get 500$ and there are no CPs what is the fail?

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp(cmdtext,"/mission",true)==0)
    {
        
SetPlayerCheckpoint(playerid,2680.9780,-2319.7866,3.0000,3.0);  //CP1/1
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2724.5432,-2318.5767,3.0000,3.0);      // CP1/2
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2693.8093,-2327.6050,13.3328,3.0);     // CP1/3
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2669.4729,-2343.8599,13.6328,3.0);     // CP1/3
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2603.6311,-2345.6233,13.6198,3.0);     // CP1/4
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2594.9255,-2388.5762,13.4294,3.0);     // CP1/5
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2375.8752,-2171.7888,22.5269,3.0);     // CP1/6
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2215.8662,-1996.8254,13.3442,3.0);     // CP1/7
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2218.7622,-1795.6028,13.1953,3.0);     // CP1/8
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2218.0867,-1748.8181,13.3931,3.0);     // CP1/9
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2335.7583,-1751.3916,13.3879,3.0);     // CP1/10
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2337.3286,-1819.6421,13.5546,3.0);     // CP1/11
        
OnPlayerEnterCheckpoint(playerid);
        
OnPlayerLeaveCheckpoint(playerid);
        
SetPlayerCheckpoint(playerid,2207.6633,-2295.9060,14.7647,3.0);     // CP1/12
        
OnPlayerEnterCheckpoint(playerid);
        
GivePlayerMoney(playerid,500);
        
DisablePlayerCheckpoint(playerid);
        return 
1;
    }
    return 
0;

What is the fail?:/

Sorry for my bad english.


Re: /mission and get Money - lorizz - 14.10.2012

you need to put a time delay


Re: /mission and get Money - Calabresi - 14.10.2012

Whole script is a failture. You need to use it like;

Код:
public OnPlayerEnterCheckpoint(playerid)
{
   // your code here
}
public OnPlayerLeaveCheckpoint(playerid)
{
   // your code here
}
Set a variable for each checkpoint and enter your codes into OnPlayerEnterCheckpoint and OnPlayerLeaveCheckpoint, that's all.


AW: /mission and get Money - Saize - 14.10.2012

With the Code you mean the position is it right?
And how should I do set the Varґs?


Re: AW: /mission and get Money - Calabresi - 14.10.2012

Quote:
Originally Posted by Saize
Посмотреть сообщение
With the Code you mean the position is it right?
And how should I do set the Varґs?
Search the tutorials forums, there are hundreds of tutorials about setting checkpoints.


AW: /mission and get Money - Saize - 14.10.2012

Okay but I donґt understand what you are meaning with Code.

Do you meaning the Variable or the position of the CP?


Re: AW: /mission and get Money - Calabresi - 14.10.2012

Quote:
Originally Posted by Saize
Посмотреть сообщение
Okay but I donґt understand what you are meaning with Code.

Do you meaning the Variable or the position of the CP?
Код:
SetPlayerCheckpoint(playerid, 0, 0, 0, 5);

public OnPlayerEnterCheckpoint(playerid)
{
	if(IsPlayerInRangeOfPoint(playerid, 5, 0, 0, 0))
	{
		GivePlayerWeapon(playerid, 24, 9999);
		DisablePlayerCheckpoint(playerid);
	}
	return 1;
}
You can do it like this (basic level), never mind that variable thing.