SA-MP Forums Archive
Simple job help - 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: Simple job help (/showthread.php?tid=346279)



Simple job help - TheDiscussionCafe - 27.05.2012

hi guys. im taking english classes so i hope my english is getting better

anyways, i downloaded this script:

pawn Код:
public OnGameModeInit()
{
    CreateObject(1318,-64.00827789,-1120.72668457,0.71267354,0.00000000,0.00000000,332.00000000); //object(arrow) (1)
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    GivePlayerMoney(playerid, 7500);
    SendClientMessage(playerid, blue, "Congratulations, you have earned 7500");
    DisablePlayerCheckpoint(playerid);
    return 1;
}

COMMAND:work(playerid, cmdtext)
{
    if (!IsPlayerInRangeOfPoint(playerid, 7.0, -64.1551,-1120.6709,1.0781))
    {
        return SendClientMessage(playerid, COLOR_RED, "You're not in range of the job");
    }
    SendClientMessage(playerid, blue, "Welcome to work!");
    SendClientMessage(playerid, yellow, "Please drive to the checkpoint to recieve your reward.");
    new thevehicle = CreateVehicle(498, -79.2382, -1128.1711, 1.0781, 0.0, 0, 0, 5000);
    PutPlayerInVehicle(playerid, thevehicle, 0);
    SetPlayerCheckpoint(playerid, 1827.8311,-1075.7113,23.9317, 4.0);
    return 1;
}
its a simple job script. so as you can see if player is in the range of the arrow they can type in /work and they can start the work in the truck ID 498. so now the player have to drive to the check point. when he gets in checkpoint, he just needs to go into the checkpoint to get money. but how i make it so if player is NOT in vehicle ID 498, it will say "you must be in {that speicfic vehicle}!" or something like that? and if player is in vehicle ID 498, it will give player money. can someone help me?


Re: Simple job help - FalconX - 27.05.2012

Heres what I've made for you hope it helps

pawn Код:
public OnGameModeInit()
{
    CreateObject(1318,-64.00827789,-1120.72668457,0.71267354,0.00000000,0.00000000,332.00000000); //object(arrow) (1)
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    new vehicle = GetPlayerVehicle(playerid); // declares a new var called "vehicle"
    if(vehicle == 498) // checking if the vehicle is 498 else it will return a error message
    {
        GivePlayerMoney(playerid, 7500);
        SendClientMessage(playerid, blue, "Congratulations, you have earned 7500");
        DisablePlayerCheckpoint(playerid);
    }
    else
    {
        SendClientMessage(playerid, -1, "YOUR ERROR MESSAGE - YOUR VEHICLE IS NOT 498");
    }
    return 1;
}

COMMAND:work(playerid, params[]) // zcmd always works with "params[]" I don't think "cmdtext" will work.
{
    if (!IsPlayerInRangeOfPoint(playerid, 7.0, -64.1551,-1120.6709,1.0781))
    {
        return SendClientMessage(playerid, COLOR_RED, "You're not in range of the job");
    }
    else
    {
        SendClientMessage(playerid, blue, "Welcome to work!");
        SendClientMessage(playerid, yellow, "Please drive to the checkpoint to recieve your reward.");
        new thevehicle = CreateVehicle(498, -79.2382, -1128.1711, 1.0781, 0.0, 0, 0, 5000);
        PutPlayerInVehicle(playerid, thevehicle, 0);
        SetPlayerCheckpoint(playerid, 1827.8311,-1075.7113,23.9317, 4.0);
    }
    return 1;
}
Regards FalconX


Re: Simple job help - TzAkS. - 27.05.2012

add
Код:
if(GetVehicleModel(vehicleid) != 498) return SendClientMessage(playerid, -1 "Message here");
Edit: To late


Re: Simple job help - TheDiscussionCafe - 27.05.2012

thank you guys. +rep but since it's setplayercheckpoint, as soon as i see another checkpoint in my game, the work checkpoint destination disappears. can anyboddy help me?


Re: Simple job help - [ABK]Antonio - 27.05.2012

Quote:
Originally Posted by TheDiscussionCafe
Посмотреть сообщение
thank you guys. +rep but since it's setplayercheckpoint, as soon as i see another checkpoint in my game, the work checkpoint destination disappears. can anyboddy help me?
Get a streamer (****** samp streamer)


Re: Simple job help - FalconX - 27.05.2012

Quote:
Originally Posted by TheDiscussionCafe
Посмотреть сообщение
thank you guys. +rep but since it's setplayercheckpoint, as soon as i see another checkpoint in my game, the work checkpoint destination disappears. can anyboddy help me?
for that you need a streamer plugin in which you can stream as many checkpoints you want.

or just use vars, new cp = CreateDynamicCP(...); like that.

and then use it

https://sampforum.blast.hk/showthread.php?tid=102865
-FalconX


Re: Simple job help - TheDiscussionCafe - 27.05.2012

Quote:
Originally Posted by FalconX
Посмотреть сообщение
for that you need a streamer plugin in which you can stream as many checkpoints you want.

or just use vars, new cp = CreateDynamicCP(...); like that.

and then use it

https://sampforum.blast.hk/showthread.php?tid=102865
-FalconX
hello, i already have the streamer plugin but what and where do i add it in my script?


Re: Simple job help - FalconX - 27.05.2012

Quote:
Originally Posted by TheDiscussionCafe
Посмотреть сообщение
hello, i already have the streamer plugin but what and where do i add it in my script?
you need it to include it to your game-mode. Like the following:-

pawn Код:
#include <streamer>
and then you can start using your checkpoints, pickups and much more!

-FalconX


Re: Simple job help - CidadeNovaRP - 27.05.2012

pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 498)
{
    SendClientMessage(playerid, 0xFFFFFFFF, "End Work!");
    GivePlayerMoney(playerid, 1000); //Money
}
else
{
    SendClientMessage(playerid, 0xFFFFFFFF, "You don't in 498 Vehicle Model and no Give your money!");
}
#edited


Re: Simple job help - TheDiscussionCafe - 27.05.2012

Quote:
Originally Posted by FalconX
Посмотреть сообщение
you need it to include it to your game-mode. Like the following:-

pawn Код:
#include <streamer>
and then you can start using your checkpoints, pickups and much more!

-FalconX
no they still do the same thing, the work checkpoint disappears. do you think you can replace the checkpoints with arrows or something elsse?