#1

Hello i want
PHP код:
 if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER
If the car belong to TEAM_GS and the player doesn't belong to that team force the player to go out from the car.
Please Help [REP ++]
Reply
#2

Example:

pawn Код:
new vTeamGS;

public OnGameModeInit()
{
    vTeamGS = AddStaticVehicleEx(432, 2729.6108, -2435.5110, 13.6465, 270.4632, 43, 0, 900);
    return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        if(gTeam[playerid] != TEAM_GS && GetPlayerVehicleID(playerid) == vTeamGS) RemovePlayerFromVehicle(playerid);
    }
}
Reply
#3

try to visit this link : https://sampforum.blast.hk/showthread.php?tid=160810

+rep plss if helpful


and try to search before post(if i'm right)

sorry for my bad english
Reply
#4

It's a pretty simple thing, right?

First, find the callback you're going to be using. Probably OnPlayerStateChange. You want to compare for, like you already have, PLAYER_STATE_ONFOOT going to PLAYER_STATE_DRIVER. Add a check for teams.

Second, read this: https://sampwiki.blast.hk/wiki/ClearAnimations
- ClearAnimations(playerid) will stop the animation of getting in the car so the State won't change.

So...
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
         new veh = GetPlayerVehicleID(playerid);
         if((VehicleInfo[vehicleid][vteam] != 0) && (VehicleInfo[vehicleid][vteam] != PlayerInfo[playerid][pteam]))
         {
                 SendClientMessage(playerid,-1,"This vehicle is restricted.");
                 ClearAnimations(playerid);
         }
    }
    return 1;
}
Reply
#5

BTW i have solved it before looking on my post again but [REP ++] for all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)