Jump to content
  • 0

Job


Tikitaka

Question

Problema intalnita (descriere):Am creeat un job, care atunci cand mergi pe o anumita zona cu pete 25 km/h sa primesti 300$ odata la 3 secunde, dar cum pot face ca atunci cand se lasa afk sa nu primeasca bani?
Ero(area / rile) / warning-(ul / urile):
Liniile de cod / sursa / script-ul:

public SetMower(playerid)
{
	if(mowerc[playerid] == 1)
	{
	    if(PlayerToPoint(150.0,playerid, -291.0211,-1428.4664,12.8581))
	    {
			new tmpcar = GetPlayerVehicleID(playerid);
			new ccar = IsPlayerInAnyVehicle(playerid);
			new spe = Carspeed(playerid);
			if(ccar && IsAMower(tmpcar) && spe > 10)
			{
				if(mowermoney[playerid] <= 15000)
				{
					mowermoney[playerid] += 375;
					new str2[128];
					format(str2,sizeof(str2),"Money earned: $%d",mowermoney[playerid]);
					TextDrawSetString(Bus2[playerid], str2);
					TextDrawShowForPlayer(playerid, Bus2[playerid]);
					GivePlayerCash(playerid, 375);
					Update(playerid, pCashx);
				}
				else if(mowermoney[playerid] > 15000)
				{
					mowermoney[playerid] = 0;
					mowerc[playerid] = 0;
					RemovePlayerFromVehicleEx(playerid);
					KillTimer(timerm[playerid]);
					TextDrawHideForPlayer(playerid, Bus2[playerid]);
				}
			}
		}
		else
		{
			TextDrawHideForPlayer(playerid, Bus2[playerid]);
			GameTextForPlayer(playerid, "~r~You are not in farmer area.", 3000, 1);
		}
	}
	return 1;
}

Imagini / Video (optional):
Ati incercat sa rezolvati singur?:

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

 Va trebui să creezi un public OnPlayerPause (  asta dacă nu îl ai deja  ) și acolo să ai o variabla să memoreze că jucătorul este afk, apoi cu un if în comanda ta vei verifica dacă jucătorul este afk.

 

Exemplu:

public OnPlayerPause(playerid)
{
    EsteAfk(playerid, 1);
	return 1;
}
public OnPlayerUnpause(playerid)
{
    EsteAfk(playerid, 0);
	return 1;
}

if(EsteAfk == 0 )
{    if(mowermoney[playerid] <= 15000)
				{
					mowermoney[playerid] += 375;
					new str2[128];
					format(str2,sizeof(str2),"Money earned: $%d",mowermoney[playerid]);
					TextDrawSetString(Bus2[playerid], str2);
					TextDrawShowForPlayer(playerid, Bus2[playerid]);
					GivePlayerCash(playerid, 375);
					Update(playerid, pCashx);
				}
}
Edited by R3muSGFX
qua8n0lrq5wl5v5xccbk.png
 
mf79y6bvavi9sp2qqfoi.png
Contact: Mail: [email protected]
Y!M: r3mus.onlypro
Skype: r3mus.onlypro
Link to comment
Share on other sites

  • 0

Nu,faci exact cum ti-a spus R3muSGFX dar,a uitat sa iti spuna sa faci un forward cu numele OnPlayerPause(playerid) dar si alt forward cu OnPlayerUnpause

Exemplu:

forward OnPlayerPause(playerid)
public OnPlayerPause(playerid)
{
EsteAfk(playerid, 1);
    return 1;
}
forward OnPlayerUnpause(playerid)
public OnPlayerUnpause(playerid)
{
EsteAfk(playerid, 0);
    return 1;
}
 

 

 

Link to comment
Share on other sites

  • 0

nu functioneaza, specific ca am facut in felul urmator

 

am adaugat la job

if(EsteAfk[playerid] == 0 )
{

si am creeat public-urile astea:

public OnPlayerPause(playerid)
{
	EsteAfk[playerid] = 1;
    return 1;
}
public OnPlayerUnpause(playerid)
{
	EsteAfk[playerid] = 0;
    return 1;
}
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.