My Script is not working properly, Any Help?
#1

Alright, i have scripted this with a bit of help.

Quote:

if(strcmp(cmd, "/loadproducts", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid, 7, -75.2536,-1598.1886,2.6172))
{
if(IsPlayerInVehicle(playerid, 49)
{
if(truckjob[playerid] == 0)
{
SendClientMessage(playerid, COLOR_BLUE, "Deliver the Products to IdleWood Gas Station. (RED MARK)");
SetPlayerCheckpoint(playerid, 1925.0168,-1787.8075,13.3906, 10);
truckjob[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD2, "You Are Not At The Delivery Place Or You Have Already Got Products To Deliver!");
}
SendClientMessage(playerid, COLOR_GRAD2, "You Are Not In The Right Vehicle! Get in a Boxvill Van!");
}
}
return 1;
}
return 1;
}

When i compile it, it compiles fine.

When i go IG and goto the loading point and type /loadproducts, Nothing happens.. I want it too say "You are not in the Right Vehicle" but it doesnt :/

Same with everthing else, i type /loadproducts in the boxvill van and nothing happens.
Everything worked okay up to when i added that they must be in the right vehicle.

Oh right, Everything did happen before i added the vehicle but the Error Messages still didnt work :/

Am i missing something in it ?

I would appritiate it alot if someone could help me out here

Thanks
Reply
#2

Are you sure that Vehicle ID 49 will always be the Boxville van? You might want to use this instead

pawn Код:
if(GetVehicleModel(GetPlayerVehicleId(playerid)) == /*Boxville van model*/
Reply
#3

pawn Код:
if(strcmp(cmd, "/loadproducts", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 7, -75.2536,-1598.1886,2.6172))
            {
                if(IsPlayerInVehicle(playerid, 49)
                {
                    if(truckjob[playerid] == 0)
                    {
                        SendClientMessage(playerid, COLOR_BLUE, "Deliver the Products to IdleWood Gas Station. (RED MARK)");
                        SetPlayerCheckpoint(playerid, 1925.0168,-1787.8075,13.3906, 10);
                        truckjob[playerid] = 1;
                    }
                else
                {
                SendClientMessage(playerid, COLOR_GRAD2, "You Are Not At The Delivery Place Or You Have Already Got Products To Deliver!");
                }
            SendClientMessage(playerid, COLOR_GRAD2, "You Are Not In The Right Vehicle! Get in a Boxvill Van!");
            }
        }
    return 1;
    }
Reply
#4

I tried this.
@TheKiller thanks, The ID was wrong. Fixed

Код:
if(strcmp(cmd, "/loadproducts", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsPlayerInRangeOfPoint(playerid, 7, -75.2536,-1598.1886,2.6172))
            {
                if(IsPlayerInVehicle(playerid, 498))
                {
                    if(truckjob[playerid] == 0)
                    {
                        SendClientMessage(playerid, COLOR_BLUE, "Deliver the Products to IdleWood Gas Station. (RED MARK)");
                        SetPlayerCheckpoint(playerid, 1925.0168,-1787.8075,13.3906, 10);
                        truckjob[playerid] = 1;
                    }
                	else
                	{
                	SendClientMessage(playerid, COLOR_GRAD2, "You Have Already Got Products to Deliver!");
                	}
            		SendClientMessage(playerid, COLOR_GRAD2, "You Are Not In The Right Vehicle! Get in a Boxvill Van!");
         			}
     			SendClientMessage(playerid, COLOR_GRAD2, "You are not at the delivery point!");
           		}
   	   		}
    	return 1;
    	}
I used this, But still nothing happens, In the boxvill van still nothing happens :/

Is there a reason why the error mesages dont work?

EDIT* It does do something now, not the thing i want tho. if your in boxvill van or not and type /loadproducts near the pickup place it says "You are not near the pickup place"
Reply
#5

pawn Код:
if(strcmp(cmd, "/loadproducts", true) == 0)
{
       if(IsPlayerConnected(playerid))
       {
           if(IsPlayerInRangeOfPoint(playerid, 7, -75.2536,-1598.1886,2.6172))
           {
               if(IsPlayerInVehicle(playerid, 498))
                {
                   if(truckjob[playerid] == 0)
                   {
                       SendClientMessage(playerid, COLOR_BLUE, "Deliver the Products to IdleWood Gas Station. (RED MARK)");
                       SetPlayerCheckpoint(playerid, 1925.0168,-1787.8075,13.3906, 10);
                       truckjob[playerid] = 1;
                   }
                    else return SendClientMessage(playerid, COLOR_GRAD2, "You Have Already Got Products to Deliver!");
                }
                else return SendClientMessage(playerid, COLOR_GRAD2, "You Are Not In The Right Vehicle! Get in a Boxvill Van!");
            }
            else return SendClientMessage(playerid, COLOR_GRAD2, "You are not at the delivery point!");
        }
        return 1;
}
Reply
#6

thanks all of it works exept the vehicle :/

i checked the vehicle id, its right for a black boxvill van, but when u type /loadproducts in it, it says you are not in the right veh
Reply
#7

Any Help please?

Something is wrong because everything works but the vehicle thing.

When i get in the vehicle 609 (Black Boxville) What i changed it too, it says you are not in the right vehicle when you are D:

Any help?
here is the script again.
Код:
if(strcmp(cmd, "/loadproducts", true) == 0)
{
       if(IsPlayerConnected(playerid))
       {
           if(IsPlayerInRangeOfPoint(playerid, 7, -75.2536,-1598.1886,2.6172))
           {
               if(IsPlayerInVehicle(playerid, 609))
                {
                   if(truckjob[playerid] == 0)
                   {
                       SendClientMessage(playerid, COLOR_BLUE, "Deliver the Products to IdleWood Gas Station. (RED MARK)");
                       SetPlayerCheckpoint(playerid, 1925.0168,-1787.8075,13.3906, 10);
                       truckjob[playerid] = 1;
                   }
                    else return SendClientMessage(playerid, COLOR_GRAD2, "You Have Already Got Products to Deliver!");
                }
                else return SendClientMessage(playerid, COLOR_GRAD2, "You Are Not In The Right Vehicle! Get in a Boxvill Van!");
            }
            else return SendClientMessage(playerid, COLOR_GRAD2, "You are not at the pickup point!");
        }
       return 1;
	}
Reply
#8

pawn Код:
if(IsPlayerInVehicle(playerid, 609))
change to:

pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid) == 609)
if you wan't to use IsPlayerInVehicle(playerid, vehicleid) you need to save vehicle to variable.
Reply
#9

Yey Sorted, Thanks
*EDIT, Oh wait. No it isnt Damn
Reply
#10

I lost one ')' at the end:
pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid) == 609))
It must work.
Reply
#11

I did that :/

It still doesnt D:
Reply
#12

I saw now my fail in if.

pawn Код:
if(strcmp(cmd, "/loadproducts", true) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid, 7, -75.2536,-1598.1886,2.6172))
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 609)
        {
            if(truckjob[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_BLUE, "Deliver the Products to IdleWood Gas Station. (RED MARK)");
                SetPlayerCheckpoint(playerid, 1925.0168,-1787.8075,13.3906, 10);
                truckjob[playerid] = 1;
            }
            else return SendClientMessage(playerid, COLOR_GRAD2, "You Have Already Got Products to Deliver!");
        }
        else return SendClientMessage(playerid, COLOR_GRAD2, "You Are Not In The Right Vehicle! Get in a Boxvill Van!");
    }
    else return SendClientMessage(playerid, COLOR_GRAD2, "You are not at the pickup point!");
    return true;
}
It must work now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)