[SOLVED] Vehicle Kick 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] Vehicle Kick Problem (
/showthread.php?tid=149538)
[SOLVED] Vehicle Kick Problem -
FreddeN - 22.05.2010
Hello,
I'm trying to lock Car ID's to a team, only that team may and can use that vehicle(s).
But I got some problems with it, when I'm in the team, it stills kicks me out from it...
This is how that part of the script looks like:
Код:
if(modelid == 520 || modelid == 548 || modelid == 470 || modelid == 433)
{
if(gTeam[playerid] == 5)
{
}
else
{
SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle.");
RemovePlayerFromVehicle(playerid);
}
}
Maybe you know a better way to do this?
Thanks
Re: [HELP] Vehicle Kick Problem -
FreddeN - 22.05.2010
Any Ideas?
Re: [HELP] Vehicle Kick Problem -
Hiddos - 22.05.2010
Try using SetVehicleParamsForPlayer
Re: [HELP] Vehicle Kick Problem -
russo666 - 22.05.2010
try to put return 1
if(gTeam[playerid] == 5)
{
return 1;
}
Re: [HELP] Vehicle Kick Problem -
dice7 - 22.05.2010
Where do you have that code ?
Re: [HELP] Vehicle Kick Problem -
FreddeN - 23.05.2010
Quote:
Originally Posted by dice7
Where do you have that code ?
|
I'm sorry for late answer, I got the line under OnPlayerStateChange
Here is the full Script:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new modelid = GetVehicleModel(vehicleid);
if(modelid == 596 || modelid == 427 || modelid == 528 || modelid == 601 || modelid == 523 || modelid == 497 || modelid == 599)
{
if(gTeam[playerid] == 1 || gTeam[playerid] == 2)
{
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle.");
RemovePlayerFromVehicle(playerid);
}
}
if(modelid == 416 || modelid == 407 || modelid == 544 || modelid == 487)
{
if(gTeam[playerid] == 3 || gTeam[playerid] == 4)
{
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle.");
RemovePlayerFromVehicle(playerid);
}
}
if(modelid == 520 || modelid == 548 || modelid == 470 || modelid == 433)
{
if(gTeam[playerid] == 5)
{
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle.");
RemovePlayerFromVehicle(playerid);
}
}
}
return 1;
}
The funny thing is, for the other teams this works, but not on gTeam[playerid] == 5...
Re: [HELP] Vehicle Kick Problem -
woot - 23.05.2010
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
new modelid = GetVehicleModel(vehicleid);
if(modelid == 596 || modelid == 427 || modelid == 528 || modelid == 601 || modelid == 523 || modelid == 497 || modelid == 599)
{
if(gTeam[playerid] != 1 && gTeam[playerid] != 2)
{
SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle.");
RemovePlayerFromVehicleEx(playerid);
}
}
if(modelid == 416 || modelid == 407 || modelid == 544 || modelid == 487)
{
if(gTeam[playerid] != 3 && gTeam[playerid] != 4)
{
SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle.");
RemovePlayerFromVehicleEx(playerid);
}
}
if(modelid == 520 || modelid == 548 || modelid == 470 || modelid == 433)
{
if(gTeam[playerid] != 5)
{
SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle.");
RemovePlayerFromVehicleEx(playerid);
}
}
}
return 1;
}
stock RemovePlayerFromVehicleEx(playerid)
{
new Float:Position[3];
GetPlayerPos(playerid, Position[0], Position[1], Position[2]);
SetPlayerPos(playerid, Position[0]-1, Position[1], Position[2]+0.5);
}
Re: [HELP] Vehicle Kick Problem -
FreddeN - 23.05.2010
Quote:
Originally Posted by //exora
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate) { if(newstate == PLAYER_STATE_DRIVER) { new vehicleid = GetPlayerVehicleID(playerid); new modelid = GetVehicleModel(vehicleid);
if(modelid == 596 || modelid == 427 || modelid == 528 || modelid == 601 || modelid == 523 || modelid == 497 || modelid == 599) { if(gTeam[playerid] != 1 && gTeam[playerid] != 2) { SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle."); RemovePlayerFromVehicleEx(playerid); } } if(modelid == 416 || modelid == 407 || modelid == 544 || modelid == 487) { if(gTeam[playerid] != 3 && gTeam[playerid] != 4) { SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle."); RemovePlayerFromVehicleEx(playerid); } } if(modelid == 520 || modelid == 548 || modelid == 470 || modelid == 433) { if(gTeam[playerid] != 5) { SendClientMessage(playerid, COLOR_WHITE,"You are not allowed to enter this vehicle."); RemovePlayerFromVehicleEx(playerid); } } } return 1; }
stock RemovePlayerFromVehicleEx(playerid) { new Float:Position[3]; GetPlayerPos(playerid, Position[0], Position[1], Position[2]); SetPlayerPos(playerid, Position[0]-1, Position[1], Position[2]+0.5); }
|
Works, thanks