SA-MP Forums Archive
[HELP]VehicleOwnership-/park command bug - 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)
+--- Thread: [HELP]VehicleOwnership-/park command bug (/showthread.php?tid=287254)



[HELP]VehicleOwnership-/park command bug - Cjgogo - 02.10.2011

OK,so basically my vehicle ownership is ALMOST finished,but in the last miles i'm ecountering problems.Like with /park command,even if I enter a vehcile,if it's owned,or it's not it says Unknown command.

pawn Код:
COMMAND:park(playerid,params[])
{
  new vstring[64];
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,sizeof(pName));
  format(vstring,sizeof(vstring),"/VehicleOwnership/%s.txt",pName);
  new vehicleid=GetPlayerVehicleID(playerid);
  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"This command must be used only on your owned car");
  if(IsPlayerInAnyVehicle(playerid))
  {
     for(new i=0;i<MAX_CARS;i++)
     {
        if(VehicleInfo[vehicleid][vOwned] == true)
        {

             new Float:x,Float:y,Float:z;
             GetVehiclePos(vehicleid,x,y,z);
             VehicleInfo[vehicleid][vFloatX] = x;
             VehicleInfo[vehicleid][vFloatY] = y;
             VehicleInfo[vehicleid][vFloatZ] = z;
             dini_FloatSet(vstring,"VehFloatX",VehicleInfo[vehicleid][vFloatX]);
             dini_FloatSet(vstring,"VehFloatY",VehicleInfo[vehicleid][vFloatY]);
             dini_FloatSet(vstring,"VehFloatZ",VehicleInfo[vehicleid][vFloatZ]);
        }
        if(VehicleInfo[vehicleid][vOwned] == false) return SendClientMessage(playerid,COLOR_RED,"This command must be used only on your own car");
     }
  }
 return true;
}
Help,please?


Re: [HELP]VehicleOwnership-/park command bug - Pharrel - 02.10.2011

pawn Код:
COMMAND:park(playerid)
{

  if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"This command must be used only on your owned car");
  new vstring[64];
  new pName[MAX_PLAYER_NAME];
  GetPlayerName(playerid,pName,sizeof(pName));
  format(vstring,sizeof(vstring),"/VehicleOwnership/%s.txt",pName);
  new vehicleid = GetPlayerVehicleID(playerid);

  if(VehicleInfo[vehicleid][vOwned] == true)
  {
     new Float:x,Float:y,Float:z;
     GetVehiclePos(vehicleid,x,y,z);
     VehicleInfo[vehicleid][vFloatX] = x;
     VehicleInfo[vehicleid][vFloatY] = y;
     VehicleInfo[vehicleid][vFloatZ] = z;
     dini_FloatSet(vstring,"VehFloatX",VehicleInfo[vehicleid][vFloatX]);
     dini_FloatSet(vstring,"VehFloatY",VehicleInfo[vehicleid][vFloatY]);
     dini_FloatSet(vstring,"VehFloatZ",VehicleInfo[vehicleid][vFloatZ]);
  }
  else return SendClientMessage(playerid,COLOR_RED,"This command must be used only on your own car");
  return true;
}
try it


Re: [HELP]VehicleOwnership-/park command bug - Cjgogo - 02.10.2011

not working


Re: [HELP]VehicleOwnership-/park command bug - Dripac - 02.10.2011

did you try at the end to change "true" to number 1?

return 1;

just guessing^^


Re: [HELP]VehicleOwnership-/park command bug - Cjgogo - 02.10.2011

lol it's the same thing alpa gun

return true == return 1 and return false == return 0 :P


Re: [HELP]VehicleOwnership-/park command bug - Pharrel - 02.10.2011

probably if(VehicleInfo[vehicleid][vOwned] == true) is different from the vInfo or wahtever is your variable