Vehicle ownership - 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: Vehicle ownership (
/showthread.php?tid=387836)
Vehicle ownership -
thefatshizms - 26.10.2012
Hi, i made this really quick just to see if it works:
pawn Code:
CMD:buycar(playerid, params[])
{
new vehicle;
new Float:X, Float:Y, Float:Z, Float:A;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, A);
if(sscanf(params,"i",vehicle)) return SendClientMessage(playerid, -1, "use /buycar");
VehInfo[vehicle][Owner] = PlayerName(playerid);
VehInfo[vehicle][modelid] = vehicle;
VehInfo[vehicle][carid] = CreateVehicle(vehicle, X, Y, Z, A, 0, 1, -1);
return 1;
}
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new name[24];
GetPlayerName(playerid, name, 24);
if(!strcmp(name,VehInfo[vehicleid][Owner]))
{
SendClientMessage(playerid, -1, "not ur car");
}
else
{
SendClientMessage(playerid, -1, "welcome to your car");
}
return 1;
}
It always says not you car even after ive used buy car
Re: Vehicle ownership -
zDivine - 26.10.2012
Try this:
pawn Code:
if(!strcmp(PlayerName(playerid),VehInfo[vehicleid][Owner]))
Remove:
pawn Code:
new name[24];
GetPlayerName(playerid, name, 24);
Re: Vehicle ownership -
thefatshizms - 26.10.2012
Didn't work
Re: Vehicle ownership -
thefatshizms - 27.10.2012
Can someone please help? i need to get my gaemode finished and i cant without a vehicle system