Jump to content
  • 0

[Ajutor]Cum schimb bani castigati la joburi


Colenelu

Question

13 answers to this question

Recommended Posts

Pai ai putea sa incepi sa te uiti peste comanda de incepere a munci adica acea comanda cu care incepi sa strangi gunoiul in cazul jobului gunoier . Dupa cauti checkpointurile o sa vezi ca acoolo unde ai comanda o sa ai ceva de genu CP[ playerid ] = 1; sau gCP nu stiu cum il ai tu uitate . Dupa ce faci toate acestea o sa vezi ca la finalul traseului sau dupa un checkpoint pus iti arata acolo ceva cu Money ( GivePlayerMoney ) sau cum o ai tu definita .

Link to comment
Share on other sites

pai nu imi arata acolo la comanda de inceput job ceva cu money adica sa schimb!

if(strcmp(cmd, "/gunoi", true) == 0)
	{
	    if(PlayerData[playerid][pJob] != 18)
		{
			SendClientMessage(playerid, COLOR_GREY, "Server: Nu esti gunoier!");
		    return 1;
		}
		if(CP[playerid] >= 350 && CP[playerid] <= 383)
  		{
    		SendClientMessage(playerid, COLOR_GREY, "Deja lucrezi!");
    		return 1;
		}
		if(IsPlayerInVehicle(playerid, 293) || IsPlayerInVehicle(playerid, 294) || IsPlayerInVehicle(playerid, 295) || IsPlayerInVehicle(playerid, 296) || IsPlayerInVehicle(playerid, 297))
 		{
			CP[playerid] = 350;
			SetPlayerCheckpoint(playerid, 2233.4478,-2215.7744,13.5469,8.0);
			SendClientMessage(playerid, COLOR_YELLOW, "Server: Dute si colecteaza gunoiul de pe strazi!");
		}
		else
		{
		    SendClientMessage(playerid, COLOR_YELLOW, "Server: Nu esti in masina de gunoi!");
		    return 1;
		}
	}

Link to comment
Share on other sites

Pai te folosesti de variabile care le ai tu pentru Level si bani folosesti functia GivePlayerMoney . De preferat punele la dialogul unde se inregistreaza jucatorul . ( Dupa ce s-a inregistrat ii da bani si level ) .

P.S.: Daca nu sti posteaza dialogul de register si varibila pe care o folosesti tu pentru Level .

EDIT: Apropo daca folosesti un gamemode GF posteaza si OnPlayerRegister .

Link to comment
Share on other sites

Pai nu stiu unde sa caut :D am gasit ceva dar nu cred ca e acic

public OnPlayerRegister(playerid, password[]) // v1.0 by starz
{
	if(IsPlayerConnected(playerid))
	{
		MySQLCheckConnection();
		new playername3[MAX_PLAYER_NAME];
		GetPlayerName(playerid, playername3, sizeof(playername3));
		new newaccountsqlid = MySQLCreateAccount(playername3, password, playerid);
		if (newaccountsqlid != 0)
		{
			new loginstring[182];
			PlayerData[playerid][pSQLID] = newaccountsqlid;
			strmid(PlayerData[playerid][pKey], password, 0, strlen(password), 33);
			OnPlayerUpdateEx(playerid);
            format(loginstring,sizeof(loginstring),"{6BF45F}Bun venit pe serverul {FF0000}NewStyle RPG ,{EBBB5A} %s{6BF45F}\nAcest nick este inregistrat.",playername3);
			ShowPlayerDialog(playerid,12346,DIALOG_STYLE_PASSWORD,"Logeaza-te",loginstring,"Login","Exit");
			return 1;
		}
		else
		{
			gPlayerAccount[playerid] = 0;
 			new regstring[182];
			new regname[182];
			GetPlayerName(playerid,regname,sizeof(regname));
			format(regstring,sizeof(regstring),"{FFFFFF}Bine ai venit,{57F906} %s{FFFFFF}\nNu ai cont.",regname);
			ShowPlayerDialog(playerid,12345,DIALOG_STYLE_PASSWORD,"{1E90FF}Inregistreaza-te",regstring,"Register","Exit");
		}
	}
	return 0;
}

Link to comment
Share on other sites

