Not kicking player from vehicle?
#1

Hello,

Im making a privatecars script and its not kicking me from the truck?
Heres my code, I have it under OnPlayerStateChange

pawn Код:
if (vehicleid == Torran)
{
  if (OwnedCar[playerid] == 1) {
    SendClientMessage(playerid, COLOR_ORANGE, "-------------------");
    SendClientMessage(playerid, COLOR_WHITE, "Welcome to Torran's Truck");
    SendClientMessage(playerid, COLOR_ORANGE, "-------------------");
  }
  else if (OwnedCar[playerid] != 1) {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, COLOR_RED, "You are not authorized to drive this vehicle");
  }
}
It dosent kick me, Anyone know why?
Reply
#2

Instead of RemovePlayerFromVehicle Try to put this
GetPlayerPos(player1,x,y,z);
return SetPlayerPos(player1,x,y,z+3);
Reply
#3

I dont think thats the problem,
As it shows:

pawn Код:
SendClientMessage(playerid, COLOR_ORANGE, "-------------------");
SendClientMessage(playerid, COLOR_WHITE, "Welcome to Torran's Truck");
SendClientMessage(playerid, COLOR_ORANGE, "-------------------");
For people.. Even if its set to 0
Maybe its the way i get the players name?

pawn Код:
if(strcmp("Torran", name, true) == 0)
{
Reply
#4

if(GetPlayerName(playerid) == Name here)
Reply
#5

Quote:
Originally Posted by ikarus
if(GetPlayerName(playerid) == Name here)
That wouldn't work.

pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));

if (strcmp(name, "Torran", true))
{
 SendClientMessage(playerid, YELLOW, "Welcome to your vehicle, torran.");
}
else
{
 RemovePlayerFromVehicle(playerid);
 SendClientMessage(playerid, RED, "You are not authorized to use this vehicle.");
}
Reply
#6

Quote:
Originally Posted by Anwix
Quote:
Originally Posted by ikarus
if(GetPlayerName(playerid) == Name here)
That wouldn't work.

pawn Код:
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));

if (strcmp(name, "Torran", true))
{
 SendClientMessage(playerid, YELLOW, "Welcome to your vehicle, torran.");
}
else
{
 RemovePlayerFromVehicle(playerid);
 SendClientMessage(playerid, RED, "You are not authorized to use this vehicle.");
}
if (strcmp(name, "Torran", true) == 0)
Reply
#7

Quote:
Originally Posted by ikarus
if(GetPlayerName(playerid) == Name here)
OMG, don't try to help, if you don't know how!
Reply
#8

Are you sure your code is under: if (newstate == PLAYER_STATE_DRIVER) {

?
Reply
#9

Nevermind fixed it now,
I mispelt removeplayerfromvehicle.. Dnno why it didnt bring errors
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)