SA-MP Forums Archive
[HELP] score for enter vehicle needed [HELP] - 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)
+--- Thread: [HELP] score for enter vehicle needed [HELP] (/showthread.php?tid=565414)



[HELP] score for enter vehicle needed [HELP] - Fantje - 27.02.2015

Hiya!

I need help!

You have the script for:

Enter a Rhino only with 1500+ score?

Thanks!


Re: [HELP] score for enter vehicle needed [HELP] - MikE1990 - 27.02.2015

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(GetVehicleModel(vehicleid) == 432 && GetPlayerScore(playerid) < 1500)
	{
	    new Float:posx,Float:posy,Float:posz;
	    GetPlayerPos(playerid, posx, posy, posz);
		SetPlayerPos(playerid, posx, posy, posz + 3);
	}
	return 1;
}
Try this code.


Re: [HELP] score for enter vehicle needed [HELP] - Fantje - 27.02.2015

EDIT: It works! But... Do you have a script, that you get a message if you try to enter it under 1500 + score?


Re: [HELP] score for enter vehicle needed [HELP] - Finnick - 27.02.2015

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == Your Vehicles ID && GetPlayerScore(playerid) < Score For Players)
    {
        new Float:pX,Float:pY,Float:pZ;
        GetPlayerPos(playerid, pX,pY,pZ);
       SetPlayerPos(playerid, pX,pY,pZ + 3);
    }
    return 1;
}
Ex :
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 423 && GetPlayerScore(playerid) < 1500)
    {
        new Float:pX,Float:pY,Float:pZ;
        GetPlayerPos(playerid, 11,111,11,111,1111); // this is for your coordinates
        SetPlayerPos(playerid, 22,222,22,222,2222 + 3); // this is for your coordinates
    }
    return 1;



Re: [HELP] score for enter vehicle needed [HELP] - Fantje - 27.02.2015

You can add a line for that the player gets a message when they don't have enough score?


Re: [HELP] score for enter vehicle needed [HELP] - MikE1990 - 27.02.2015

What message you want to show ?


Re: [HELP] score for enter vehicle needed [HELP] - Beckett - 27.02.2015

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
   
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(GetVehicleModel(vehicleid) == 432 && GetPlayerScore(playerid) < 1500)
            new Float:pX,Float:pY,Float:pZ;
        GetPlayerPos(playerid, pX,pY,pZ);
        SetPlayerPos(playerid, pX,pY,pZ + 3);
        SendClientMessage(playerid,-1,"SERVER: You don't have enough score for this vehicle.");
    }
    return 1;
}
OnPlayerEnterVehicle gets called when the player has hit F near the vehicle not when he is inside it.


Re: [HELP] score for enter vehicle needed [HELP] - CalvinC - 27.02.2015

Quote:
Originally Posted by Fantje
Посмотреть сообщение
You can add a line for that the player gets a message when they don't have enough score?
https://sampwiki.blast.hk/wiki/SendClientMessage


Re: [HELP] score for enter vehicle needed [HELP] - Kyance - 27.02.2015

Quote:
Originally Posted by Finnick
Посмотреть сообщение
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == Your Vehicles ID && GetPlayerScore(playerid) < Score For Players)
    {
        new Float:pX,Float:pY,Float:pZ;
        GetPlayerPos(playerid, pX,pY,pZ);
       SetPlayerPos(playerid, pX,pY,pZ + 3);
    }
    return 1;
}
Ex :
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 423 && GetPlayerScore(playerid) < 1500)
    {
        new Float:pX,Float:pY,Float:pZ;
        GetPlayerPos(playerid, 11,111,11,111,1111); // this is for your coordinates
        SetPlayerPos(playerid, 22,222,22,222,2222 + 3); // this is for your coordinates
    }
    return 1;
what the actual frick
MikE1990 already answered, you pretty much copied his code but added random stuff, which won't make the code work.

OT: Just add "SendClientMessage(playerid, -1, "You need at least 1'500 score to use the Rhino!");" under MikE1990's position checks.


Respuesta: [HELP] score for enter vehicle needed [HELP] - alexus - 27.02.2015

I think is better to block the rhino. Only add this line in OnVehicleStreamIn callback:
Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	if(GetVehicleModel(vehicleid) == 432 && GetPlayerScore(playerid) < 1500) SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
	return 1;
}
Simple