Need help with job systems -
Heisenbergx2 - 13.08.2013
EDIT: NO LONGER NEED HELP HERE THANKS
I was wondering how do I create multiple jobs. I have now 1 job in my scripts:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/job 1", cmdtext, true, 10) == 0)
{
Job[playerid] = 1;
SetPlayerCheckpoint(playerid, 261.4925 , -270.4117 , 1.5781 , 1);
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Go to the red marker to get the package");
return 1;
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(Job[playerid] == 1)
{
Job[playerid] = 2;
SetPlayerCheckpoint(playerid, 2469.0454 , -1278.4165 , 30.3664 , 1);
SendClientMessage(playerid, 0x489048FF , "--------------------------------------------------------------");
SendClientMessage(playerid, 0x489048FF , "You have recieved the package");
SendClientMessage(playerid, 0x489048FF , "Take the package to the next checkpoint");
return 1;
}
if(Job[playerid] == 2)
{
GivePlayerMoney(playerid , 300);
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "You have succesfully delievered the package, payment: 300$");
DisablePlayerCheckpoint(playerid);
}
return 1;
}
So the question is how can I make a second one with a same style?
Re: Need help with job systems -
verlaj - 13.08.2013
new Job2[MAX_PLAYERS];
if (strcmp("/job 2", cmdtext, true, 10) == 0)
{
if(Job2[playerid] == 1) // added to avoid bugs
{
Job2[playerid] = 1;
SetPlayerCheckpoint(playerid, 261.4925 , -270.4117 , 1.5781 , 1); //maybe any other coordinates
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Go to the red marker to get the package");
return 1;
}
else
{
SendClientMessage // about that he is already in a job
if(Job2[playerid] == 1)
{
GivePlayerMoney(playerid , 300);
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "You have succesfully delievered the package, payment: 300$");
DisablePlayerCheckpoint(playerid);
}
Re: Need help with job systems -
Heisenbergx2 - 13.08.2013
Allright, thanks dude, I will now try that out
Re: Need help with job systems -
Heisenbergx2 - 13.08.2013
Getting loads of error with this, can you spot the problem:
pawn Код:
if (strcmp("/job 2", cmdtext, true, 10) == 0)
{
if(Job2[playerid] == 1) // added to avoid bugs
{
if(IsPlayerInRangeOfPoint(playerid , 1.3 , 263.3929 , 21.8302 , 3.4332))
{
if(IsPlayerInVehicle(playerid , 498))
{
Job2[playerid] = 1;
SetPlayerCheckpoint(playerid, 1423.0439 , 273.5977 , 19.5547 , 2);
SendClientMessage(playerid , 0x489048FF , "---------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Go to the Montgomery Hardware Store to deliever the tools");
return 1;
}
else
{
SendClientMessage(playerid , 0x489048FF , "You are already working"); // about that he is already in a job
return 1;
}
return 0;
}
Re: Need help with job systems -
Heisenbergx2 - 13.08.2013
Allright I fixed the previous one but here is a new problem (at OnPlayerEnterCheckPoint):
pawn Код:
if(Job2[playerid] == 1)
{
if(IsPlayerInVehicle(playerid , 498))
{
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Now go to Fort Carson to deliever the chemicals to the Laundry");
SetPlayerCheckpoint(playerid , -174.3220 , 1170.8254 , 19.7500 , 2 );
return 1;
}
}
if(Job2[playerid] == 2)
{
if(IsPlayerInVehicle(playerid , 498))
{
SetPlayerCheckpoint(playerid , 655.4785 , 1697.1421 ,6.9922 , 2);
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Now go to the gas station to deliever the tools");
return 1;
}
}
if(Job2[playerid] == 3)
{
if(IsPlayerInVehicle(playerid , 498))
{
SetPlayerCheckpoint(playerid , 247.1548 , 17.8391 , 2.5254 , 2);
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "Now go to back to the trucking company to claim your payment");
return 1;
}
}
if(Job2[playerid] == 4)
{
if(IsPlayerInVehicle(playerid , 498))
{
GivePlayerMoney(playerid , 1000))
SendClientMessage(playerid , 0x489048FF , "------------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "You have completed your job and you recieved 1000$");
}
}
return 1;
}
EDIT: Here's the error list
pawn Код:
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(229) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(231) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(236) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(239) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(241) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(246) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(249) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(251) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(256) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(259) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(261) : error 010: invalid function or declaration
C:\Users\Sami\Desktop\SERVU\RPtest.pwn(268) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
12 Errors.
Re: Need help with job systems -
Heisenbergx2 - 13.08.2013
Allright this is solved now!