[FilterScript] PaperBoy Job system !
#1

CMDS
/paperboy
Note
You must be in Mountain Bike to star Job
Код:
#include <a_samp>

#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA

new PaperJob[256];

public OnFilterScriptInit()
{
}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/paperboy", cmdtext, true, 10) == 0)
	{
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 510)
      	{
      	    PaperJob[playerid] = 1;
            new name[MAX_PLAYER_NAME], string[48];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "* %s is now a Paperboy.", name );
            SendClientMessageToAll(COLOR_YELLOW, string);
            SetPlayerCheckpoint(playerid,2012.6134,-1729.3796,13.1536,10);
			SendClientMessage(playerid,COLOR_YELLOW,"* Follow the red markers and you'll recieve money!");
			return 1;
	    }
		SendClientMessage(playerid, COLOR_RED,"You Must to be in Mountain bike to start the job!");
	}
	return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 510)
     {
         SendClientMessage(playerid, COLOR_RED, "* You can start the Paper courier by using /Paper");
     }
     return 0;
}
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 510)
     {
		if(PaperJob[playerid] == 1){
        	PaperJob[playerid] = 2;
        	SetPlayerCheckpoint(playerid,2012.4771,-1640.1229,13.1431,10);
        	SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
        	return 1;
         }
		if(PaperJob[playerid] == 2){
         	PaperJob[playerid] = 3;
	     	SetPlayerCheckpoint(playerid,2387.0063,-1667.1498,13.1249,10);
	     	return 1;
         }
		if(PaperJob[playerid] == 3){
         	PaperJob[playerid] = 4;
	     	SetPlayerCheckpoint(playerid,2414.9255,-1649.6678,13.1305,10);
	     	return 1;
         }
		if(PaperJob[playerid] == 4){
         	PaperJob[playerid] = 5;
	     	SetPlayerCheckpoint(playerid,2517.6394,-1678.3141,13.9862,10);
	     	return 1;
         }
 		if(PaperJob[playerid] == 5){
         	PaperJob[playerid] = 6;
	     	SetPlayerCheckpoint(playerid,2441.1526,-2017.4093,13.1231,10);
	     	return 1;
         }
		if(PaperJob[playerid] == 6){
         	PaperJob[playerid] = 7;
	     	SetPlayerCheckpoint(playerid,2486.2058,-2017.6384,13.1309,10);
	     	return 1;
         }
		if(PaperJob[playerid] == 7){
         	PaperJob[playerid] = 8;
	     	SetPlayerCheckpoint(playerid,2520.9238,-2016.4714,13.1395,10);
	     	return 1;
         }
 		if(PaperJob[playerid] == 8){
         	PaperJob[playerid] = 9;
	     	SetPlayerCheckpoint(playerid,2464.7258,-2000.3944,13.1430,10);
	     	return 1;
         }
		if(PaperJob[playerid] == 9){
         	PaperJob[playerid] = 10;
	     	SetPlayerCheckpoint(playerid,2240.8374,-1886.9504,13.1486,10);
	     	return 1;
         }
		if(PaperJob[playerid] == 10){
         	PaperJob[playerid] = 11;
	     	SetPlayerCheckpoint(playerid,2095.5488,-1815.7517,12.9792,10);
	     	return 1;
         }
		if(PaperJob[playerid] == 11){
         	PaperJob[playerid] = 0;
	     	DisablePlayerCheckpoint(playerid);
	     	SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $1000.");
	     	GivePlayerMoney(playerid,1000);
         }
     }
     return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
	if(PaperJob[playerid] > 0)
	{
	    PaperJob[playerid] = 0;
	    SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
	    DisablePlayerCheckpoint(playerid);
	}
}
Reply
#2

Nice work mate +rep
Reply
#3

Quote:
Originally Posted by Jakwob
Посмотреть сообщение
Nice work mate +rep
Thank you
Reply
#4

good +rep
Reply
#5

really simple, you could have put more effort into it and complexity to make the job more interesting, but you have done good work, good job.
Reply
#6

