Job salary - 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: Job salary (
/showthread.php?tid=425227)
Job salary -
Squirrel - 25.03.2013
How do I actualy make each salary for each job? Basicaly I want to define the salaries but I dont know how.
For the jobs I use for example
Код:
if(PlayerInfo[playerid][pJob] == 1) //If the jobs is Drug dealer
if(PlayerInfo[playerid][pJob] == 1) //If the jobs is gun dealer
Here is what I did so far and it works. But I need to define the salaries :/
Код:
public PayDay(playerid)
{
for (new i; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
new nxtlevel = PlayerInfo[playerid][pLevel];
new payday = nxtlevel*0;
GivePlayerMoney(i,payday);
PlayerInfo[playerid][pExp]++;
GameTextForPlayer(i," ~p~ PayDay",6,5000);
if(PlayerInfo[playerid][pVIPlevel] == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
SendClientMessage(playerid, COLOR_GREEN, "Paycheck: 150$");
SendClientMessage(playerid, COLOR_GREEN, "Boost: +1 playing hour!");
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
GivePlayerMoney(playerid, 150);
}
if(PlayerInfo[playerid][pVIPlevel] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
SendClientMessage(playerid, COLOR_GREEN, "Paycheck: 150$");
SendClientMessage(playerid, COLOR_GREEN, "Boost: +1 playing hour!");
SendClientMessage(playerid, COLOR_GREEN, "Bronze Donator: +100!");
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
GivePlayerMoney(playerid, 250);
}
if(PlayerInfo[playerid][pVIPlevel] == 2)
{
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
SendClientMessage(playerid, COLOR_GREEN, "Paycheck: 150$");
SendClientMessage(playerid, COLOR_GREEN, "Boost: +1 playing hour!");
SendClientMessage(playerid, COLOR_GREEN, "Gold Donator: +200!");
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
GivePlayerMoney(playerid, 350);
}
PlayerPlayMusic(playerid);
}
}
}
Re: Job salary -
Dubya - 25.03.2013
pawn Код:
new JobSalarys[] = {
0, // Job ID 0's salary [default no job?]
1000, // Job ID 1's salary [idk job]
1000, // Job ID 2's salary [idk job]
1000, // Job ID 3's salary [idk job]
1000, // Job ID 4's salary [idk job]
1000, // Job ID 5's salary [idk job]
1000, // Job ID 6's salary [idk job]
1000 // Job ID 7's salary [idk job]
}; // etc
// now add to your public Payday
// AFTER new payday = nxtlevel*0
payday += JobSalarys[PlayerInfo[playerid][pJob]];
Re: Job salary -
Squirrel - 25.03.2013
Thanks
Re: Job salary -
Squirrel - 25.03.2013
Oh wait, it doesnt work :/
Код:
public PayDay(playerid)
{
for (new i; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
new nxtlevel = PlayerInfo[playerid][pLevel];
new payday = nxtlevel*0;
GivePlayerMoney(i,payday);
PlayerInfo[playerid][pExp]++;
GameTextForPlayer(i," ~p~ PayDay",6,5000);
payday += JobSalarys[PlayerInfo[playerid][pJob]];
if(PlayerInfo[playerid][pVIPlevel] == 0)
{
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
SendClientMessage(playerid, COLOR_GREEN, "Paycheck: 150$");
SendClientMessage(playerid, COLOR_GREEN, "Boost: +1 playing hour!");
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
GivePlayerMoney(playerid, 150);
}
if(PlayerInfo[playerid][pVIPlevel] == 1)
{
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
SendClientMessage(playerid, COLOR_GREEN, "Paycheck: 150$");
SendClientMessage(playerid, COLOR_GREEN, "Boost: +1 playing hour!");
SendClientMessage(playerid, COLOR_GREEN, "Bronze Donator: +100!");
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
GivePlayerMoney(playerid, 250);
}
if(PlayerInfo[playerid][pVIPlevel] == 2)
{
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
SendClientMessage(playerid, COLOR_GREEN, "Paycheck: 150$");
SendClientMessage(playerid, COLOR_GREEN, "Boost: +1 playing hour!");
SendClientMessage(playerid, COLOR_GREEN, "Gold Donator: +200!");
SendClientMessage(playerid, COLOR_YELLOW, "[Payday] [Payday]");
GivePlayerMoney(playerid, 350);
}
PlayerPlayMusic(playerid);
}
}
}