SA-MP Forums Archive
whats wrong with this cmd - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: whats wrong with this cmd (/showthread.php?tid=274233)



whats wrong with this cmd - best_killa - 05.08.2011

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?


Re: whats wrong with this cmd - Kitten - 05.08.2011

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;
}



Re: whats wrong with this cmd - best_killa - 05.08.2011

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


Re: whats wrong with this cmd - Emmet_ - 05.08.2011

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.


Re: whats wrong with this cmd - Adil - 05.08.2011

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;
}



Re: whats wrong with this cmd - best_killa - 05.08.2011

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


Re: whats wrong with this cmd - windartist - 06.08.2011

Код:
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


Re: whats wrong with this cmd - suhrab_mujeeb - 06.08.2011

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