Vehicle problems - 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: Vehicle problems (
/showthread.php?tid=165030)
Vehicle problems -
Scones - 03.08.2010
The players in my server cant access cars unless they are cops :S
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new newcar = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER)
{
if(IsACopCar(newcar))
{
if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1||PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2||PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3) { }
else {
RemovePlayerFromVehicle(playerid);
}
}
if(IsAnEMSCar(newcar))
{
if(PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4) { }
else {
RemovePlayerFromVehicle(playerid);
}
}
if(IsYakuzaCar(newcar))
{
if(PlayerInfo[playerid][pMember]==6||PlayerInfo[playerid][pLeader]==6) { }
else {
RemovePlayerFromVehicle(playerid);
}
}
if(IsItalianCar(newcar))
{
if(PlayerInfo[playerid][pMember]==14||PlayerInfo[playerid][pLeader]==14) { }
else {
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
pawn Код:
public IsACopCar(carid)
{
if(carid>=1&&carid<=33||carid==70||carid==80||carid>=75||carid<=78)
{
return 1;
}
return 0;
}
public IsYakuzaCar(carid)
{
if((carid >= 64 && carid <= 69||carid >= 71 && carid <=74))
{
return 1;
}
return 0;
}
public IsItalianCar(carid)
{
if((carid >= 79 && carid <= 87))
{
return 1;
}
return 0;
}
public IsAnEMSCar(carid)
{
if(carid>=34&&carid<=46)
{
return 1;
}
return 0;
}
Re: Vehicle problems -
Scones - 03.08.2010
Someone please help, im desperate
Re: Vehicle problems -
iggy1 - 03.08.2010
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
if(vehicleid == xxx)//cop vehicle ids here
{
if(GetPlayerSkin(forplayerid) != xxx)//copskin ids here
{
SetVehicleParamsForPlayer(vehicleid,forplayerid,1,1);
}
else
{
SetVehicleParamsForPlayer(vehicleid,forplayerid,1,0);
}
}
return 1;
}
Could use GetPlayerTeam instead of checking player skins.
Re: Vehicle problems -
Scones - 03.08.2010
Could the problem be that they are under OnPlayerStateChange?
Re: Vehicle problems -
Scones - 03.08.2010
ISSUE FIXED!!!
How it should look:
pawn Код:
public IsACopCar(carid)
{
if(carid>=1&&carid<=33||carid==70||carid==80||carid>=75 && carid<=78)
{
return 1;
}
return 0;
}
This is how it looked:
pawn Код:
public IsACopCar(carid)
{
if(carid>=1&&carid<=33||carid==70||carid==80||carid>=75||carid<=78)
{
return 1;
}
return 0;
}