GameTextForPlayer
#8

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
pawn Код:
new model = GetVehicleModel( vehicleid );
if(model == 432)
{
    if(IsPlayerAdmin(playerid)
    {
        SendCLientMessage(playerid, COLOR_ARED, "Admin rights confirmed");
        return 1;
    }
    else
    {
        SetPlayerHealth(playerid,0);
        GameTextForPlayer(playerid,"~r~Don't touch my toys",5000,5);
        return 1;
    }
}
Always open a function and close a function
Always remember to use casing properly, there's no capital 'L' in SendClientMessage.

Easier to use code:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 432 && !IsPlayerAdmin(playerid)) {
        SetPlayerHealth(playerid, 0);
        GameTextForPlayer(playerid, "~r~Don't touch my toys!", 5000, 5);
    }
   
    return 0;
}
You didn't need to create a variable to store the vehicle model, you can just do this, and you didn't need to send the message, as that's not what the OP asked for. Plus, I fixed the indentation - you don't need over 9000 spaces everywhere, it makes your code horrible to read.
Reply


Messages In This Thread
GameTextForPlayer - by McCarthy - 24.06.2011, 12:29
Re: GameTextForPlayer - by Wesley221 - 24.06.2011, 12:32
Re: GameTextForPlayer - by McCarthy - 24.06.2011, 13:45
Re: GameTextForPlayer - by Vince - 24.06.2011, 13:59
Re: GameTextForPlayer - by handerson - 24.06.2011, 14:03
Re: GameTextForPlayer - by McCarthy - 24.06.2011, 14:06
Re: GameTextForPlayer - by Wesley221 - 24.06.2011, 14:12
Re: GameTextForPlayer - by Calgon - 24.06.2011, 14:14
Re: GameTextForPlayer - by Wesley221 - 24.06.2011, 14:17
Re: GameTextForPlayer - by McCarthy - 24.06.2011, 14:33

Forum Jump:


Users browsing this thread: 1 Guest(s)