Help about Checkpoints and other cmds!!!
#9

pawn Code:
//top of script
#include <a_samp>

new LoadCount[MAX_PLAYERS] = 0;

//commands
public OnPlayerCommandText( playerid, cmdtext[ ] )
{
    if( strcmp( cmdtext, "/work", true ) == 0 )
    {
        if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 519 &&
            GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 592 &&
            GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 577 )
                return SendClientMessage( playerid, 0xFFFFFFFF, "Yor Need to be In A Vehicle to Do work!" );

        SetPlayerCheckpoint( playerid, 1644.4673, -2416.9844, 13.5547, 15.0 );
        LoadCount[playerid] = 0; // we restart variable
        return 1;
    }

    if( strcmp( cmdtext, "/stopwork", true ) == 0 )
    {
        if(GetPlayerMoney(playerid) >= 1000)
        {
            DisablePlayerCheckpoint( playerid );
            SendClientMessage(playerid,0xFFFFFFFFF,"You Have Canceled the Work!");
            GivePlayerMoney(playerid,-1000); //take $1'000 from him
            LoadCount[playerid] = 0; //we restart variable
        }
        else
        {
            SendClientMessage(playerid,0xFFFFFFFFF,"You Need $1000 to Cancel the Work!");
        }
        return 1;
    }
    return 0;
}

public OnPlayerEnterCheckpoint(playerid)
{
    LoadCount[playerid]++; //we add one count to his done works
    switch(LoadCount[playerid])
    {
        case 1: //if he did one load
        {
            SetPlayerCheckpoint(playerid, 1577.2006,1504.4862,10.8342,328.6342); //this is second CP
        }
        case 2: // if he did 2 loads
        {
            LoadCount[playerid] = 0; //we return count to 0
            // rest of your code here when he finishes 2 loads
        }
    }
    return 1;
}
The problem was you did not added playerid in :
pawn Code:
SetPlayerCheckpoint(playerid, 1577.2006,1504.4862,10.8342,328.6342);
Reply


Messages In This Thread
Help about Checkpoints and other cmds!!! - by Avi57 - 20.04.2012, 14:09
Re: Help about Checkpoints and other cmds!!! - by [MG]Dimi - 20.04.2012, 14:24
Re: Help about Checkpoints and other cmds!!! - by Avi57 - 20.04.2012, 14:29
Re: Help about Checkpoints and other cmds!!! - by Faisal_khan - 20.04.2012, 14:34
Re: Help about Checkpoints and other cmds!!! - by Avi57 - 20.04.2012, 14:36
Re: Help about Checkpoints and other cmds!!! - by [MG]Dimi - 20.04.2012, 14:36
Re: Help about Checkpoints and other cmds!!! - by Avi57 - 20.04.2012, 14:38
Re: Help about Checkpoints and other cmds!!! - by nilanjay - 20.04.2012, 14:38
Re: Help about Checkpoints and other cmds!!! - by Faisal_khan - 20.04.2012, 14:38
Re: Help about Checkpoints and other cmds!!! - by Avi57 - 20.04.2012, 14:50

Forum Jump:


Users browsing this thread: 1 Guest(s)