car getting mixed up with faction car - 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: car getting mixed up with faction car (
/showthread.php?tid=273447)
car getting mixed up with faction car -
rekatluos - 01.08.2011
ok so i made 2 cars that check for drivers name ,if the drivers name is NOT the one i put in the script,he gets ejected ,therefore its a personal car .
ill show here the entire code so people can help me out
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new string[256];
new newcar = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT) MyOldCar[playerid] = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(newcar == NAMEOFCARxD)
{
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp(PlayerName, "Player_nameblablabla", true) == 0)
{
SendClientMessage(playerid, COLOR_1BLUE,"* Welcome to your car.");
}
else
{
RemovePlayerFromVehicle(playerid);
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
SetPlayerPos(playerid, cx, cy, cz);
SendClientMessage(playerid, COLOR_RED," This vehicle is not for you.");
}
}
the problem is , 1 of 2 cars works,but the other says im not in the Hitman faction ,i remember i had this problem when i tried to put my private cars into a filterscript cause they got mixed up with GM's cars ,but this time its in the GM and i dont know why they get mixed up
Re: car getting mixed up with faction car -
dowster - 01.08.2011
You should be doing this in
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
and you have only specified one car in that code.
Re: car getting mixed up with faction car -
rekatluos - 01.08.2011
yea cause the 2nd one is just copy paste ,changing the name of the car and voila