Need help with two things.
#1

One, why isn't this working properly? It's mean to spawn an info icon and when you're over it you type /getjob and it gives you the job, but you get get the job anywhere and the icon doesn't seem to spawn. Also, when I made checkpoints they aren't showing up on the map, why?
Code.

pawn Код:
//Start of jobs

public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 531)
     {
        if(ExJob[playerid] == 1){
            ExJob[playerid] = 2;
            SetPlayerCheckpoint(playerid,50.2074,-86.3620,0.6094,10);
            SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
            return 1;
         }
        if(ExJob[playerid] == 2){
            ExJob[playerid] = 3;
            SetPlayerCheckpoint(playerid,42.8746,-114.5679,0.6169,10);
            return 1;
         }
        if(ExJob[playerid] == 3){
            ExJob[playerid] = 4;
            SetPlayerCheckpoint(playerid,42.8746,-114.5679,0.6169,10);
            return 1;
         }
        if(ExJob[playerid] == 4){
            ExJob[playerid] = 5;
            SetPlayerCheckpoint(playerid,33.0193,-118.6128,0.6169,10);
            return 1;
         }
        if(ExJob[playerid] == 5){
            ExJob[playerid] = 6;
            SetPlayerCheckpoint(playerid,42.6236,-71.0327,0.6094,10);
            return 1;
         }
        if(ExJob[playerid] == 6){
            ExJob[playerid] = 7;
            SetPlayerCheckpoint(playerid,37.0597,-61.5438,1.5049,10);
            return 1;
         }
        if(ExJob[playerid] == 7){
            ExJob[playerid] = 8;
            SetPlayerCheckpoint(playerid,17.9072,-119.0836,0.6094,10);
            return 1;
         }
         if(ExJob[playerid] == 8){
            ExJob[playerid] = 9;
            SetPlayerCheckpoint(playerid,31.6652,-50.3610,2.5574,10);
            return 1;
         }
        if(ExJob[playerid] == 8){
            ExJob[playerid] = 9;
            SetPlayerCheckpoint(playerid,9.0930,-116.7551,0.6390,10);
            return 1;
         }
        if(ExJob[playerid] == 9){
            ExJob[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $300 for your work!");
            GivePlayerMoney(playerid,150);
         }
     }
     return 1;
}


// Get Job command

CMD:getjob(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 4.0,-46.5548,-108.5900,3.1172)) // Replace RANGE = Distance when he can use, and X,Y,Z with your pick-up coordinates
    wJob[playerid] = 1; // 1 = YourJobName from defines !
    SendClientMessage(playerid, -1, "{FF0000}[INFO]: {15FF00}You have chose your job."); // He will get a job  !
    return 1;
}

// For making a command only for that job :

CMD:CommandName(playerid, params[])
{
    if(wJob[playerid] != 1) //Number "1" is your job name.
        return SendClientMessage(playerid, 0xAFAFAFAA, "You don't have this job"); // Get a message he haven't that job !

    SendClientMessage(playerid,-1,"Your job command Text or code"); // If he have that job
    return 1;
}

// For Quit Job (You don't have any job)

CMD:quitjob(playerid, params[])
{
    wJob[playerid] = 0; //Now you don't have any job !
    SendClientMessage(playerid,0xAFAFAFAA,"Now you're unemployed"); // Text
    return 1;
}
Also, how would I make it so that when someone joins the server their name appears in yellow and then it shows their IP next to it. Let me give an example.

Michael_J_Dillon has joined the server [IP: (IP HERE)]
Reply
#2

emm xD two problem:

Код:
new s[120], xip[24], aname[24];
GetPlayerIp(playerid, xip, 24);
GetPlayerName(playerid, aname, 24);
format(s, 120, "{E4BD22}%s {FFFFFF}has joined the server [IP: (%s)]", aname, xip);
SendClientMessage(playerid, -1, s); //Here you replace it for your function.
Note: Sorry for me english but i only help in spanis version. >.<
Reply
#3

Your message will show no matter how far you are away from the checkpoint and using the command:

pawn Код:
CMD:getjob(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 4.0,-46.5548,-108.5900,3.1172))
    {
        wJob[playerid] = 1; // 1 = YourJobName from defines !
        SendClientMessage(playerid, -1, "{FF0000}[INFO]: {15FF00}You have chose your job."); // place the message inside with the brackets, then everything will depend on if the statement above is true.
        //if it is not true, none of that above will show.
    }
    else
   {
         //send a message or something here saying that the player is not close to the checkpoint if you want to
    }
    return 1;
}
That should work to prevent the message appearing saying that you started a job anywhere. Now it will only work when you are in range of the point.

Try it, and see.


