Sign in to follow this  
Kenoby

Q? and A! SA:MP

77 posts in this topic

Dupa cum spune si titlul topicului aici ne puteti pune intrebari legate de scripting iar voi va vom va indicii prin care puteti face acel lucru.

Atentie!Nu aveti voie sa intrebati despre caracteristica eG,sa faceti 2xpost,spam sau sa postati folosind cuvinte vulgare.

Share this post


Link to post
Share on other sites

Cum fac sa utilizez zcmd fara a lua eroarea ca comanda cmd_x nu este definita?

Share this post


Link to post
Share on other sites

Cum fac sa utilizez zcmd fara a lua eroarea ca comanda cmd_x nu este definita?

 

Pai eu stiu de la ce iei, cum ai creeat comanda ? Mi-o poti arata te rog ? Si daca ai creeat-o corect asigurate ca ai include-ul instalat in pawno / includes si in gamemode #include <ZCMD>.

 

ATENTIE:

 

Comenzile ZCMD se fac inafara oricarui public.

Share this post


Link to post
Share on other sites

Deci intr-un cuvant nu trebuie facuta in acel public onplayercommandperfomed?

Share this post


Link to post
Share on other sites

Deci intr-un cuvant nu trebuie facuta in acel public onplayercommandperfomed?

 

Nu, dragule, deaia nu iti mergea tie. faci comenzile intr-un spatiu gen, uite iti fac un print: http://postimg.org/image/yizfkbph1/

 

 

Ai priceput ?

Share this post


Link to post
Share on other sites

Tot incerc sa bag masini la factiuni :) dar cand le adaug cu codul acesta :

    AddStaticVehicle(522,2205.2173,-991.0331,63.4937,156.5589,1,1); // NRG nortenos
    AddStaticVehicle(522,2203.1794,-991.0209,63.4873,159.1828,1,1); // NRG nortenos
    AddStaticVehicle(516,2193.2930,-1015.4820,62.1692,74.8423,6,6); // pony nortenos
    AddStaticVehicle(409,2158.5847,-998.6808,62.6464,80.9300,6,6); // limuzina nortenos
    AddStaticVehicle(535,2204.7925,-1008.9584,61.4090,66.1119,6,6); // slamvan nortenos
    AddStaticVehicle(533,2179.4026,-1012.5861,62.5347,80.3403,6,6); // glendale nortenos
    AddStaticVehicle(517,2177.0129,-985.3560,64.3273,351.4663,6,6); // feltzer nortenos
    AddStaticVehicle(474,2151.8418,-989.6100,62.2209,79.2732,6,6); // brodway nortenos


Ce as putea sa fac as incerca asta dar tot nu merge: 

