[SOLVED] Vehicle Kick Problem
#1

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
Reply
#2

Any Ideas?
Reply
#3

Try using SetVehicleParamsForPlayer
Reply
#4

try to put return 1

if(gTeam[playerid] == 5)
{
return 1;
}
Reply
#5

Where do you have that code ?
Reply
#6

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...
Reply
#7

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);
}
Reply
#8

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)