public OnPlayerRequestClass(playerid, classid)
{
	new string[182];
	PlayerData[playerid][pModel] = Peds[classid][0];
	if (RegistrationStep[playerid] == 0 && gPlayerLogged[playerid] != 1)
	{
		if (gPlayerAccount[playerid] != 0)
		{
			new loginstring[182];
			new loginname[182];
			GetPlayerName(playerid,loginname,sizeof(loginname));
			format(loginstring,sizeof(loginstring),"{a9c4e4}Bun venit inapoi pe NewStyle RPG \n{a9c4e4}Cont:{ee5555} %s \n{a9c4e4}Acest cont este inregistrat\nUltimul login: {ee5555}%s",loginname,PlayerData[playerid][pUltLog]);
			ShowPlayerDialog(playerid,12346,DIALOG_STYLE_PASSWORD,"{00FE37}Login",loginstring,"Login","Exit");
		}
		else
		{
			gPlayerAccount[playerid] = 0;
 			new regstring[182];
			new regname[182];
			GetPlayerName(playerid,regname,sizeof(regname));
			format(regstring,sizeof(regstring),"{D7F0F1}Bine ai venit,{06CCF9} %s{D7F0F1}\nAcest cont nu este inregistrat.\n ",regname);
			ShowPlayerDialog(playerid,12345,DIALOG_STYLE_PASSWORD,"{00F6FE}Register",regstring,"Register","Exit");
		}
		PlayerData[playerid][pModel] = Peds[classid][0];
		PlayerData[playerid][pChar] = Peds[classid][0];
		SetPlayerTeamFromClass(playerid,classid);
		SetPlayerWeather(playerid, 0);
	}
    if (classid == 1)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 2)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 3)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 4)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 5)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 6)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 7)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 8)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 9)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 10)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 11)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 12)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 13)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 14)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
 	else if (classid == 15)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else if (classid == 16)
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	else
	{
		format(string, sizeof(string), "");
		GameTextForPlayer(playerid,string,3500,6);
	}
	SetPlayerTeamFromClass(playerid,classid);
	SetupPlayerForClassSelection(playerid);
	return 1;
}

Link to comment
Share on other sites

