If the player does not have enough scoure Prevent him from ride Hydra , tank or .... -
timsar - 21.09.2015
If the player does not have enough scoure Prevent him from ride Hydra , tank or ....
or
500 points is required to select five class
And Class five required for driving tank
please guide me
tanks
Re: If the player does not have enough scoure Prevent him from ride Hydra , tank or .... -
Iceblizard - 21.09.2015
You mean that Only those who have 500 score can enter hydra ? Like Score Limits ? And if the player dosent have limited score he will be automatically Exited ?
Re: If the player does not have enough scoure Prevent him from ride Hydra , tank or .... -
OllieSimons - 21.09.2015
OnPlayerEnterVehicle and GetPlayerScore are your friends.
Re: If the player does not have enough scoure Prevent him from ride Hydra , tank or .... -
karemmahmed22 - 21.09.2015
Under includes:-
You can edit values (scores).
ex:
#define PLAYER_LEVEL1 50 instead of
#define PLAYER_LEVEL1 10
PHP код:
#define PLAYER_LEVEL1 10
#define PLAYER_LEVEL2 20
#define PLAYER_LEVEL3 50
#define PLAYER_LEVEL4 70
#define PLAYER_LEVEL5 100
OnPlayerStateChange:-
PHP код:
if(newstate == PLAYER_STATE_DRIVER)
{
new pIscore;
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
pIscore = GetPlayerScore(playerid);
if (GetVehicleModel(vehicleid) == 476 && pIscore < PLAYER_LEVEL1) // Rustler
{
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
RemovePlayerFromVehicle(playerid);
}
else if(GetVehicleModel(vehicleid) == 447 && pIscore < PLAYER_LEVEL2) //Seasparrow
{
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
RemovePlayerFromVehicle(playerid);
}
else if(GetVehicleModel(vehicleid) == 593 && pIscore < PLAYER_LEVEL3) //Dodo
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
}
else if(GetVehicleModel(vehicleid) == 425 && pIscore < PLAYER_LEVEL4) //Hunter
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
}
else if(GetVehicleModel(vehicleid) == 520 && pIscore < PLAYER_LEVEL5) //Hydra
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
}
}
Edit your vehicle ids and scores.
Re: If the player does not have enough scoure Prevent him from ride Hydra , tank or .... -
BroZeus - 21.09.2015
PHP код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(newstate == PLAYER_STATE_DRIVER)
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 520 && GetPlayerScore(playerid) < 500)
RemovePlayerFromVehicle(playerid);
return 1;
}
This code will remove player from Hydra if his score is less than 500.
520 is Hydra vehicle Model ID, refer to
https://sampwiki.blast.hk/wiki/Vehicle_Model_ID_List for list of vehicle and their model ids.
EDIT: Too late answer has been already posted above.
Re: If the player does not have enough scoure Prevent him from ride Hydra , tank or .... -
timsar - 21.09.2015
Quote:
Originally Posted by Iceblizard
You mean that Only those who have 500 score can enter hydra ? Like Score Limits ? And if the player dosent have limited score he will be automatically Exited ?
|
Exactly
Re: If the player does not have enough scoure Prevent him from ride Hydra , tank or .... -
timsar - 21.09.2015
Quote:
Originally Posted by karemmahmed22
Under includes:-
You can edit values (scores).
ex: #define PLAYER_LEVEL1 50 instead of #define PLAYER_LEVEL1 10
PHP код:
#define PLAYER_LEVEL1 10
#define PLAYER_LEVEL2 20
#define PLAYER_LEVEL3 50
#define PLAYER_LEVEL4 70
#define PLAYER_LEVEL5 100
OnPlayerStateChange:-
PHP код:
if(newstate == PLAYER_STATE_DRIVER)
{
new pIscore;
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
pIscore = GetPlayerScore(playerid);
if (GetVehicleModel(vehicleid) == 476 && pIscore < PLAYER_LEVEL1) // Rustler
{
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
RemovePlayerFromVehicle(playerid);
}
else if(GetVehicleModel(vehicleid) == 447 && pIscore < PLAYER_LEVEL2) //Seasparrow
{
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
RemovePlayerFromVehicle(playerid);
}
else if(GetVehicleModel(vehicleid) == 593 && pIscore < PLAYER_LEVEL3) //Dodo
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
}
else if(GetVehicleModel(vehicleid) == 425 && pIscore < PLAYER_LEVEL4) //Hunter
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
}
else if(GetVehicleModel(vehicleid) == 520 && pIscore < PLAYER_LEVEL5) //Hydra
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
}
}
Edit your vehicle ids and scores.
|
I should add that this is exactly where?
Re: If the player does not have enough scoure Prevent him from ride Hydra , tank or .... -
karemmahmed22 - 21.09.2015
If you can look at replies, You'll see i gave you full code for how to do it, Even Though BroZeus Done the same.
Edit: I already said, The defines should be under
INCLUDES
The code should be under
OnPlayerStateChange
Re: If the player does not have enough scoure Prevent him from ride Hydra , tank or .... -
Iceblizard - 21.09.2015
karemmaahmed22 said First Define under Includes and You know ''
OnPlayerStateChange'' Thanks to Karemmahmed22 and also BroZeus
Also you can change the score limit if you want by editing like Changing Define
another one
PHP код:
if(newstate == PLAYER_STATE_DRIVER)
{
new pIscore;
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
pIscore = GetPlayerScore(playerid);
if (GetVehicleModel(vehicleid) == 432 && pIscore < PLAYER_LEVEL6) // Rhino
{
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
RemovePlayerFromVehicle(playerid);
Credits:kareemahmed
That was example of changing vehicle but you need to add another level
Re: If the player does not have enough scoure Prevent him from ride Hydra , tank or .... -
timsar - 24.09.2015
Quote:
Originally Posted by karemmahmed22
Under includes:-
You can edit values (scores).
ex: #define PLAYER_LEVEL1 50 instead of #define PLAYER_LEVEL1 10
PHP код:
#define PLAYER_LEVEL1 10
#define PLAYER_LEVEL2 20
#define PLAYER_LEVEL3 50
#define PLAYER_LEVEL4 70
#define PLAYER_LEVEL5 100
OnPlayerStateChange:-
PHP код:
if(newstate == PLAYER_STATE_DRIVER)
{
new pIscore;
new vehicleid;
vehicleid = GetPlayerVehicleID(playerid);
pIscore = GetPlayerScore(playerid);
if (GetVehicleModel(vehicleid) == 476 && pIscore < PLAYER_LEVEL1) // Rustler
{
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
RemovePlayerFromVehicle(playerid);
}
else if(GetVehicleModel(vehicleid) == 447 && pIscore < PLAYER_LEVEL2) //Seasparrow
{
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
RemovePlayerFromVehicle(playerid);
}
else if(GetVehicleModel(vehicleid) == 593 && pIscore < PLAYER_LEVEL3) //Dodo
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
}
else if(GetVehicleModel(vehicleid) == 425 && pIscore < PLAYER_LEVEL4) //Hunter
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
}
else if(GetVehicleModel(vehicleid) == 520 && pIscore < PLAYER_LEVEL5) //Hydra
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,-1,"Your level is not high enough to drive this vehicle, please kill others to gain score!");
}
}
Edit your vehicle ids and scores.
|
PHP код:
//------------------------------------------------
ReturnPlayerClassName(playerid)
{
new classstr[28] = "Unknown";
switch(gClass[playerid])
{
case 0: classstr = "Support";
case 1: classstr = "Medic";
case 2: classstr = "Scout";
case 3: classstr = "Jetrunner";
case 4: classstr = "Pilot";
case 5: classstr = "Spy";
case 6: classstr = "Terminator";
}
return classstr;
}
//------------------------------------------------
ShowPlayerClassSelectionDialog(playerid)
{
new dialogstr[556];
new rank = GetPlayerRank(playerid);
strcat(dialogstr, ""SAMP_BLUE"Support (Rank 0+)\n");
strcat(dialogstr, ""SAMP_BLUE"Medic (Rank 0+)\n");
if(rank >= 1) strcat(dialogstr, ""SAMP_BLUE"Scout (Rank 1+)\n");
else strcat(dialogstr, ""GREY"Scout (Rank 1+)\n");
if(rank >= 3) strcat(dialogstr, ""SAMP_BLUE"Jetrunner (Rank 3+)\n");
else strcat(dialogstr, ""GREY"Jetrunner (Rank 3+)\n");
if(rank >= 5) strcat(dialogstr, ""SAMP_BLUE"Pilot (Rank 5+)\n");
else strcat(dialogstr, ""GREY"Pilot (Rank 5+)\n");
if(rank >= 8) strcat(dialogstr, ""SAMP_BLUE"Spy (Rank 8+)\n");
else strcat(dialogstr, ""GREY"Spy (Rank 8+)\n");
if(rank >= 12) strcat(dialogstr, ""SAMP_BLUE"Terminator (Rank 12+)\n");
else strcat(dialogstr, ""GREY"Terminator (Rank 12+)\n");
return ShowPlayerDialog(playerid, DIALOG_CLASS, DIALOG_STYLE_LIST, "Class selection (/sc)", dialogstr, "Spawn", "Last Class");
}
//------------------------------------------------
]
this is my class system source
According to this source, one can change this code for me?