When player Enters vehicle...help!
#1

So i have things set up like this:
pawn Code:
public OnPlayerEnterVehicle (playerid, vehicleid)
{
  if (vehicleid == deathtruck)
    GetPlayerName(playerid, name, sizeof(name));
  if(strcmp(name,"Death_Angel",true) == 0)
    {
    }
    else
    {
        RemovePlayerFromVehicle(playerid);
    if (vehicleid == deathtruck)
    SendClientMessage(playerid, 0xFFFFFFAA, "This Vehicle is For DeathAngel ONLY !");
  }
  return 1;
}
But RemovePlayerFromVehicle just doesn't works... any suggestions?
Reply
#2

EnterVehicle and RemovePlayerFromVehicle ...
if someone enter a vehicle he isnt in it, right ?
Reply
#3

Read More Carefully... this all works fine the EROR msg and all.. but RemovePlayerFromVehicle Doesnt Work... it doesn't remove player out of vehicle... he can still drive it !

**EDIT** : Dam* You are right... he just enters it he isnt in it.. so what shoould i do.. then..?
Reply
#4

You should try it with set his current position again or freeze and unfreeze him (both methods will stop his current doing)
Reply
#5

Alraight... alraight... i think i get this now.. almost
So i should do somthinge like On‌PlayerStateChange = right?
Reply
#6

Quote:
Originally Posted by Static_X
Alraight... alraight... i think i get this now.. almost
So i should do somthinge like On‌PlayerStateChange = right?
Yes you can do that
Reply
#7

Okay ,thanks!
Reply
#8

I was bugging myself all night with that onplayerstatechange... and which im not a good scripter i just cant get it to work... what should i do...? i just tried copying but 2 errors accoured
Script:
pawn Code:
public OnPlayerStateChange (playerid, newstate, oldstate)
{
  if (vehicleid == deathtruck)
    GetPlayerName(playerid, name, sizeof(name));
  if(strcmp(name,"Death_Angel",true) == 0)
    {
    }
    else
    {
    RemovePlayerFromVehicle(playerid);
    if (vehicleid == deathtruck)
    SendClientMessage(playerid, 0xFFFFFFAA, "This Vehicle is For DeathAngel ONLY !");
  }
  return 1;
}
Erors:
Code:
C:\DOCUME~1\Romeo\Desktop\samp02Xserver.win32\gamemodes\TestersGamemode.pwn(598) : error 017: undefined symbol "vehicleid"
C:\DOCUME~1\Romeo\Desktop\samp02Xserver.win32\gamemodes\TestersGamemode.pwn(606) : error 017: undefined symbol "vehicleid"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Anyone?
Reply
#9

pawn Code:
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
Reply
#10

pawn Code:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerVehicleID(playerid) == adminvehicle)
        {
            if(IsPlayerAdmin(playerid))
            {
              SendClientMessage(playerid, 0xFFFFFFFF, "Welcome to admin vehicle!");
            }
            else
            {
              SendClientMessage(playerid, 0xFF0000FF, "This vehicle is for RCON admins ONLY!");
                RemovePlayerFromVehicle(playerid);
            }
        }
    }
}
Reply
#11

Are you just posting random code, or do you suffer from sight problems?
Reply
#12

Thank you Mike,thank you too shadow.. i have an idea what to do with admin vehicle
Reply
#13

All works no errors no warning no nothing.. but now...
When i enter any vehicle at all.. it just kickes me out of it.. and displays the Error message
Reply
#14

What code are you using?
Reply
#15

What CODE?! i am making my own gamemode...
pawn Код:
public OnPlayerStateChange (playerid, newstate, oldstate)
{
    if(GetPlayerVehicleID(playerid) == deathtruck)
    GetPlayerName(playerid, name, sizeof(name));
  if(strcmp(name,"Death_Angel",true) == 0)
    {
    }
    else
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, 0xFFFFFFAA, "ERROR: This Vehicle is For DeathAngel ONLY !");
  }
  return 1;
}
I doo this.. and it kicks me out any vehicle i enter... and displays EROR MESAGE
Reply
#16

pawn Код:
public OnPlayerStateChange (playerid, newstate, oldstate)
{
  if(GetPlayerVehicleID(playerid) == deathtruck)
  GetPlayerName(playerid, name, sizeof(name));
  if(strcmp("Death_Angel",name,true))
  {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, 0xFFFFFFAA, "ERROR: This Vehicle is For DeathAngel ONLY !");
  }
  return 1;
}
Reply
#17

that is the only person i want to enter that vehicle.. soo.. if like Death_Angel in "deathtruck" it will let him drive if not it will kick player out... but its kicking me when i enter every vehicle...
Reply
#18

Nop Mike same thing.. just kickes me out of any vehicle
Reply
#19

Try this.
pawn Код:
public OnPlayerStateChange (playerid, newstate, oldstate)
{
  if(GetPlayerVehicleID(playerid) == deathtruck)
  GetPlayerName(playerid, name, sizeof(name));
  if(!strcmp("Death_Angel",name,true))
  {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, 0xFFFFFFAA, "ERROR: This Vehicle is For DeathAngel ONLY !");
  }
  return 1;
}
Reply
#20

The Land Where One Big ! makes Change,, LOOL
Now Realy Thank You Mike
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)