Private car a problem - 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: Private car a problem (
/showthread.php?tid=451486)
Private car a problem -
JayceonTaylor - 17.07.2013
Hello this is my code for private car.Problem is that everybody can drive my car. I want this car to be only for me.Where is my wrong ?
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == FireCat)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
if(strcmp(pName,"Jayceon_Taylor") == 0)
{
SendClientMessage(playerid,-1,"This is your private car!");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"This isnt your car!");
}
}
Re: Private car a problem -
Gangster-rocks - 17.07.2013
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == FireCat)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,sizeof(pName));
if(strcmp(pName,"Jayceon_Taylor") == 0)
{
SendClientMessage(playerid,-1,"This is your private car!");
}
else
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"This isnt your car!");
}
}
return 1;
}
try this
Re : Private car a problem -
JayceonTaylor - 17.07.2013
So much errors
Re: Private car a problem -
Gangster-rocks - 17.07.2013
List them.
Re: Private car a problem -
PrinceKumar - 17.07.2013
you can easily create that type of system with using variable
Re: Private car a problem -
Sublime - 17.07.2013
Where's the
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
new pname[MAX_PLAYER_NAME];
?
Re: Private car a problem -
Bakr - 17.07.2013
Everyone who has replied so far made no contributions. Just felt like pointing that out.
And I'm curious as to why no one reads the Wiki anymore.
Quote:
RemovePlayerFromVehicle();
This function will not work when used in OnPlayerEnterVehicle, because the player isn't in the vehicle when the callback is called. Use OnPlayerStateChange (newstate == 2/PLAYER_STATE_DRIVER) instead.
|
Re: Private car a problem -
PrinceKumar - 17.07.2013
Quote:
Originally Posted by Bakr
Everyone who has replied so far made no contributions. Just felt like pointing that out.
And I'm curious as to why no one reads the Wiki anymore.
|
hmm you are right bakr i also forget about this thing . You need to paste this code under
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
otherwise you get errors .