public OnPlayerLogin(playerid,password[]) // by starz
{
    	new hour,minute,second;
		gettime(hour,minute,second);
        MySQLCheckConnection();
	  	new string2[256];
	  	new tmp2[182];
		MySQLFetchAcctSingle(PlayerData[playerid][pSQLID], "Password", PlayerData[playerid][pKey]);
		//format(string2, sizeof(string2), "DEBUG: PASSED1 , Password from MySQL : %s", PlayerData[playerid][pKey]);
		//SendClientMessage(playerid, -1, string2);
		if(!strcmp(PlayerData[playerid][pKey],password, false) && strlen(password) != 0)
		{
		    //format(string2, sizeof(string2), "DEBUG: PASSED2 , Password from MySQL : %s", password);
			//SendClientMessage(playerid, -1, string2);
		    new Query[256];
		    format(Query, sizeof(Query), "SELECT * FROM players WHERE id= %d", PlayerData[playerid][pSQLID]);
	        mysql_query(Query); // Querys the "Query" Variable.
	        mysql_store_result(); // Stores the result from Query
	        if(mysql_num_rows()) // Checks if theres anyrow.
	        if(mysql_fetch_row_format(Query,"|")) // Splits the row
	        {
				sscanf(Query, "p<|>e<is[182]s[182]iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii>",PlayerData[playerid]);
			}
			MySQLUltLog(PlayerData[playerid][pSQLID], "MarriedTo", PlayerData[playerid][pMarriedTo]);
	    	mysql_store_result();
	    	MySQLUltLog(PlayerData[playerid][pSQLID], "Email", PlayerData[playerid][pEmail]);
	    	mysql_store_result();
		}
		else
		{
				new loginstring[182];
				new loginname[182];
				GetPlayerName(playerid,loginname,sizeof(loginname));
				format(loginstring,sizeof(loginstring),"PAROLA GRESITA\nTe rog baga parola corecta:",loginname);
				ShowPlayerDialog(playerid,12347,DIALOG_STYLE_PASSWORD,"{1E90FF}L{FFFFFF}ogeaza-te",loginstring,"Login","Exit");
		        gPlayerLogTries[playerid] += 1;
		        if(gPlayerLogTries[playerid] == 4) { Kick(playerid); }
		        return 1;
		}
		new year, month,day;
		getdate(year, month, day);
		new string[182];
		new query[MAX_STRING];
		new zero1[5];
		new zero2[5];
		new zero3[5];
		new zero4[5];
		if(hour < 10)
		{
		    zero1 = "0";
		}
		if(minute < 10)
		{
		    zero2 = "0";
		}
        if(day < 10)
		{
		    zero3 = "0";
		}
		if(month < 10)
		{
		    zero4 = "0";
		}
		format(string, sizeof(string), "%s%d:%s%d  %s%d.%s%d.%d",zero1,hour,zero2,minute,zero3,day,zero4,month,year);
		strmid(PlayerData[playerid][pUltLog], string, 0, strlen(string), 255);
		format(query, sizeof(query), "UPDATE players SET UltLog='%s' WHERE id=%d", PlayerData[playerid][pUltLog], PlayerData[playerid][pSQLID]);
		mysql_query(query);
		if(PlayerData[playerid][pPcarkey] == 0)
		{
		    PlayerData[playerid][pPcarkey] = 999;
		    format(query, sizeof(query), "UPDATE players SET Car='%d' WHERE id=%d", PlayerData[playerid][pPcarkey], PlayerData[playerid][pSQLID]);
			mysql_query(query);
		}
		if(PlayerData[playerid][pPcarkey2] == 0)
		{
		    PlayerData[playerid][pPcarkey2] = 999;
		    format(query, sizeof(query), "UPDATE players SET Car2='%d' WHERE id=%d", PlayerData[playerid][pPcarkey2], PlayerData[playerid][pSQLID]);
			mysql_query(query);
		}
		if(PlayerData[playerid][pPcarkey3] == 0)
		{
		    PlayerData[playerid][pPcarkey3] = 999;
		    format(query, sizeof(query), "UPDATE players SET Car3='%d' WHERE id=%d", PlayerData[playerid][pPcarkey3], PlayerData[playerid][pSQLID]);
			mysql_query(query);
		}
		//mysql_free_result();
		PlayerData[playerid][pAdjustable] = 0;
		ConsumingMoney[playerid] = 1;
		if(PlayerData[playerid][pReg] == 0)
		{
			PlayerData[playerid][pLevel] = 1;
			PlayerData[playerid][pSHealth] = 0.0;
			PlayerData[playerid][pHealth] = 50.0;
			PlayerData[playerid][pArmour] = 0.0;
			PlayerData[playerid][pPos_x] = 2246.6;
			PlayerData[playerid][pPos_y] = -1161.9;
			PlayerData[playerid][pPos_z] = 1029.7;
			PlayerData[playerid][pInt] = 15;
			PlayerData[playerid][pLocal] = 255;
			PlayerData[playerid][pTeam] = 3;
			PlayerData[playerid][pModel] = 264;
			new randphone = 1000 + random(8999);//minimum 1000  max 9999 //giving one at the start
			PlayerData[playerid][pPnumber] = randphone;
			PlayerData[playerid][pPhousekey] = 255;
			PlayerData[playerid][pPbiskey] = 255;
			PlayerData[playerid][pPcarkey] = 999;
			PlayerData[playerid][pPcarkey2] = 999;
			PlayerData[playerid][pPcarkey3] = 999;
			PlayerData[playerid][pPcarkey4] = 999;
			PlayerData[playerid][pPcarkey5] = 999;
			PlayerData[playerid][pAccount] = 5000;
			PlayerData[playerid][pReg] = 1;
			PlayerData[playerid][pLocked] = 0;
			GivePlayerCash(playerid, 1000);
			format(string, sizeof(string), "UPDATE players SET Registered='%d' WHERE id=%d", PlayerData[playerid][pReg], PlayerData[playerid][pSQLID]);
			mysql_query(string);
			format(string, sizeof(string), "UPDATE players SET PhoneNr='%d' WHERE id=%d", PlayerData[playerid][pPnumber], PlayerData[playerid][pSQLID]);
			mysql_query(string);
			format(string, sizeof(string), "UPDATE players SET House='%d' WHERE id=%d", PlayerData[playerid][pPhousekey], PlayerData[playerid][pSQLID]);
			mysql_query(string);
			format(string, sizeof(string), "UPDATE players SET Car='%d' WHERE id=%d", PlayerData[playerid][pPcarkey], PlayerData[playerid][pSQLID]);
			mysql_query(string);
			format(string, sizeof(string), "UPDATE players SET Car2='%d' WHERE id=%d", PlayerData[playerid][pPcarkey2], PlayerData[playerid][pSQLID]);
			mysql_query(string);
			format(string, sizeof(string), "UPDATE players SET Car3='%d' WHERE id=%d", PlayerData[playerid][pPcarkey3], PlayerData[playerid][pSQLID]);
			mysql_query(string);
			format(string, sizeof(string), "UPDATE players SET Car4='%d' WHERE id=%d", PlayerData[playerid][pPcarkey4], PlayerData[playerid][pSQLID]);
			mysql_query(string);
			format(string, sizeof(string), "UPDATE players SET Car5='%d' WHERE id=%d", PlayerData[playerid][pPcarkey5], PlayerData[playerid][pSQLID]);
			mysql_query(string);
			format(string, sizeof(string), "UPDATE players SET Bank='%d' WHERE id=%d", PlayerData[playerid][pAccount], PlayerData[playerid][pSQLID]);
			mysql_query(string);
			format(string, sizeof(string), "UPDATE players SET Locked='%d' WHERE id=%d", PlayerData[playerid][pLocked], PlayerData[playerid][pSQLID]);
			mysql_query(string);
		}
		printf(" %s has logged in.", PlayerData[playerid][pNume]);
		new playersip[182];
		getdate(year, month, day);
  		gettime(hour,minute,second);
		GetPlayerIp(playerid,playersip,sizeof(playersip));
		//format(string, sizeof(string), "AdmCmd: %s s-a logat astazi %d/%d/%d ora %d:%d, de pe ip %s",PlayerData[playerid][pNume],month,day,year,hour,minute,playersip);
		//ConnectLog(string);
		format(string, sizeof(string), "INSERT INTO ConnectLog (Nume, Data, IP, Tip) VALUES ('%s', '%s', '%s', 'Logare')", PlayerData[playerid][pNume], PlayerData[playerid][pUltLog], playersip);
		mysql_query(string);
		PlayerData[playerid][pStatus] = 1;
	 	format(string, sizeof(string), "UPDATE players SET Status='%d' WHERE id=%d", PlayerData[playerid][pStatus], PlayerData[playerid][pSQLID]);
		mysql_query(string);
		if(PlayerData[playerid][pAllowed] == 0)
		{
			for(new i=1; i<=maxim;i++)
			{
				if(strfind(playersip, BanData[i][xIp], true) != -1)
				{
					    SendClientMessage(playerid, COLOR_WHITE, "Server: {FF0000}Ai primit ban pe aceasta clasa de ip.");
					    SendClientMessage(playerid, COLOR_LIGHTRED, "Pentru unban viziteaza nu avem/cautam persoana care se pricepe!");
					    Kick(playerid);
					    return 1;
				}
			}
		}
		getdate(year, month, day);
		new hourr,minutee,secondd;
		gettime(hourr,minutee,secondd);
		if(Registerr[playerid] == 2)
		{
			new stringg[182];
			format(stringg, sizeof(stringg), "%d %d %d",day,month,year);
			strmid(PlayerData[playerid][pDateReg], stringg, 0, strlen(stringg), 255);
			format(query, sizeof(query), "UPDATE players SET DateReg='%s' WHERE id=%d", stringg, PlayerData[playerid][pSQLID]);
			Registerr[playerid] = 0;
			mysql_query(query);
			//mysql_free_result();

Link to comment
Share on other sites

Mergi la linia aceasta

PlayerData[playerid][pLevel] = 1;
si acolo inloc de 1 inlocuiesti cu cat vrei sa-i dai tu levelul de exemplu cum ai zis tu sa-i dea level 3
PlayerData[playerid][pLevel] = 3;
si pentru bani mergi la linia aceasta
GivePlayerCash(playerid, 1000);
si inlocuieste tu 1000 cu cati bani vrei sa-i dai de exemplu 1 milion cum ai mentionat tu mai sus :
GivePlayerCash(playerid, 1000000);

Vezi ca doar in callbackul OnPlayerLogin sa le modifica nu in alta parte . Bafta ! ;)

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.