PDA

View Full Version : how to let ppl give money away..


niels44
01/01/2012, 06:07 PM
hey guys,
i want to make it that when a players does somethin example: /hey that they get $20000 away from them so they have to pay it to the server u know... but how to make it i already tried to make this:
GivePlayerMoney(playerid, -20000); but that aint working...

pls help
niels

Davz*|*Criss
01/01/2012, 06:09 PM
I did not understood! :(

niels44
01/01/2012, 06:14 PM
hmm well when players use thje cmd /hey that they lose $20000 of their money... this better explaination i hope...

iGetty
01/01/2012, 06:19 PM
Do you have anything that is defining the players money?

What gamemode are you using?

niels44
01/01/2012, 06:23 PM
im using my own gamemode NYD_Drifitng i want to make this for version 4 and no i havent got anything that defines it

iGetty
01/01/2012, 06:28 PM
Hmm, then GivePlayerMoney(playerid, -20000); should be working.

Oh
01/01/2012, 06:34 PM
Do you have a variable as your money?
PlayerInfo[playerid][pCash] -= 20000;

Be something like that. Just find your $ variable.

niels44
01/01/2012, 06:38 PM
wut u mena? i dont understand u

Oh
01/01/2012, 06:40 PM
Do you have money set as a variable.

Like in a normal script to prevent anti-money hacks etc they use pCash as a variable for $.

What script are you editing? I'll take a look at it and help you find the variable, I'm pretty sure it'd have it as pMoney or pCash or something like that. Not alot of people use GivePlayerMoney or w/e anymore.

niels44
01/01/2012, 06:47 PM
eehm im using the gamemode NYD_Drifting and im editting the gamemode but i dont understand wut u say for the rest

niels44
01/01/2012, 06:49 PM
can u just tell me wut to edit in the script and where...?

Jochemd
01/01/2012, 06:53 PM
I see the server is not using server-side money (according to the NYD-Drifing topic (http://forum.sa-mp.com/showthread.php?t=302539)) so just use...


GivePlayerMoney(playerid, -20000);


... at your "/hey" command (find CMD:hey(playerid, params[]) )

Ananay
01/01/2012, 06:56 PM
Try this

SetPlayerMoney(playerid, GetPlayerMoney(playerid)-20000);

niels44
01/01/2012, 06:58 PM
hmm someway it is working now with that giveplayermoney but i think i want to use the other methode becuz i want my server to look bit profesional u know XD so how that other method works?

Jochemd
01/01/2012, 06:59 PM
hmm someway it is working now with that giveplayermoney but i think i want to use the other methode becuz i want my server to look bit profesional u know XD so how that other method works?

I don't know what you are talking about. There is not "another method". The other people who were talking about [pCash] were talking about server-side money, which prevents people from cheating cash (you have to script that).

Try this

SetPlayerMoney(playerid, GetPlayerMoney(playerid)-20000);

SetPlayerMoney? Never knew about that function - has to be scripted as well.

niels44
01/01/2012, 07:00 PM
hmm ok it is working now and how to make it that when a player enters a car he immediately gets out again ... so when the player enters a sultan then he gets a dialog and then he has to press buy or cancel and when he presses cancel that the players steps out of the car again... how to make that?

Jochemd
01/01/2012, 07:03 PM
hmm ok it is working now and how to make it that when a player enters a car he immediately gets out again ... so when the player enters a sultan then he gets a dialog and then he has to press buy or cancel and when he presses cancel that the players steps out of the car again... how to make that?

You can use ShowPlayerDialog to show the player a dialog. Then, in OnDialogResponse, use...


if(dialogid == DIALOG_CAR)
{
if(response)
{
// Script here so the player loses cash and purchases the vehicle.
}
else
{
// Script here so the player gets thrown out of the vehicle.
}
}

... To make the player able to buy a car. I don't know how exactly you want it, but this is just very very basic.

niels44
01/01/2012, 07:08 PM
yes i have this:
if(dialogid == 12345){
if(response){
GivePlayerMoney(playerid, -20000);
}
else{
//The player has pressed "No".
}
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == sultan1){
ShowPlayerDialog(playerid, 12345, DIALOG_STYLE_MSGBOX, "Car For Rent", "Do you want to rent this vehicle for $10000? ", "Yes", "No");
}
return 1;
}

but how to script it that the player gets thrown out of the vehicle??

niels44
01/01/2012, 07:17 PM
?? need help with this.. here i changed a little thing:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
switch(vehicleid)
{
case 0 .. 8:
ShowPlayerDialog(playerid, 12345, DIALOG_STYLE_MSGBOX, "Car For Rent", "Do you want to rent this vehicle for $10000? ", "Yes", "No");
}
return 1;
}
and this is the first part of ongamemodeinit:
public OnGameModeInit()
{
SetGameModeText("[TDC] Tokyo Drift Central");
infernus1 = AddStaticVehicle(411,2512.69995117,-1671.40002441,13.30000019,82.00000000,-1,-1); //Infernus
infernus2 = AddStaticVehicle(411,2511.80004883,-1674.69995117,13.30000019,80.00000000,-1,-1); //Infernus
infernus3 = AddStaticVehicle(411,2506.60009766,-1683.69995117,13.19999981,46.00000000,-1,-1); //Infernus
infernus4 = AddStaticVehicle(411,2475.39990234,-1681.50000000,13.19999981,0.00000000,-1,-1); //Infernus
infernus5 = AddStaticVehicle(411,2478.80004883,-1681.59997559,13.10000038,0.00000000,-1,-1); //Infernus
infernus8 = AddStaticVehicle(411,2481.80004883,-1681.30004883,13.10000038,0.00000000,-1,-1); //Infernus
infernus9 = AddStaticVehicle(411,2485.09960938,-1682.09960938,13.10000038,0.00000000,-1,-1); //Infernus
// credits to sahil for his addplayerclasses.
AddPlayerClass(0,1958.3783,1343.1572,15.3746,270.1 425,0,0,24,300,-1,-1);
AddPlayerClass(266,1958.3783,1343.1572,15.3746,270 .1425,0,0,24,300,-1,-1);
AddPlayerClass(267,1958.3783,1343.1572,15.3746,270 .1425,0,0,24,300,-1,-1);
AddPlayerClass(268,1958.3783,1343.1572,15.3746,269 .1425,0,0,24,300,-1,-1);
AddPlayerClass(269,1958.3783,1343.1572,15.3746,269 .1425,0,0,24,300,-1,-1);
AddPlayerClass(270,1958.3783,1343.1572,15.3746,269 .1425,0,0,24,300,-1,-1);
AddPlayerClass(271,1958.3783,1343.1572,15.3746,269 .1425,0,0,24,300,-1,-1);

Littlehelper
01/01/2012, 07:18 PM
if(strcmp(cmdtext, "/hey", true) == 0){
GivePlayerMoney(playerid, -20000);
return 1;
}
Tested And Works!

niels44
01/01/2012, 07:26 PM
yes little i already have that XD but see my next question (ABOVE)

niels44
01/01/2012, 08:09 PM
come on man can anyone help me?

niels44
02/01/2012, 06:45 AM
PROBLEM SOLVED!!!