f(newcar == A || newcar == B || newcar == C || newcar == 140 || newcar == 137 || newcar == 13
{
if(PlayerInfo[playerid][pMember] == 12||PlayerInfo[playerid][pLeader] == 12) { }
else
{
SendClientMessage(playerid,COLOR_GREY,"Nu esti membru Crips");
RemovePlayerFromVehicle(playerid);
}
}

e doar un ex nu e id de la ele am dat /oldcar si m-am uitat ce cod,si am modificat A B cu id lor

Cand intru in ele zice ca nu sunt taxi memeber,imi da wanted :etc :etc :

Edited by Graves

Share this post


Link to post
Share on other sites

sall.cum pot face ca atunci cand omor un rival sa imi dea o suma de bani ???este pentru un gm stunt unde ballas si grove (bloods si crips) se tot omoara intre ei.sper ca nu este vreo problema ca daca dai F4 poti sa schimbi factiunea

Share this post


Link to post
Share on other sites

sall.cum pot face ca atunci cand omor un rival sa imi dea o suma de bani ???este pentru un gm stunt unde ballas si grove (bloods si crips) se tot omoara intre ei.sper ca nu este vreo problema ca daca dai F4 poti sa schimbi factiunea

 

Nu este greu de realizat ce vrei tu sa faci. Trebuie sa o iei logic, deci vreau sa fac un sistem atunci cand 2 rivali se lupta pana la moarte iar apoi cine castiga primeste o suma de bani. Intrii la onplayerdeath si incepi cu if rivalul ( poate fii playerinfo etc ). Iti dau o secventa de cod dupa care zic eu ca e fff usor sa te inspiri

if(IsPlayerConnected(killerid))
	    {
			if(kleader == 6 || kmember == 6)
			{
			    if(insala[playerid] == 1 || PlayerInfo[playerid][pJailed] == 1 || PlayerInfo[playerid][pJailed] == 2) return 1;
			    if(insala[killerid] == 1 || PlayerInfo[killerid][pJailed] == 1 || PlayerInfo[killerid][pJailed] == 2) return 1;
			    SendClientMessage(killerid, COLOR_GREY, "You killed an rival player and got $750 for that");
			    SendClientMessage(playerid, COLOR_GREY, "You got killed by an rival player");
                new killername[MAX_PLAYER_NAME];
			    GetPlayerName(killerid, killername, sizeof(killername));
				new killerstring[258];
				format(killerstring, sizeof(killerstring), "[killed] You got killed by {FFFFFF}%s.", killername);
			    SendClientMessage(playerid, COLOR_RED, killerstring);
			    PlayerInfo[killerid][pKills] += 1;
				PlayerInfo[playerid][pDeaths] += 1;
				PlayerInfo[killerid][pCash] += 750;
				GameTextForPlayer(killerid, "~b~+~g~750~y~$", 5000, 1);
				new Float:x, Float:y, Float:z;
    			GetPlayerPos(playerid, x, y, z);
			}

Share this post


Link to post
Share on other sites

new cars[7]; // cars[7] este un vector cu 7 "masini" integrabile, incepana de la 0, pana la 6

 

Pe urma mergi la OnGameModeInit si va arata ceva de genu:

cars[0]= AddStaticVehicleEx(...);

cars[1]= AddStaticVehicleEx(...);

..................................................

cars[6]= AddStaticVehicleEx(...);

 

Apoi te duci la functia de restrictie si scrii:

if(newcar == cars[0] || newcar == cars[1] || ... || newcar == cars[6])

Share this post


Link to post
Share on other sites

Tot incerc sa bag masini la factiuni 1.gif dar cand le adaug cu codul acesta :

    AddStaticVehicle(522,2205.2173,-991.0331,63.4937,156.5589,1,1); // NRG nortenos
    AddStaticVehicle(522,2203.1794,-991.0209,63.4873,159.1828,1,1); // NRG nortenos
    AddStaticVehicle(516,2193.2930,-1015.4820,62.1692,74.8423,6,6); // pony nortenos
    AddStaticVehicle(409,2158.5847,-998.6808,62.6464,80.9300,6,6); // limuzina nortenos
    AddStaticVehicle(535,2204.7925,-1008.9584,61.4090,66.1119,6,6); // slamvan nortenos
    AddStaticVehicle(533,2179.4026,-1012.5861,62.5347,80.3403,6,6); // glendale nortenos
    AddStaticVehicle(517,2177.0129,-985.3560,64.3273,351.4663,6,6); // feltzer nortenos
    AddStaticVehicle(474,2151.8418,-989.6100,62.2209,79.2732,6,6); // brodway nortenos


Ce as putea sa fac as incerca asta dar tot nu merge: 

f(newcar == A || newcar == B || newcar == C || newcar == 140 || newcar == 137 || newcar == 13
{
if(PlayerInfo[playerid][pMember] == 12||PlayerInfo[playerid][pLeader] == 12) { }
else
{
SendClientMessage(playerid,COLOR_GREY,"Nu esti membru Crips");
RemovePlayerFromVehicle(playerid);
}
}

e doar un ex nu e id de la ele am dat /oldcar si m-am uitat ce cod,si am modificat A B cu id lor

Cand intru in ele zice ca nu sunt taxi memeber,imi da wanted :etc :etc :

 

 

 

Foloseste CreateVehicle mai bine.

Share this post


Link to post
Share on other sites

Tot incerc sa bag masini la factiuni 1.gif dar cand le adaug cu codul acesta :

    AddStaticVehicle(522,2205.2173,-991.0331,63.4937,156.5589,1,1); // NRG nortenos
    AddStaticVehicle(522,2203.1794,-991.0209,63.4873,159.1828,1,1); // NRG nortenos
    AddStaticVehicle(516,2193.2930,-1015.4820,62.1692,74.8423,6,6); // pony nortenos
    AddStaticVehicle(409,2158.5847,-998.6808,62.6464,80.9300,6,6); // limuzina nortenos
    AddStaticVehicle(535,2204.7925,-1008.9584,61.4090,66.1119,6,6); // slamvan nortenos
    AddStaticVehicle(533,2179.4026,-1012.5861,62.5347,80.3403,6,6); // glendale nortenos
    AddStaticVehicle(517,2177.0129,-985.3560,64.3273,351.4663,6,6); // feltzer nortenos
    AddStaticVehicle(474,2151.8418,-989.6100,62.2209,79.2732,6,6); // brodway nortenos


Ce as putea sa fac as incerca asta dar tot nu merge: 

f(newcar == A || newcar == B || newcar == C || newcar == 140 || newcar == 137 || newcar == 13
{
if(PlayerInfo[playerid][pMember] == 12||PlayerInfo[playerid][pLeader] == 12) { }
else
{
SendClientMessage(playerid,COLOR_GREY,"Nu esti membru Crips");
RemovePlayerFromVehicle(playerid);
}
}

e doar un ex nu e id de la ele am dat /oldcar si m-am uitat ce cod,si am modificat A B cu id lor

Cand intru in ele zice ca nu sunt taxi memeber,imi da wanted :etc :etc :

 

 

Problema este ca tu le adaugi inaintea altora . Ca sa nu mai ai problmea asta trebuie sa le adaugi la sfarsit , dupa ultima masina , pentru ca daca adaugi inaintea uneia toate or sa aiba alt id dupa .

 

Sa iti explic in cod :

AddStaticVehicle(id,blabla,restu); // Masina cu ID 1
AddStaticVehicle(id,blablabla);//Masina cu ID 2
AddStaticVehicle(id,blabla);//Masina cu ID 3

Daca tu vrei sa adaugi o masina noua , o adaugi la final , adica asa

AddStaticVehicle(id,blabla,restu); // Masina cu ID 1
AddStaticVehicle(id,blablabla);//Masina cu ID 2
AddStaticVehicle(id,blabla);//Masina cu ID 3
AddStaticVehicle(id,blabla);//Noua masina care va avea ID 4

Pentru ca daca o pui intre ele va devenii asa :

AddStaticVehicle(id,blabla,restu); // Masina cu ID 1 => Ramane tot 1
AddStaticVehicle(id,blabla);//Masina care vrei sa o adaugi => ID 2
AddStaticVehicle(id,blablabla);//Masina cu ID 2 => Devine id 3
AddStaticVehicle(id,blabla);//Masina cu ID 3 => Devine ID 4

Oricum cel mai bine si cel mai bine e sa te apuci de un sistem de masini "custom mode" ca sa zic asa . Eu aveam pe mysql (mi sa parut mai simplu ) . Asta pentru ca poti asocia variabile masinii (dupa id-ul ei cei drept) de genul : Restrictii , owner , factiune , etc etc .

 

Ar mai fi o varianta (pe care personal nu o recomand , dar functioneaza ) .

Creezi variabile pentru fiecare masina pe care o faci , adica asa

new masinadepd1;

Si acolo unde spawnezi masina , faci asa

masinadepd1 = AddStaticVehicle(id,blabla);

Si la restrictie nu mai pui numarul masinii , ci pui numele variabilei (masinadepd1 in cazul de fata)

Asa mai exact :

if(newcar == masinadepd1){}
else{RemovePlayerFromVehicle(playerid);SendClientMessage(playerid,culoare,"Nu esti Gabor");return 1;}

Sper ca ai inteles 1.gif

Edited by Dj_Maryo1993

Share this post


Link to post
Share on other sites

Aici nu e topic de suport,aici ne ceri parerea cum poti face diverse comenzi ,ce conditii sa pui .

Share this post


Link to post
Share on other sites

Cum pot pune la un /pm pentru admini si helperi o conditie ca mesajul trimis de respectivul admin sa se trimita si celorlalti admini si helperi on?

Share this post


Link to post
Share on other sites

Cum pot pune la un /pm pentru admini si helperi o conditie ca mesajul trimis de respectivul admin sa se trimita si celorlalti admini si helperi on?

 

Un chat unde pot discuta si helperi si admini ? Daca da, iata:

CMD:chat(playerid, params [])
{
   new hstring[128], astring[128];
   if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_ORANGE, "DENIED: {FFFFFF}You are not authorized to use that command.");
   if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_ORANGE, "{F97804}USAGE:{B4B5B7}{FFFFFF} /c [message]");
   if(strlen(params) > 60) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Line too long");
   
   format(hstring, sizeof(hstring), "<< %d Helper %s: %s >>", PlayerInfo[playerid][pHelper], PlayerName(playerid), params);
   format(astring, sizeof(astring), "<< %d %s: %s >>", PlayerInfo[playerid][pAdmin], PlayerName(playerid), params);
   if (PlayerInfo[playerid][pHelper] >= 1)
   {
       SendClientMessage(playerid, COLOR_GREEN, hstring);
   }
   if (PlayerInfo[playerid][pAdmin] >= 1)
   {
       SendClientMessage(playerid, COLOR_GREEN, astring);
   }
   return 1;

}

L-am facut rapid, nu l-am testat.

Share this post


Link to post
Share on other sites

Nu e rea nici chestia asta :)))

