Lil problem with my /robveh command
#1

Ok so when i go up to the vehicle it says you're not near any vehicle and anything i try just leads to it saying somthing esle, Any idea what could be wrong here?

pawn Код:
if (strcmp(cmd, "/robveh", true) == 0)
    {
        if(pToolkit[playerid] == 0)
        {
          SendClientMessage(playerid, COLOR_LIGHTRED, "You haven't got a toolkit !");
          return 1;
        }
        {
          if(IsPlayerInAnyVehicle(playerid))
          {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You are in a vehicle !");
            return 1;
            }
            if(!ProxDetectorV(4, playerid, VehicleInfo[playerid][vOwned]))
          {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You are not near any a vehicle !");
            return 1;
            }
            if(VehicleInfo[vehicleid][vLock] == 1)
            {
            SendClientMessage(playerid, COLOR_LIGHTRED, "This vehicle is not locked !");
            return 1;
            }
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            if(strcmp(name, VehicleInfo[vehicleid][vOwner], true) == 0)
            {
            SendClientMessage(playerid, COLOR_LIGHTRED, "You can't rob your vehicle !");
            return 1;
            }
            if(pToolkit[playerid] < VehicleInfo[vehicleid][vLock])
            {
              format(string, sizeof(string), "%s has failed to rob a vehicle", name);
              ProxDetector(15, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
              return 1;
            }
            else if(pToolkit[playerid] == VehicleInfo[vehicleid][vLock])
            {
              format(string, sizeof(string), "%s has attemps to rob a vehicle", name);
              ProxDetector(15, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
              SetTimerEx("RobVeh", 5000, false, "d", playerid, vehicleid);
              Egale[playerid] = 1;
              return 1;
            }
            else if(pToolkit[playerid] > VehicleInfo[vehicleid][vLock])
            {
              format(string, sizeof(string), "%s has attemps to rob a vehicle", name);
              ProxDetector(15, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
              SetTimerEx("RobVeh", 5000, false, "d", playerid, vehicleid);
              Egale[playerid] = 0;
              return 1;
            }
        }
    }
Reply
#2

Are you near this vehicle: VehicleInfo[playerid][vOwned] ?
Reply
#3

Quote:
Originally Posted by MadeMan
Are you near this vehicle: VehicleInfo[playerid][vOwned] ?
Yes i am.

I have also tried it like this

pawn Код:
if(!ProxDetectorV(4, playerid, vehicleid))
Also tried it with the
pawn Код:
for(new v=0;v<MAX_VEHICLES;v++)
pawn Код:
if(!ProxDetectorV(4, playerid, v))
Still no luck
Reply
#4

pawn Код:
vehicleid = 0;
for(new v=1; v < MAX_VEHICLES; v++)
{
    if(ProxDetectorV(4, playerid, v))
    {
        vehicleid = v;
        break;
    }
}
if(vehicleid == 0)
{
    SendClientMessage(playerid, COLOR_LIGHTRED, "You are not near any a vehicle !");
    return 1;
}
Reply
#5

Thank you for your help, that is working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)