kick someone from a vehicle not working...
#1

hey guys,

im trying to kick someone from his vehicle if he hasnt got the right score for it but it doesnt kicks the person...

ok well here is the code:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid) == 520 && (GetPlayerScore(playerid) <= 1000)))
        {
            RemovePlayerFromVehicle(playerid);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 1000+ score to enter this vehicle");
        }
        else if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid) == 432 && (GetPlayerScore(playerid) <= 1000)))
        {
            RemovePlayerFromVehicle(playerid);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 1000+ score to enter this vehicle");
        }
        else if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid) == 476 && (GetPlayerScore(playerid) <= 50)))
        {
            RemovePlayerFromVehicle(playerid);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 50+ score to enter this vehicle");
        }
        else if(IsPlayerInVehicle(playerid,GetPlayerVehicleID(playerid) == 425 && (GetPlayerScore(playerid) <= 1000)))
        {
            RemovePlayerFromVehicle(playerid);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 1000+ score to enter this vehicle");
        }
    }
    return 1;
}
can anyone tell me wuts wrong here?

Greets Niels
Reply
#2

replace GetPlayerVehicleID(playerid) with

GetVehicleModel(GetPlayerVehicleID(playerid))
Reply
#3

ok i now have this and it still AINT working

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        if(IsPlayerInVehicle(playerid, GetVehicleModel(GetPlayerVehicleID(playerid) == 520 && (GetPlayerScore(playerid) <= 1000))))
        {
            RemovePlayerFromVehicle(playerid);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 1000+ score to enter this vehicle");
        }
        else if(IsPlayerInVehicle(playerid, GetVehicleModel(GetPlayerVehicleID(playerid) == 432 && (GetPlayerScore(playerid) <= 1000))))
        {
            RemovePlayerFromVehicle(playerid);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 1000+ score to enter this vehicle");
        }
        else if(IsPlayerInVehicle(playerid, GetVehicleModel(GetPlayerVehicleID(playerid) == 476 && (GetPlayerScore(playerid) <= 50))))
        {
            RemovePlayerFromVehicle(playerid);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 50+ score to enter this vehicle");
        }
        else if(IsPlayerInVehicle(playerid, GetVehicleModel(GetPlayerVehicleID(playerid) == 425 && (GetPlayerScore(playerid) <= 1000))))
        {
            RemovePlayerFromVehicle(playerid);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 1000+ score to enter this vehicle");
        }
    }
    return 1;
}
pls help
Reply
#4

try it like this
pawn Код:
// Somewhere on top
new Test;

// Under ongamemodeinit
Test = CreateVehicle(520, 2109.1763, 1503.0453, 32.2887, 82.2873, 0, 1, 60);

// Under OnPlayerStateChange
if (newstate == 2)
{
new Vehicleid = GetPlayerVehicleID(Vehicleid);

if (Vehicleid==Test)
{
if(GetPlayerScore(playerid) < 1000)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,COLOR_RED,"You dont have +1000 score!");
}
}
That must work, but it's a little boring to do...
Reply
#5

xD yeah i thought it would work with just the id of the vehicle, cuz i have more of the same vehicle ids, so i dont have like 1 hydra, i have like 7 or 8 hydras in my GM xD

so i have to make it all like: hydra1 = createvehicle...... hydra2 = createblablabla? xD

well thnx anyways
Reply
#6

If it won't work you may use this.
i know its simple but it will work
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
    {
        if(IsPlayerInVehicle(playerid, GetVehicleModel(GetPlayerVehicleID(playerid) == 520 && (GetPlayerScore(playerid) <= 1000))))
        {
            SetPlayerPos(playerid,X,Y,Z+4);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 1000+ score to enter this vehicle");
        }
        else if(IsPlayerInVehicle(playerid, GetVehicleModel(GetPlayerVehicleID(playerid) == 432 && (GetPlayerScore(playerid) <= 1000))))
        {
            SetPlayerPos(playerid,X,Y,Z+4);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 1000+ score to enter this vehicle");
        }
        else if(IsPlayerInVehicle(playerid, GetVehicleModel(GetPlayerVehicleID(playerid) == 476 && (GetPlayerScore(playerid) <= 50))))
        {
            SetPlayerPos(playerid,X,Y,Z+4);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 50+ score to enter this vehicle");
        }
        else if(IsPlayerInVehicle(playerid, GetVehicleModel(GetPlayerVehicleID(playerid) == 425 && (GetPlayerScore(playerid) <= 1000))))
        {
            SetPlayerPos(playerid,X,Y,Z+4);
            return SendClientMessage(playerid, COLOR_GREEN, "ERROR: you need 1000+ score to enter this vehicle");
        }
    }
    return 1;
}
this will kick them out from the vehicle
I am nick by the way.
Reply
#7

you can do it like
new hydras[][] =
{

};

hydras[1] = CreateVehicle
hydras[2] = Create

that will save you some time
Reply
#8

Quote:
Originally Posted by MarkoN
Посмотреть сообщение
you can do it like
new hydras[][] =
{

};

hydras[1] = CreateVehicle
hydras[2] = Create

that will save you some time
This will take a long long long long
After 1 Year
Long Long Long Time
Reply
#9

Quote:
Originally Posted by Gangster-rocks
Посмотреть сообщение
This will take a long long long long
After 1 Year
Long Long Long Time
not really, its shorter then the first method so if hes got a friend or two they can make that in 2-3 hours max
Reply
#10

Niels I got your back i'll help u if u wanna cuz you were good with me i'll be good with you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)