Eu ziceam ceva de genul asta uite:

Un admin sau helper trimite un mesaj cuiva cu /pm

Cum as putea face ca mesajul trimis de admin sau helper cu /pm sa se vada si celorlalti admini, helperi on. De exemplu eu i-am trimis lui CaRa mesajul: Salut!

Pentru ceilalti admini/helperi on sa apara: Shad9w send message to CaRa: Salut !

 

Cam ceva asa :D

Share this post


Link to post
Share on other sites
CMD:whisper(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new string[128], text[128], ID, sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], string2[256];
        if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You havent logged in yet !");
        if(PlayerInfo[playerid][pLevel] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "You need at least level 2 !");
		if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "You cannot speak, you have been silenced. Use {33CCFF}/mutetime");
		if(sscanf(params, "us[128]", ID, text)) return SendClientMessage(playerid, COLOR_ORANGE, "{F97804}USAGE:{B4B5B7}{FFFFFF} (/w)hisper [playerid/PartOfName] [whisper text]");
		if (IsPlayerConnected(ID))
		{
		    if(ID != INVALID_PLAYER_ID)
		    {
		        if(HidePM[ID] > 0) return SendClientMessage(playerid, COLOR_GREY, "That player is blocking Whispers !");
				GetPlayerName(playerid, sendername, sizeof(sendername));
				GetPlayerName(ID, giveplayer, sizeof(giveplayer));
				format(string, sizeof(string), "{FFFF00}%s ({ffffff}ID: %d{FFFF00}) whispers: {ffffff}%s", sendername, playerid, text);
				SendClientMessage(ID, COLOR_YELLOW, string);
				format(string, sizeof(string), "{FFFF00}PM sent to %s ({ffffff}ID: %d{FFFF00}):{ffffff} %s", giveplayer, ID, text);
				SendClientMessage(playerid, COLOR_YELLOW, string);
				
				format(string2, sizeof(string2), "%s sent whisper to %s: %s", sendername, giveplayer, params);
				SendHelperMessage(COLOR_GREEN, string2); // ti-am adaugat asta
				SendAdminMessage(COLOR_ORANGE, string2); // si asta
				return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD1, "Invalid player !");
		}
	}
	return 1;
}

