Help with this - 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 with this (
/showthread.php?tid=64124)
Help with this -
JoeDaDude - 02.02.2009
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
Re: Help with this -
ICECOLDKILLAK8 - 02.02.2009
ATM how does it check if the player is the owner of the car?
Re: Help with this -
JoeDaDude - 02.02.2009
pawn Код:
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp(PlayerName, "[TXS]Torran", false) == 0)
Re: Help with this -
ICECOLDKILLAK8 - 02.02.2009
I mean is thier name set to a variable?, It will have to be if you want to do this
Re: Help with this -
JoeDaDude - 02.02.2009
Erm not understanding but:
pawn Код:
veh1 = CreateVehicle[CantBeBotherdToWriteTheCoords]
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
{
if(vehicleid == torransuper)
{
Re: Help with this -
ICECOLDKILLAK8 - 02.02.2009
Код:
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
Re: Help with this -
JoeDaDude - 02.02.2009
Ok ima kinda begginer, And how do i mke the /lend command work and also how do i reset it
Re: Help with this -
ICECOLDKILLAK8 - 02.02.2009
use strtok/sscanf and ReturnUser then to reset the LendingVehicle variable set it to something like 999 in OnPlayerConnect
Re: Help with this -
JoeDaDude - 02.02.2009
Ok question:
How would i link this to that:
pawn Код:
if (strcmp(cmdtext, "/lend", true)==0)
Re: Help with this -
ICECOLDKILLAK8 - 02.02.2009
You would have to have a way of finding out what vehicle that player owns first