Good job
Reply
#7

Thx all
Reply
#8

Nic3e
Reply
#9

Reputation raise, praise. but in fact the cattle code.

Well, let's go step by step....

PHP код:
if (strcmp("/paperboy"cmdtexttrue10) == 0)
// 10 Why, if the character 9? 
PHP код:
new PaperJob[256];
// 256 - number of cells players. in this case it is better to do so
new PaperJob[MAX_PLAYERS]; 
PHP код:
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
     if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 510)
     {
         
SendClientMessage(playeridCOLOR_RED"* You can start the Paper courier by using /Paper");
     }
     return 
0;
/*
this check you get going transportation: 0
Reason: The first is called Public, and only then after a few milliseconds GetPlayerVehicleID will working properly
*/
    
if(GetVehicleModel(vehicleid) == 510)

And then I'll show you the right way to implement your program
PHP код:
#include <a_samp>
#define COLOR_DARKGOLD 0x808000AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
new PaperJob[MAX_PLAYERS];
public 
OnFilterScriptInit()
{
    return 
true;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if (!
strcmp("/paperboy"cmdtexttrue9))
    {
        if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 510)
          {
            
PaperJob[playerid] = 1;
            new 
string[48];
            
GetPlayerName(playeridstring21);
            
format(stringsizeof(string), "* %s is now a Paperboy."string);
            
SendClientMessageToAll(COLOR_YELLOWstring);
            
SetPlayerCheckpoint(playerid2012.6134, -1729.379613.1536,10);
            
SendClientMessage(playerid,COLOR_YELLOW,"* Follow the red markers and you'll recieve money!");
            return 
true;
        }
        
SendClientMessage(playeridCOLOR_RED,"You Must to be in Mountain bike to start the job!");
    }
    return 
false;
}
public 
OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
     if(
GetVehicleModel(vehicleid) == 510)
     {
         
SendClientMessage(playeridCOLOR_RED"* You can start the Paper courier by using /paper");
     }
     return 
true;
}
public 
OnPlayerEnterCheckpoint(playerid)
{
    if(
GetVehicleModel(GetPlayerVehicleID(playerid)) == 510)
    {
        switch(
PaperJob[playerid])
        {
            case 
1SetPlayerCheckpoint(playerid,2012.4771,-1640.1229,13.1431,10),
                    
SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
            case 
2SetPlayerCheckpoint(playerid,2387.0063,-1667.1498,13.1249,10);
            case 
3SetPlayerCheckpoint(playerid,2414.9255,-1649.6678,13.1305,10);
            case 
4SetPlayerCheckpoint(playerid,2517.6394,-1678.3141,13.9862,10);
            case 
5SetPlayerCheckpoint(playerid,2441.1526,-2017.4093,13.1231,10);
            case 
6SetPlayerCheckpoint(playerid,2486.2058,-2017.6384,13.1309,10);
            case 
7SetPlayerCheckpoint(playerid,2520.9238,-2016.4714,13.1395,10);
            case 
8SetPlayerCheckpoint(playerid,2464.7258,-2000.3944,13.1430,10);
            case 
9SetPlayerCheckpoint(playerid,2240.8374,-1886.9504,13.1486,10);
            case 
10SetPlayerCheckpoint(playerid,2095.5488,-1815.7517,12.9792,10);
            case 
11:
            {
                
SendClientMessage(playeridCOLOR_YELLOW"* You have recieved $1000.");
                
DisablePlayerCheckpoint(playerid);
                
GivePlayerMoney(playerid1000);
                
PaperJob[playerid] = 0;
                return;
            }
        }
        
PaperJob[playerid]++;
    }
    return;
}
public 
OnPlayerExitVehicle(playeridvehicleid)
{
    if(
PaperJob[playerid])
    {
        
PaperJob[playerid] = 0;
        
SendClientMessage(playeridCOLOR_RED"* You have left your job, you won't be payed.");
        
DisablePlayerCheckpoint(playerid);
    }

Reply
#10

Thanks for the correction
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)