PaperBoy Job system ! -
DarkLight - 21.08.2015
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);
}
}
Re: PaperBoy Job system ! -
Jakwob - 21.08.2015
Nice work mate +rep
Re: PaperBoy Job system ! -
DarkLight - 21.08.2015
Quote:
Originally Posted by Jakwob
Nice work mate +rep
|
Thank you
Re: PaperBoy Job system ! -
iMTube™ - 21.08.2015
good +rep
Re: PaperBoy Job system ! -
DarkLored - 21.08.2015
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.
Re: PaperBoy Job system ! -
X337 - 22.08.2015
Good job
Re: PaperBoy Job system ! -
DarkLight - 22.08.2015
Thx all
Re: PaperBoy Job system ! -
RocketBoy - 22.08.2015
Nic3e
Re: PaperBoy Job system ! -
SoNikMells - 22.08.2015
Reputation raise, praise. but in fact the cattle code.
Well, let's go step by step....
PHP код:
if (strcmp("/paperboy", cmdtext, true, 10) == 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(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 510)
{
SendClientMessage(playerid, COLOR_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(playerid, cmdtext[])
{
if (!strcmp("/paperboy", cmdtext, true, 9))
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 510)
{
PaperJob[playerid] = 1;
new string[48];
GetPlayerName(playerid, string, 21);
format(string, sizeof(string), "* %s is now a Paperboy.", string);
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 true;
}
SendClientMessage(playerid, COLOR_RED,"You Must to be in Mountain bike to start the job!");
}
return false;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(GetVehicleModel(vehicleid) == 510)
{
SendClientMessage(playerid, COLOR_RED, "* You can start the Paper courier by using /paper");
}
return true;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 510)
{
switch(PaperJob[playerid])
{
case 1: SetPlayerCheckpoint(playerid,2012.4771,-1640.1229,13.1431,10),
SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
case 2: SetPlayerCheckpoint(playerid,2387.0063,-1667.1498,13.1249,10);
case 3: SetPlayerCheckpoint(playerid,2414.9255,-1649.6678,13.1305,10);
case 4: SetPlayerCheckpoint(playerid,2517.6394,-1678.3141,13.9862,10);
case 5: SetPlayerCheckpoint(playerid,2441.1526,-2017.4093,13.1231,10);
case 6: SetPlayerCheckpoint(playerid,2486.2058,-2017.6384,13.1309,10);
case 7: SetPlayerCheckpoint(playerid,2520.9238,-2016.4714,13.1395,10);
case 8: SetPlayerCheckpoint(playerid,2464.7258,-2000.3944,13.1430,10);
case 9: SetPlayerCheckpoint(playerid,2240.8374,-1886.9504,13.1486,10);
case 10: SetPlayerCheckpoint(playerid,2095.5488,-1815.7517,12.9792,10);
case 11:
{
SendClientMessage(playerid, COLOR_YELLOW, "* You have recieved $1000.");
DisablePlayerCheckpoint(playerid);
GivePlayerMoney(playerid, 1000);
PaperJob[playerid] = 0;
return;
}
}
PaperJob[playerid]++;
}
return;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(PaperJob[playerid])
{
PaperJob[playerid] = 0;
SendClientMessage(playerid, COLOR_RED, "* You have left your job, you won't be payed.");
DisablePlayerCheckpoint(playerid);
}
}
Re: PaperBoy Job system ! -
DarkLight - 22.08.2015
Thanks for the correction