[Tutorial] How to make a Personal Car [NEW METHOD]
#10

Not bad.

pawn Code:
new PrivateCar;
public OnGameModeInit()
{
    PrivateCar = AddStaticVehicle(411, X, Y, Z,Angle,COL1,COL2);
    return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerVehicleID(playerid) == PrivateCar)
    {
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        if(strcmp(name, "NAME", false))
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,-1, "This is a private car.");
        }
    }
    return 1;
}
Here's how i'd do it. Less lines. Less useless stocks noobies won't know how to use, and its simple. I like simple

As for the stocks, wut? why make a stock called "Sorry"?

I dont get it.
pawn Code:
stock Sorry(playerid)
{
return SendClientMessage(playerid, 0xFF0000AA, "Sorry: U allready have a vehicle");
}
Just add the return in the command :S

See:
pawn Code:
CMD:mycar(playerid, params[])
{
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)return SendClientMessage(playerid,-1,"You need to be on foot!");
    if(strcmp(PlayerName(playerid), R_Car, true) == 0)
    {
        GetPlayerPos(playerid, x,y,z);  SetVehiclePos(rcar, x+2,y+2,z);
        PutPlayerInVehicle(playerid, rcar, 0);
        SendClientMessage(playerid,-1,"Car brought!");
    }
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)