Making jobs , job spawns colors
#1

Hello guys , ive been trying to add jobs& spawns followed by instructions below:

whenever someone without a job spawns, we see The message (!) Welcome to citizen : playername(playerid)

and whenever someone with a job spawns, we see the message (!) Welcome to (jobname): playername(playerid)

and i have been also trying to make the player spawn in the place he logged off last time instead of spawning in the same starter point.


Finally i need each player has a speceic skin for each job, and then they respawn in their job spawn after death.


This is really complicated, i'd really appreciate your help thanks!
Reply
#2

Well, make a Variable that checks if the player is in that job and if he spawns it will send him that message.
For example if that player is in that job it will set that variable to 1. If the variable = 1 it will always send him that message when he spawns. And if that variable is 1 it will always spawn him in his Job location.
Hope you understand.

Example:
Quote:
public OnPlayerConnect(playerid)
{
if(IsWorking == 1) return {
SetSpawnInfo();
SendClientMessage();
}
else if(IsWorking == 0) return {
SetSpawnInfo();
SendClientMessage();
}
return 1;

}

Reply
#3

this script explains that if a player has a job he recieves a messae , and others recieve another message. well thats part of the script

BUt my point is , there are multiple jobs like 10 whenever a certain job connects he gets the appopriate color for his job and we see the message welcome to (jobname)layername(playerid)

and every player with a job has his own color for example if he i a farmer he gets gray color
Reply
#4

Quote:
Originally Posted by TheButler
Посмотреть сообщение
this script explains that if a player has a job he recieves a messae , and others recieve another message. well thats part of the script

BUt my point is , there are multiple jobs like 10 whenever a certain job connects he gets the appopriate color for his job and we see the message welcome to (jobname)layername(playerid)

and every player with a job has his own color for example if he i a farmer he gets gray color

Well, You can add more Variables, like this:

Quote:

new Farmer;
new Miner;
new Lumberjack;
new Unemployed;

public OnPlayerConnect(playerid)
{
if(Farmer == 1)
{
SetPlayerColor()
}
if(Miner == 1)
{
SetPlayerColor()
}
if(Lumberjack == 1)
{
SetPlayerColor()
}
if(Unemployed == 1)
{
SetPlayerColor()
}
return 1;
}

Reply
#5

Thanksss :3
Reply
#6

The code provided by @MSC won't work properly, as if you change the variable's value, it will be given to the whole server's players. As they are not per-player variables. Plus could easily avoid one variable per job, and declare an array.


Код:
enum
{
    Farmer,
    Lumberjack,
    Miner,
    Unemployed
};

new PlayerJob[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    switch(PlayerJob[playerid])
    {
        case Farmer: SetPlayerColor(playerid, -1);
        case Lumberjack: SetPlayerColor(playerid, -1);
        case Miner: SetPlayerColor(playerid, -1);
        case Unemployed: SetPlayerColor(playerid, -1);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)