SA-MP Forums Archive
Lil problem with my /robveh command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Lil problem with my /robveh command (/showthread.php?tid=154952)



Lil problem with my /robveh command - ihatetn931 - 16.06.2010

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;
            }
        }
    }



Re: Lil problem with my /robveh command - MadeMan - 16.06.2010

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


Re: Lil problem with my /robveh command - ihatetn931 - 16.06.2010

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


Re: Lil problem with my /robveh command - MadeMan - 16.06.2010

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;
}



Re: Lil problem with my /robveh command - ihatetn931 - 16.06.2010

Thank you for your help, that is working.