Idea why this isnt working ?
#1

Hello , im making an Uniq Trucking system for my server ,

this last i want to make if player typed cmd ( /startcdl) and selected the first Item ,

server will check his Truck if is a truck legal to let the cmd working ,
second : this where im having the problem - if he chosen the first Case he will need Oil Trailer to do it ,
if he clicks the second he will need artic to do it
if he clicks the third case he will need Soil artic to do it , but when im having the Oil Trailer and im clicking on the First Case he's is telling me " This mission Cant be done without Oil Trailer" even i have oil trailer attached ..

PHP код:
stock IsCDLTRUCK(carid)
{
    new 
model GetVehicleModel(carid);
    if(
model == 514 || model == 515 || model == 403)
    {
        return 
1;
    }
    return 
0;
}
stock IsCDLTrailer(carid)
{
    new 
model GetVehicleModel(carid);
    if(
model == 584 || model == 591 || model == 435 || model == 450)
    {
        return 
1;
    }
    return 
0;
}
stock IsCDLOil(carid)
{
    new 
model GetVehicleModel(carid);
    if(
model == 584)
    {
        return 
1;
    }
    return 
0;
}
stock IsCDLArtic(carid)
{
    new 
model GetVehicleModel(carid);
    if(
model == 591 || model == 435)
    {
        return 
1;
    }
    return 
0;
}
stock IsCDLSOLA(carid)
{
    new 
model GetVehicleModel(carid);
    if(
model == 450)
    {
        return 
1;
    }
    return 
0;

PHP код:

YCMD
:startcdl(playeridparams[], help)
{
    if(
help) return SCM(playeridCOLOR_GREY"Not supported");
    new 
carid GetPlayerVehicleID(playerid);
    if(
PlayerInfo[playerid][pCDLic] == 1)
    {
        if(
IsCDLTRUCK(carid))
        {
            
PAP[playerid] = 1;
            
ShowPlayerDialog(playerid9111DIALOG_STYLE_LIST"Choose any of those locations""Load  Fuel  \nLoad Boxes \nLoad Traps""Ok""Cancel"); 
            return 
1;
        }    
        else
        {
            
SCM(playeridCOLOR_GREY"*You cant be Runningthis without your Own able Truck");
            return 
1;
        }
    }    
    return 
1;

PHP код:

if(dialogid == 9111
    {
        if(!
response) return 0
        if(
response
        {
            new 
carid GetPlayerVehicleID(playerid);
            new 
vehicleid GetPlayerVehicleID(playerid);
            if(
listitem == 0
            {    
                if(
IsCDLTRUCK(carid) && IsTrailerAttachedToVehicle(vehicleid))
                {    
                    if(
GetVehicleTrailer(carid) != IsCDLOil(carid)) return SCM(playeridCOLOR_RED"You need Oil Trailer to Do this mission");
                    
PAP[playerid] = 1
                    
SetPlayerCheckpoint(playerid, -269.1287,2610.6057,63.20693.0); 
                    
SendClientMessage(playerid0xFFFFFFFF"You started your first mission. Please follow the checkpoints");
                    return 
1;
                }    
            }
            if(
listitem == 1)
            {
                if(
IsCDLTRUCK(carid) && IsTrailerAttachedToVehicle(vehicleid))
                {    
                    if(
GetVehicleTrailer(carid) != IsCDLArtic(carid)) return SCM(playeridCOLOR_RED"You need ARtic Trailer to do this mission");
                    
PAP[playerid] = 3;
                    
SetPlayerCheckpoint(playerid, -1051.4005,-655.8729,31.73613.0);
                    
SendClientMessage(playerid0xFFFFFFFF"You started your first mission. Please follow the checkpoints");
                    return 
1;
                }
            }
            if(
listitem == 2)
            {
                if(
IsCDLTRUCK(carid) && IsTrailerAttachedToVehicle(vehicleid))
                {    
                    if(
GetVehicleTrailer(carid) != IsCDLSOLA(carid)) return SCM(playeridCOLOR_RED"You need A Soil Artic  to do this mission");
                    
PAP[playerid] = 5
                    
SetPlayerCheckpoint(playerid, -2286.7529,2282.9390,5.90153.0); 
                    
SendClientMessage(playerid0xFFFFFFFF"You started your first mission. Please follow the checkpoints");
                    return 
1;     
                }
            }
        }
    } 
Reply
#2

24h BUMP ...
Reply
#3

that line
pawn Код:
if(GetVehicleTrailer(carid) != IsCDLOil(carid))
it's the same as sayin
pawn Код:
if(34 != 1)//34 = some vehicle id of the trailer, 1 returned by IsCDLOil
this control structure equals "true" so you will always get the message, doesn't matter what you do.
(oh well, if the trailer has id 1... then.. xD joke aside.)

the correct way to check the trailer would be
pawn Код:
if(!IsCDLOil(carid))//show message if returned 0 and do stuff if not 0
+ some advice. you don't really need 2 variables
pawn Код:
new carid = GetPlayerVehicleID(playerid);
            new vehicleid = GetPlayerVehicleID(playerid);
one's quiet enough

overall, its okey i guess. Should work out for you.
ya, just change these 3 control structures
Reply
#4

Thanks for your Answer ,but the problem still there ..

PHP код:
 if(!IsCDLOil(carid)) return SCM(playeridCOLOR_RED"You need Oil Trailer to Do this mission"); 
he's still telling me You need Oil Trailer even i have the Trailer Attached ..
Reply
#5

u need:

https://sampwiki.blast.hk/wiki/IsTrailerAttachedToVehicle
https://sampwiki.blast.hk/wiki/GetVehicleTrailer
Reply
#6

still nothing , i need just one way to let the server knows that the Trailer attached to my vehicle id , is the One from the Stock , but how .. i dont have alot of experience in that trailer systems ..
Reply
#7

Done , i solved it close this topic please
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)