whats wrong with this cmd
#1

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(gTeam[playerid] == TEAM_ZOMBIE) {
SendClientMessage(playerid,ADMIN_RED,"Error: Zombies cant drive!!");
RemovePlayerFromVehicle(playerid,vehicleid);
return 1;
}
can anyone help me with this?
i kno im missing the action to eject the player but idk how to eject that player can you please help me?
Reply
#2

i don't actually seen anything wrong in the server but i would actually use this code.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(gTeam[playerid] == TEAM_ZOMBIE) {
        if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            if(GetVehicleModel(vehicleid) == CARID)
            {
                SetPlayerHealth(playerid, 0);
                DestroyVehicle(vehicleid);
            }
        }
    }
    return 1;
}
Reply
#3

thnx kitten ur the best!!! but will this eject the zombie?? cuz i saw setplayerheatlh 0
Reply
#4

Quote:
Originally Posted by Kitten
Посмотреть сообщение
i don't actually seen anything wrong in the server but i would actually use this code.

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(gTeam[playerid] == TEAM_ZOMBIE) {
        if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            if(GetVehicleModel(vehicleid) == CARID)
            {
                SetPlayerHealth(playerid, 0);
                DestroyVehicle(vehicleid);
            }
        }
    }
    return 1;
}
He's ejecting the player, not killing and destroying the vehicle....

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(gTeam[playerid] == TEAM_ZOMBIE)
    {
        SendClientMessage(playerid,ADMIN_RED,"Error: Zombies cant drive!!");
        ClearAnimations(playerid);
        return 1;
    }
}
OnPlayerEnterVehicle is called as soon the player presses F near a vehicle. So if you use ClearAnimations, it will NEVER let him enter.
Reply
#5

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER)
    {
        if(gTeam[playerid] == TEAM_ZOMBIE)
        {
            SendClientMessage(playerid,ADMIN_RED,"Error: Zombies cant drive!!");
            RemovePlayerFromVehicle(playerid,vehicleid);
            return 1;
        }
     }
    return 1;
}
Reply
#6

thak you 69playa this actually worked just what i needed thnx!!
Reply
#7

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(gTeam[playerid] == TEAM_ZOMBIE) {
        if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            if(GetVehicleModel(vehicleid) == CARID)
            {
                GameTextForPlayer(playerid,"Zombie's Cant Drive Cuz You Have No Lisence ||HaHA",1000,4);
                RemovePlayerFromVehicle(playerid);
            }
        }
    }
    return 1;
}
This Is Correct Code LoL
Reply
#8

Quote:
Originally Posted by best_killa
Посмотреть сообщение
thnx kitten ur the best!!! but will this eject the zombie?? cuz i saw setplayerheatlh 0
btw i think u are using his zombie script
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)