SA-MP Forums Archive
RANKS! Im stux lulz.... - 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: RANKS! Im stux lulz.... (/showthread.php?tid=107306)



RANKS! Im stux lulz.... - DiddyBop - 09.11.2009

Ok so i wanted to add ranks 2 muh server that was based off score.


So like if you score isnt.. 200 You cant use.. rocket launcher? Or rhino.. etc...

Can som1 just explain\show how i would start it out?


Re: RANKS! Im stux lulz.... - mamorunl - 09.11.2009

pawn Код:
SetTimer("timer", 3000, 1); // create a repeating timer of x (here 3000) milliseconds
new allowhydra = 0; // creating a variable which will be used as a boolean to check if he/she can use a hydra

// next, we are going to create the timer
public timer() {
// check if his score is lower than 200
if(GetPlayerScore(playerid) < 200)
// score is lower than 200, player cannot use hydra
  allowhydra = 0;
else
// score is higher than or the same as 200, player can use hydra
  allowhydra = 1;
return 1;
}
pawn Код:
OnPlayerStateChange(playerid, new_state, old_state) // I may have this function wrong, please check the manual that corresponds to this function
{
  // checking if the player is entering the vehicle as a driver
  if(new_state == PLAYER_STATE_DRIVER)
  {
    // check if the vehicle is the hydra where he/she cannot enter when points are below 200
    if(GetPlayerVehicleID(playerid) == THE_HYDRA) { // whereas THE_HYDRA is your vehicle ID of the hydra
      if(allowhydra ==0) { // checking if the player has a score below 200
        RemovePlayerFromVehicle(playerid, GetPlayerVehicleID(playerid); // remove the player from the hydra
        SendClientMessage(playerid, COLOR_YOURCOLOR, "You are not allowed to fly the hydra");// Send the message that says that he/she is not allowed to enter the hydra
      }
    }
  }
}
I am not at a location where I can test this code, if there are any errors, please post them here and we will solve them or try to solve them yourself if you feel like it

THE_HYDRA can also be replaced with a rhino or another vehicle.

A weapon will be a little bit different and harder as you have to check if the player has the weapon in his slots and remove it from that or don't give it to them in the first place. The same Timer can be used for that.

If there are any questions, please do not hesitate and post them.



Re: RANKS! Im stux lulz.... - TouR - 08.01.2010

and how to save this variable?