SA-MP Forums Archive
GameTextForPlayer - 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: GameTextForPlayer (/showthread.php?tid=263986)



GameTextForPlayer - McCarthy - 24.06.2011

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



Re: GameTextForPlayer - Wesley221 - 24.06.2011

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


Re: GameTextForPlayer - McCarthy - 24.06.2011

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



Re: GameTextForPlayer - Vince - 24.06.2011

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.


Re: GameTextForPlayer - handerson - 24.06.2011

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,,


Re: GameTextForPlayer - McCarthy - 24.06.2011

Omfg fail xD

Now it kills when anybody enters any vehicle


Re: GameTextForPlayer - Wesley221 - 24.06.2011

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


Re: GameTextForPlayer - Calgon - 24.06.2011

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.


Re: GameTextForPlayer - Wesley221 - 24.06.2011

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


Re: GameTextForPlayer - McCarthy - 24.06.2011

Thanks