GameTextForPlayer
#1

Okay, so I'm making a script that if somebody enters a rhino, it kills them and send a text. But if you are logged in as rcon admin it wont
But the problem is that it sends the text when I enter any vehicle, how can I make it for rhino only?
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new model = GetVehicleModel( vehicleid );

    if ( model == 432 )
    SetPlayerHealth(playerid,0);
    GameTextForPlayer(playerid,"~r~Dont touch my toys",5000,5);
    }
Reply
#2

pawn Код:
if ( model == 432 )
    {
        SetPlayerHealth(playerid,0);
        GameTextForPlayer(playerid,"~r~Dont touch my toys",5000,5);
    }
You forgot to open it
Reply
#3

Ah yes thanks, I tried to make it like this now so it wont kill rcon admins, but compiler crashes
pawn Код:
new model = GetVehicleModel( vehicleid );
    if ( model == 432 )
    {
    IsPlayerAdmin(playerid);
    SendClientMessage(playerid,COLOR_ARED,"Admin rights confirmed");
    }
    else
    SetPlayerHealth(playerid,0);
    GameTextForPlayer(playerid,"~r~Dont touch my toys",5000,5);
    }
Reply
#4

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
you forgot to open it
This. Again.

Dit forum vereist dat je 120 seconden wacht tussen het verzenden van berichten. Probeer het nogmaals over 51 seconden.
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
This. Again.

Dit forum vereist dat je 120 seconden wacht tussen het verzenden van berichten. Probeer het nogmaals over 51 seconden.
lol,, hahaha

i cant stop laughing,,

nice message,,
Reply
#6

Omfg fail xD

Now it kills when anybody enters any vehicle
Reply
#7

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~Dont touch my toys",5000,5);
        return 1;
    }
}
Always open a function and close a function
Reply
#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
#9

Quote:
Originally Posted by Calg00ne
Посмотреть сообщение
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~Dont 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 a message saying "Admin rights confirmed."
Was a typo, and didn't notice it: my bad. Also, i just showed it how it should work. He did it like that, so i didnt change anything
Reply
#10

Thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)