E bine acum, schimbi tu numele comenzii.

  • Like 1

Share this post


Link to post
Share on other sites

 

CMD:whisper(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new string[128], text[128], ID, sendername[MAX_PLAYER_NAME], giveplayer[MAX_PLAYER_NAME], string2[256];
        if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_GRAD1, "You havent logged in yet !");
        if(PlayerInfo[playerid][pLevel] == 1) return SendClientMessage(playerid, COLOR_GRAD1, "You need at least level 2 !");
		if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "You cannot speak, you have been silenced. Use {33CCFF}/mutetime");
		if(sscanf(params, "us[128]", ID, text)) return SendClientMessage(playerid, COLOR_ORANGE, "{F97804}USAGE:{B4B5B7}{FFFFFF} (/w)hisper [playerid/PartOfName] [whisper text]");
		if (IsPlayerConnected(ID))
		{
		    if(ID != INVALID_PLAYER_ID)
		    {
		        if(HidePM[ID] > 0) return SendClientMessage(playerid, COLOR_GREY, "That player is blocking Whispers !");
				GetPlayerName(playerid, sendername, sizeof(sendername));
				GetPlayerName(ID, giveplayer, sizeof(giveplayer));
				format(string, sizeof(string), "{FFFF00}%s ({ffffff}ID: %d{FFFF00}) whispers: {ffffff}%s", sendername, playerid, text);
				SendClientMessage(ID, COLOR_YELLOW, string);
				format(string, sizeof(string), "{FFFF00}PM sent to %s ({ffffff}ID: %d{FFFF00}):{ffffff} %s", giveplayer, ID, text);
				SendClientMessage(playerid, COLOR_YELLOW, string);
				
				format(string2, sizeof(string2), "%s sent whisper to %s: %s", sendername, giveplayer, params);
				SendHelperMessage(COLOR_GREEN, string2); // ti-am adaugat asta
				SendAdminMessage(COLOR_ORANGE, string2); // si asta
				return 1;
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GRAD1, "Invalid player !");
		}
	}
	return 1;
}
E bine acum, schimbi tu numele comenzii.
Multumesc mult CaRa. Sper sa apuc ziua sa iti intorc toate favorurile.
  • Like 1

