[RENT] Help
#1

Hello

I have a problem.

I maked rent bikes and when someone gets in the bike it shows and dialog if you want to accept and decline if you accept you can ride and in every 2 minutes you pay 20$ and when you get out it must kill the timer but it kills it not

When you get out the timer is not killed it is spamming in every 2 minutes you payed 20$ .. and you must relog

It's working fine only for ID 0

here is my command

Quote:

new renttimer;

#define RENTANJE 991
forward RentStop();
new RentCar[19];
forward IsARentCar(carid);
forward RentPlati(playerid);


if(dialogid == RENTANJE)
{
if(response)
{
renttimer = SetTimer("RentPlati", 60000, 1);
SendClientMessage(playerid, COLOR_INFO, "INFO:{FFFFFF}You can ride now");
}
else
{
RemovePlayerFromVehicle(playerid);
}
}

public RentStop()
{
KillTimer(renttimer);
}

public OnPlayerExitVehicle(playerid)
{
RentStop();
return 1;
}


public IsARentCar(carid)
{
for(new i = 0; i < sizeof(RentCar); i++)
{
if(carid == RentCar[i]) return 1;
}
return 0;
}





public OnPlayerStateChange(playerid, newstate, oldstate)
{
...

if(IsARentCar(newcar)) //rent koli
{
new string[256];
new coordsstring1[256];
new coordsstring2[256];
new coordsstring3[256];
new coordsstring4[256];
new textp;
new texto;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(coordsstring1, sizeof(coordsstring1),"%s, if you want to rent this vehicle", sendername);
format(coordsstring2, sizeof(coordsstring2),"\n Press 'Accept,textp);
format(coordsstring3, sizeof(coordsstring3),"\n If you want to get out press Decline'",texto);
format(coordsstring4, sizeof(coordsstring4),"\n {F00000}Money: 20$/minute",texto);
format(string, 991," %s%s%s%s",coordsstring1,coordsstring2,coordsstring 3,coordsstring4);
ShowPlayerDialog(playerid, 991, DIALOG_STYLE_MSGBOX, "Rent Vehicle", string, "Accept", "Decline");
}




Hope you will help me
Reply
#2

Код:
new renttimer[MAX_PLAYERS];

renttimer[playerid] = SetTimer("RentPlati", 60000, 1);

public RentStop(playerid)
{
    KillTimer(renttimer[playerid]);
}

public OnPlayerExitVehicle(playerid)
{
    RentStop(playerid);
    return 1;
}
Reply
#3

Quote:
Originally Posted by lelemaster
Посмотреть сообщение
Код:
new renttimer[MAX_PLAYERS];

renttimer[playerid] = SetTimer("RentPlati", 60000, 1);

public RentStop(playerid)
{
    KillTimer(renttimer[playerid]);
}

public OnPlayerExitVehicle(playerid)
{
    RentStop(playerid);
    return 1;
}
i will try it now

EDIT: it's not working but all its bugged


Can someone make for me a another please
Reply
#4

Make a SetTimerEx

SetTimerEx("RentPlati", 60000, 1, "i", playerid);

Edit: BTW, it's now each 2 mins, it's each min that you need to pay. 60000 miliseconds is 1 minute

Edit2:

Try this:

Код:
new renttimer[MAX_PLAYERS];

#define RENTANJE 991
new RentCar[19];
forward IsARentCar(carid);
forward RentPlati(playerid);


if(dialogid == RENTANJE)
{
if(response)
{
renttimer[playerid] = SetTimerEx("RentPlati", 60000, 1, "i", playerid);
SendClientMessage(playerid, COLOR_INFO, "INFO:{FFFFFF}You can ride now");
}
else
{
RemovePlayerFromVehicle(playerid);
}
}



public OnPlayerExitVehicle(playerid)
{
    KillTimer(renttimer[playerid]);
    return 1;
}


public IsARentCar(carid)
{
for(new i = 0; i < sizeof(RentCar); i++)
{
if(carid == RentCar[i])	return 1;
}
return 0;
}





public OnPlayerStateChange(playerid, newstate, oldstate)
{
...

if(IsARentCar(newcar)) //rent koli
{
new string[256];
new coordsstring1[256];
new coordsstring2[256];
new coordsstring3[256];
new coordsstring4[256];
new textp;
new texto;
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(coordsstring1, sizeof(coordsstring1),"%s, if you want to rent this vehicle", sendername);
format(coordsstring2, sizeof(coordsstring2),"\n Press 'Accept,textp);
format(coordsstring3, sizeof(coordsstring3),"\n If you want to get out press Decline'",texto);
format(coordsstring4, sizeof(coordsstring4),"\n {F00000}Money: 20$/minute",texto);
format(string, 991," %s%s%s%s",coordsstring1,coordsstring2,coordsstring 3,coordsstring4);
ShowPlayerDialog(playerid, 991, DIALOG_STYLE_MSGBOX, "Rent Vehicle", string, "Accept", "Decline");
}
Reply
#5

Quote:
Originally Posted by lelemaster
Посмотреть сообщение
Make a SetTimerEx

SetTimerEx("RentPlati", 60000, 1, "i", playerid);
Yeeeeeeeeeeeeeeeeeee thanks man +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)