SA-MP Forums Archive
Need work cmd [+1 REP ] - 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: Need work cmd [+1 REP ] (/showthread.php?tid=365201)



Need work cmd [+1 REP ] - Avi57 - 02.08.2012

Guys,
i need a cmd in which when a Player type /work it says : You Need to be in A Vehicle !
and if he/she is in vehicle, then it start the work like it shows them a Checkpoint and says :"Load Passengers From Red Checkpoint in your Minimap" and then if player goes there, it says "Loading Passengers" in GameTextForPlayer and it freeze player for 2-3 seconds !

then it should show another Checkpoint and say : " Transport Passengers to the Red marker in Your Map"
and if player reach there, it should say : "Unloading Passengers" in GameTextForPlayer and it freeze player for 2-3 seconds ! and it should give money and score to player !

Hope you Help me in It !
i will Rep You


Re: Need work cmd [+1 REP ] - tyler12 - 02.08.2012

IsPlayerInVehicle
OnPlayerEnterCheckpoint
GameTextForPlayer


Re: Need work cmd [+1 REP ] - Avi57 - 02.08.2012

just need how to show checkpoint and one small example too !
thanks


Re: Need work cmd [+1 REP ] - [MM]RoXoR[FS] - 02.08.2012

On top add
pawn Код:
#include <ZCMD>

new currentcp[MAX_PLAYERS];
Under OnPlayerConnect
pawn Код:
public OnPlayerConnect(playerid)
{
    currentcp[playerid] = 0;
    return 1;
}
Command
pawn Код:
CMD:work(playerid,params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,-1,"You must be in a vehicle");
    SetPlayerCheckpoint(playerid,X,Y,Z,5);//Change X,Y,Z acc to your needs
    SendClientMessage(playerid,-1,"Load Passengers From Red Checkpoint in your Minimap");
    currentcp[playerid] = 1;
    return 1;
}
Under OnPlayerEnterCheckpoint
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    switch(currentcp[playerid])
    {
        case 1:
        {
            GameTextForPlayer(playerid,"~r~Loading ~g~Passengers",3000,1);
            TogglePlayerControllable(playerid,0);
            SetTimerEx("AllowControl",3000,false,"i",playerid);
            SetPlayerCheckpoint(playerid,X,Y,Z,5);
            currentcp[playerid] = 2;
            SendClientMessage(playerid,-1,"Transport Passengers to the Red marker in Your Map");
            return 1;
        }
        case 2:
        {
            GameTextForPlayer(playerid,"~r~UnLoading ~g~Passengers",3000,1);
            TogglePlayerControllable(playerid,0);
            SetTimerEx("AllowControl",3000,false,"i",playerid);
            currentcp[playerid] = 0;
            SendClientMessage(playerid,-1,"Task completed.");
            GivePlayerMoney(playerid,10000);
            SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
            DisablePlayerCheckpoint(playerid);
            return 1;
        }
    }
    return 1;
}
And anywhere add
pawn Код:
forward AllowControl(playerid);
public AllowControl(playerid)
{
    TogglePlayerControllable(playerid,1);
    return 1;
}



Re: Need work cmd [+1 REP ] - Avi57 - 02.08.2012

buddy when i press enter, then it say Loading Passenger and then on pressing enter, it finish work !
only by pressing enter and if i dont click enter, it dont show any message like Loading Passengers


Re: Need work cmd [+1 REP ] - [MM]RoXoR[FS] - 02.08.2012

Enter ? I never used a key press in my script.
Show your script


Re: Need work cmd [+1 REP ] - Avi57 - 02.08.2012

i also didnt used any key press !


Re: Need work cmd [+1 REP ] - [MM]RoXoR[FS] - 02.08.2012

Quote:

when i press enter, then it say Loading Passenger and then on pressing enter, it finish work !

Show the code


Re: Need work cmd [+1 REP ] - Avi57 - 02.08.2012

fixed