SA-MP Forums Archive
Need help with personal car system! - 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: Need help with personal car system! (/showthread.php?tid=654458)



Need help with personal car system! - NavedAkhter - 29.05.2018

I have one personal car system but whenever i use /vfind [ID] it says this is not your personal vehicle. help!

Code:
Код:
CMD:vfind(playerid, params[])
{
	new vid, Float:A, Float:B, Float:C, qid = GetVehicleID(vid);
	//--------------------------------------------------------------------------
	if(sscanf(params, "i", vid)) return
	SendUsage(playerid, "/vFind [CarID]");
	//--------------------------------------------------------------------------
    if(strcmp(VehicleOwner[vid], PlayerName(playerid), false))
	return SendError(playerid, "This car isn't yours!");
	//--------------------------------------------------------------------------
	if(GetPlayerVehicleAccess(playerid, qid) < 2 && !IsPlayerAdmin(playerid)) return
	SendError(playerid, "This is not your personal vehicle(1).");
	//--------------------------------------------------------------------------
	if(!IsValidVehicle(qid) && !IsPlayerAdmin(playerid)) return
	SendError(playerid, "This is not your personal vehicle(2).");
	//--------------------------------------------------------------------------
  	return GetVehiclePos(vid, A,B,C), vFindCar[playerid] = 1, PutPlayerInVehicle(playerid, vid, 0), SendClientMessage(playerid, ~1, "You have been teleported to your personal car");
}



Re: Need help with personal car system! - mjay768 - 29.05.2018

Hi. Removing this !IsPlayerAdmin(playerid) might help. Please try.


Re: Need help with personal car system! - NavedAkhter - 29.05.2018

Tried already but it does nothing...


Re: Need help with personal car system! - GTLS - 29.05.2018

Show us GetPlayerVehicleAccess. Something is wrong there.


Re: Need help with personal car system! - NavedAkhter - 29.05.2018

Quote:
Originally Posted by GTLS
Посмотреть сообщение
Show us GetPlayerVehicleAccess. Something is wrong there.
Here is the code:
Код:
GetPlayerVehicleAccess(playerid, vehicleid)
{
	if(IsValidVehicle(vehicleid))
	{
		if(VehicleCreated[vehicleid] == VEHICLE_DEALERSHIP)
		{
			if(!IsPlayerAdmin(playerid))
			{
				return 1;
			}
		}
		else if(VehicleCreated[vehicleid] == VEHICLE_PLAYER)
		{
			if(strcmp(VehicleOwner[vehicleid], PlayerName(playerid)) == 0)
			{
				return 2;
			}
		}
	}
	else
	{
		return 1;
	}
	return 0;
}



Re: Need help with personal car system! - NavedAkhter - 29.05.2018

What is wrong with that?


Re: Need help with personal car system! - GTLS - 29.05.2018

You dont have to use qid. vid will work fine.

Second, why do you want to GetVehiclePos when you do nothing with it. You can put someone inside a car without even getting the position.

PHP код:
 if(GetPlayerVehicleAccess(playeridqid) < && !IsPlayerAdmin(playerid)) //This 
if(GetPlayerVehicleAccess(playeridqid) != && !IsPlayerAdmin(playerid)) //Should be like this 
In the ErrorMessage, which one does it get called, (1) or (2)

EDIT: Dont do double posting.


Re: Need help with personal car system! - NavedAkhter - 29.05.2018

I am newbie at scripting, can u please help me in replacing (qid) with (vid) ?


Re: Need help with personal car system! - GTLS - 29.05.2018

Quote:
Originally Posted by NavedAkhter
Посмотреть сообщение
I am newbie at scripting, can u please help me in replacing (qid) with (vid) ?
You might be new in scripting but you can read right? Just replace qid in your command with vid. How hard is it?


Re: Need help with personal car system! - NavedAkhter - 29.05.2018

Quote:
Originally Posted by GTLS
Посмотреть сообщение
You might be new in scripting but you can read right? Just replace qid in your command with vid. How hard is it?
Done! But its not working

ERROR: This is not your personal vehicle (1).