Share this post


Link to post
Share on other sites

Salut! Exita la masini comanda /dl care iti arata pozitia si idu ei pe harta as dorii sa aflu si pozitia caracterului meu pe harta! Se poate?

Share this post


Link to post
Share on other sites

Salut! Exita la masini comanda /dl care iti arata pozitia si idu ei pe harta as dorii sa aflu si pozitia caracterului meu pe harta! Se poate?

 

http://wiki.sa-mp.com/wiki/GetPlayerPos

 

Poti sa iti faci o comanda proprie in care sa iti arate pozitia curenta printr-un textdraw,3dtext.

Share this post


Link to post
Share on other sites

Coordonatele le afli dand /save si intrant in My Doc >GTA files > SavedCoordonates'

Share this post


Link to post
Share on other sites

Salut. Am downloadat si eu un gamemode. Am incercat sa mai adaug case pe el, dar nu pot. Am folosit tot felul de sisteme de case, dar nu imi merg comenzile in joc. Ma puteti ajuta cu un tutorial de facut case pentru 0.3x? O seara buna.

Edited by deepfreez86
  • Like 2

Share this post


Link to post
Share on other sites

Salut. Am downloadat si eu un gamemode. Am incercat sa mai adaug case pe el, dar nu pot. Am folosit tot felul de sisteme de case, dar nu imi merg comenzile in joc. Ma puteti ajuta cu un tutorial de facut case pentru 0.3x? O seara buna.

Salutare . In primul rand trebuie sa ne dai un link catre GM ca sa stim despre ce e vorba . ( nu imi da mie prin pm , pune aici ) . 

O prima parere , ori ai vreun FS care foloseste alt sistem de comenzi decat GM-ul ,ori iti lipsesc ceva fisiere

Share this post


Link to post
Share on other sites

Salut , stie careva cum  pot sa bag in gm 

OnPlayerDisconect

ca nu o am in GM

Share this post


Link to post
Share on other sites

Salutare eG! Am o oarecare idee despre cum sa fac ce urmeaza sa va intreb insa am nevoie de o siguranta. :D

Deci, cum as putea schimba meniul de la /spec? Ce apare jos cand pui /spec adica. Si cum pot face ca atunci cand playerul 'specuit' intra intr-o masina sa apara pe meniul de jos de la /spec masina in care este ID-ul numele masinii si viteza cu care circula. Multumesc mult, o seara buna !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.