Help with this
#1

Hi, i have a privatecar script.
And i want to make a /lend [id] command.
So like if the specified name for the car is: JoeDaDude
And another person called for lets say: Torran.
Trys to enter it will kick torran out, But let joedadude in.
But i want to make a command to lend a certain person with the [id]
the car until they go of the server, Once gone of server car wont be theres anymore.
I want this so lets say. If someones ID: 1 i can type /lend 1
ONLY when im in the car i want to lend him.
And if i want to lend someone else the car i type: /lend 2
Again only in the car, Only im no good with ID,
Does anyone have the code for this
Reply
#2

ATM how does it check if the player is the owner of the car?
Reply
#3

pawn Код:
new PlayerName[MAX_PLAYER_NAME];
      GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
      if(strcmp(PlayerName, "[TXS]Torran", false) == 0)
Reply
#4

I mean is thier name set to a variable?, It will have to be if you want to do this
Reply
#5

Erm not understanding but:
pawn Код:
new veh1;
pawn Код:
veh1 = CreateVehicle[CantBeBotherdToWriteTheCoords]
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
  if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
  {
          if(vehicleid == torransuper)
    {
Reply
#6

Код:
if(strcmp(PlayerName, "[TXS]Torran", false) == 0 || LendingVehicle[playerid])
Then /lend sets LendingVehicle[playerid] to w/e the persons car is, but make sure you reset the variable when a new player connects
Reply
#7

Ok ima kinda begginer, And how do i mke the /lend command work and also how do i reset it
Reply
#8

use strtok/sscanf and ReturnUser then to reset the LendingVehicle variable set it to something like 999 in OnPlayerConnect
Reply
#9

Ok question:
How would i link this to that:
pawn Код:
if (strcmp(cmdtext, "/lend", true)==0)

Reply
#10

You would have to have a way of finding out what vehicle that player owns first
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)