Also, i would need to see the code where you spawn the checkpoint for the job; and where you spawn the checkpoints for driving through.
Reply
#4

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 531)
     {
        if(ExJob[playerid] == 1){
            ExJob[playerid] = 2;
            SetPlayerCheckpoint(playerid,50.2074,-86.3620,0.6094,10);
            SendClientMessage(playerid,COLOR_YELLOW,"* Please go to the next mark, and you'll be payed!");
            return 1;
         }
        if(ExJob[playerid] == 2){
            ExJob[playerid] = 3;
            SetPlayerCheckpoint(playerid,42.8746,-114.5679,0.6169,10);
            return 1;
         }
        if(ExJob[playerid] == 3){
            ExJob[playerid] = 4;
            SetPlayerCheckpoint(playerid,42.8746,-114.5679,0.6169,10);
            return 1;
         }
        if(ExJob[playerid] == 4){
            ExJob[playerid] = 5;
            SetPlayerCheckpoint(playerid,33.0193,-118.6128,0.6169,10);
            return 1;
         }
        if(ExJob[playerid] == 5){
            ExJob[playerid] = 6;
            SetPlayerCheckpoint(playerid,42.6236,-71.0327,0.6094,10);
            return 1;
         }
        if(ExJob[playerid] == 6){
            ExJob[playerid] = 7;
            SetPlayerCheckpoint(playerid,37.0597,-61.5438,1.5049,10);
            return 1;
         }
        if(ExJob[playerid] == 7){
            ExJob[playerid] = 8;
            SetPlayerCheckpoint(playerid,17.9072,-119.0836,0.6094,10);
            return 1;
         }
         if(ExJob[playerid] == 8){
            ExJob[playerid] = 9;
            SetPlayerCheckpoint(playerid,31.6652,-50.3610,2.5574,10);
            return 1;
         }
        if(ExJob[playerid] == 8){
            ExJob[playerid] = 9;
            SetPlayerCheckpoint(playerid,9.0930,-116.7551,0.6390,10);
            return 1;
         }
        if(ExJob[playerid] == 9){
            ExJob[playerid] = 0;
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid,COLOR_YELLOW,"* You have recieved $300 for your work!");
            GivePlayerMoney(playerid,150);
         }
     }
     return 1;
}
And how would I make their IP show on login? (and their name in yellow).
Reply
#5

That code you provided is only showing when a player is entering a checkpoint, and what to do next. You need to create the very first checkpoint in your job command:

pawn Код:
CMD:getjob(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 4.0,-46.5548,-108.5900,3.1172))
    {
        wJob[playerid] = 1;
        SendClientMessage(playerid, -1, "{FF0000}[INFO]: {15FF00}You have chose your job.");
        SetPlayerCheckpoint(/*THE POS FOR THE FIRST CHECKPOINT IN HERE*/); //Modify this to be correct with your code.
     
    }
    else
   {
         //send a message or something here saying that the player is not close to the checkpoint if you want to
    }
    return 1;
}

And in order to make join messages like you want; you can do something like this, which he posted above me. Just add it under "OnPlayerConnect"


pawn Код:
public OnPlayerConnect(playerid)
{
    new s[70], xip[24], aname[24];
    GetPlayerIp(playerid, xip, 24); //Get the ip and save it into "xip"
    GetPlayerName(playerid, aname, 24); //Get the name of the player and save it into "aname"
    format(s, sizeof(s), "{FF9E00}%s {FFFFFF}has joined the server [IP: (%s)]", aname, xip); //add this message into the "s"  string and add the variables we found above
    SendClientMessage(playerid, -1, s); //then send the string we made
    return 1;
}
Reply
#6

Quote:
Originally Posted by airplanesimen
Посмотреть сообщение
That code you provided is only showing when a player is entering a checkpoint, and what to do next. You need to create the very first checkpoint in your job command:

pawn Код:
CMD:getjob(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 4.0,-46.5548,-108.5900,3.1172))
    {
        wJob[playerid] = 1;
        SendClientMessage(playerid, -1, "{FF0000}[INFO]: {15FF00}You have chose your job.");
        SetPlayerCheckpoint(/*THE POS FOR THE FIRST CHECKPOINT IN HERE*/); //Modify this to be correct with your code.
     
    }
    else
   {
         //send a message or something here saying that the player is not close to the checkpoint if you want to
    }
    return 1;
}

And in order to make join messages like you want; you can do something like this, which he posted above me. Just add it under "OnPlayerConnect"


pawn Код:
public OnPlayerConnect(playerid)
{
    new s[70], xip[24], aname[24];
    GetPlayerIp(playerid, xip, 24); //Get the ip and save it into "xip"
    GetPlayerName(playerid, aname, 24); //Get the name of the player and save it into "aname"
    format(s, sizeof(s), "{FF9E00}%s {FFFFFF}has joined the server [IP: (%s)]", aname, xip); //add this message into the "s"  string and add the variables we found above
    SendClientMessage(playerid, -1, s); //then send the string we made
    return 1;
}
I tried this, but it said that the symbol getplayerip is already defined.
Reply
#7

With the IP thingy, it's only showing half of the IP.
Reply
#8

Okay im sorry about that. Replace 70 with 100 on all places. (the string lenght)

Try that And this is not a script request section, this is to get help with problems you face while scripting, just so you are aware of that.
Reply
#9

-.- mi script is with 120 lenght.. no change is nice..
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)