SA-MP Forums Archive
[HELP] PlayerScore & Vehicule - 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: [HELP] PlayerScore & Vehicule (/showthread.php?tid=131123)



[HELP] PlayerScore & Vehicule - Smiths - 01.03.2010

If the player score = 1 then he can enter in a taxi(just an example) What code i need for that? i tried a lot of things but it doesn't work....


Srry for my english. Tell me if you need more information.


Re: [HELP] PlayerScore & Vehicule - aircombat - 01.03.2010

Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(GetPlayerScore(playerid) < 1) 
	{
		new vehicleid = GetPlayerVehicleID(playerid);
		new modelid = GetVehicleModel(vehicleid);
		if(newkeys == 2 || newkeys == 3)
		{
  		if(modelid == 420) // 420 is the taxi model
			{
				RemovePlayerFromVehicle(playerid);
				SendClientMessage(playerid,0xFF9900AA, "You Don't Have 1 Score To Get In A Taxi");
			}
		}
	}
return 1;
}
that will make if a player doesnt have score 1 or plus he get removed from the taxi
________
SOUTH AMERICAN RECIPES


Re: [HELP] PlayerScore & Vehicule - Smiths - 01.03.2010

it doesn't work.. nothing happen when i enter a taxi...


Re: [HELP] PlayerScore & Vehicule - MrIncredible - 01.03.2010

maybe put this

GetPlayerScrore(killerid, 1);
GetPlayerScore(playerid, -1);

put that under onplayerdeath .. and i think it will work.


Re: [HELP] PlayerScore &amp; Vehicule - aircombat - 01.03.2010

MrIncredible he doesnt mean to make player lose score when he die , he mean of player score is above 1 he can get in taxi if lower , he get ejected from taxi
________
HERBAL VAPORIZER


Re: [HELP] PlayerScore & Vehicule - CuervO - 01.03.2010

Quote:
Originally Posted by [AC
Etch ]
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(GetPlayerScore(playerid) < 1) 
	{
		new vehicleid = GetPlayerVehicleID(playerid);
		new modelid = GetVehicleModel(vehicleid);
		if(newkeys == 2 || newkeys == 3)
		{
  		if(modelid == 420) // 420 is the taxi model
			{
				RemovePlayerFromVehicle(playerid);
				SendClientMessage(playerid,0xFF9900AA, "You Don't Have 1 Score To Get In A Taxi");
			}
		}
	}
return 1;
}
that will make if a player doesnt have score 1 or plus he get removed from the taxi
OnPlayerKeyStateChange, WHAT?!?!


_________________________________________________


pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 420 && GetPlayerScore(playerid) < 1) // Change 1 To what you want..
    {
        SendClientMessage(playerid, 0xFF0000FF, "You don't have the requiered Score to Use this!");
            new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X,Y,Z);
        SetPlayerPos(playerid, X,Y,Z);
    }
    // more code...
}
or the alternative:


pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicle = GetPlayerVehicleID(playerid));
    if(newstate == PLAYER_STATE_DRIVER && GetVehicleModel(vehicle) == 420)
    {
        if(GetPlayerScore(playerid) < 1) return SendClientMessage(playerid, 0xFF0000FF, "You don't have the necessary Score to use this");
    }
    // more code
}




Re: [HELP] PlayerScore & Vehicule - MrIncredible - 01.03.2010

Quote:
Originally Posted by [AC
Etch ]
MrIncredible he doesnt mean to make player lose score when he die , he mean of player score is above 1 he can get in taxi if lower , he get ejected from taxi
i know but .. let hi m try once because to ur script u said that GetPlayerScore >1
so on player death he has to put it .. i am new in scripting ...


Re: [HELP] PlayerScore & Vehicule - Smiths - 01.03.2010

Quote:
Originally Posted by CueЯvo
Quote:
Originally Posted by [AC
Etch ]
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	if(GetPlayerScore(playerid) < 1) 
	{
		new vehicleid = GetPlayerVehicleID(playerid);
		new modelid = GetVehicleModel(vehicleid);
		if(newkeys == 2 || newkeys == 3)
		{
  		if(modelid == 420) // 420 is the taxi model
			{
				RemovePlayerFromVehicle(playerid);
				SendClientMessage(playerid,0xFF9900AA, "You Don't Have 1 Score To Get In A Taxi");
			}
		}
	}
return 1;
}
that will make if a player doesnt have score 1 or plus he get removed from the taxi
OnPlayerKeyStateChange, WHAT?!?!


_________________________________________________


pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(GetVehicleModel(vehicleid) == 420 && GetPlayerScore(playerid) < 1) // Change 1 To what you want..
    {
        SendClientMessage(playerid, 0xFF0000FF, "You don't have the requiered Score to Use this!");
            new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X,Y,Z);
        SetPlayerPos(playerid, X,Y,Z);
    }
    // more code...
}
or the alternative:


pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicle = GetPlayerVehicleID(playerid));
    if(newstate == PLAYER_STATE_DRIVER && GetVehicleModel(vehicle) == 420)
    {
        if(GetPlayerScore(playerid) < 1) return SendClientMessage(playerid, 0xFF0000FF, "You don't have the necessary Score to use this");
    }
    // more code
}

Thank you ! it work great!