Jump to content

Recommended Posts

Posted

pai ce e atat de greu so faci ?

sunt o gramada de tutoriale si gamemode cu asemenea comanda

 

FiveGame  Lands

Pawno Developer, Mapping , Scripter

Since 2016

Posted (edited)

Nu gasesti ? Faci singur.

Cum faci ? 

1.Inveti sa faci comenzi

2.Te gandesti ce ar trebui sa faca comanda, si cum ar trebui faca 

3.Incepi sa o scrii , linie cu linie.Gresesti, vezi unde e greseala , o repari si repeti pana iti iese.Greselile iti depasesc cunostiintele tale ? Nu-i nici o problema, aici nimeni nu e atotstiutor , ai o problema , lumea te ajuta(daca stii si cum sa ceri ajutor). Nu e sfarsitul lumi daca pui intrebi pentru a invata.

Asta e ce ar trebui sa faca multi, de ce? Programarea (scriptingu daca vrei) se invata exersand.Cum exersezi? Faci chestii, gresesti , repari greseala(repeti astea doua pana iti merge bine) , nimeni nu bate din palme si gata totu.

Edit:

CMD:givepp(playerid,params[])
{
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Nu esti admin!");//Aici schimbi tu cu variabila ta de a verifica adminul unui jucator(eu am pus direct pentru rcon)
	new id,pp;//Variabilele pe care le foloseste comanda
	if(sscanf(params,"ui",id,pp)) return SendClientMessage(playerid,-1,"Use: /givepp <ID/Name> <PP>")://Mesajul este afisat daca nu ai introdus nimic(ai scris numa /givepp) sau ai gresit un parametru
	if(!IsPlayerConnected(OtherPlayer) && OtherPlayer == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"Jucatorul nu este online!");//Verificam daca jcuatorul nu este online, pentru a nu creea anumite probleme
	PlayerData[id][PP] = pp;//Aici se adauga pp la datele jucatorului
	return 1;
}
CMD:giveallpp(playerid,params[])
{
	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Nu esti admin!");//La fel , se verifica daca jucatorulnu este admin(rcon in cazudefata)
	new pp;//Variabila pe care o foloseste comanda
	if(sscanf(params,"i",pp)) return SendClientMessage(playerid,-1,"Use: /giveallpp <PP>")://Mesajul este afisat daca nu ai introdus nimic(ai scris numa /givepp) sau ai gresit un parametru
	for(new i=0,j=GetPlayerPoolSize(); i<=j;i++)//Acesta este o iteratie (loop) care "strabate" toti jucatori conectati
	{
		if(!IsPlayerConnected(i)) continue;//Daca jucatorul nu este conectat(e posibil ca i sa ia un id de jcuator care nu este conectat, asa ca verficam sa nu ia si continuam iteratia)
		PlayerData[i][PP] = pp;//Aici se adauga pp la datele jucatorului
	}
	return 1;
}

Asta e cel mai simplu mod de a face comenzile, le refaci tu pentru gm-u tau , eu le-am facut la modul general

PS: Adaugi tu modul de salvare in baza de date

Edited by Banditul
  • 3 weeks later...
Posted

Poftim

CMD:giveallpp(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SCM(playerid, COLOR_ERROR, "Nu esti logat!");
    if(PlayerInfo[playerid][pAdmin] >= 7)
    {
        new moneyall,sendername[MAX_PLAYER_NAME],string[150];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params, "i",moneyall)) return SCM(playerid, 0xFFFFFFFF, "Tasteaza: /giveallpp <pp>");
        if(moneyall > 1000) return SCM(playerid, 0xF0F8FFFF, "Error: Too much pp.");
        else if(moneyall <= 1000)
        {
            format(string, sizeof(string),"{ba9789}Admin %s a oferit %s Premium Points tuturor jucatorilor online.[/shop]",sendername,FormatNumber(moneyall));
            SendClientMessageToAll(0xFFE4B5FF,string);
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                PlayerInfo[pPremiumPoints] += moneyall;
            }
        }
    }
    else
    {
         SCM(playerid, COLOR_SERVER, AdminOnly);
          return 1;
    }
    return 1;
}

 

 

CMD:givepp(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Nu esti logat.");
    if (PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid,COLOR_ERROR, AdminOnly);
    new id,premiump,admname[25],giveplayer[25];
    if(sscanf(params, "ud",id,premiump)) return SCM(playerid, COLOR_SERVER, "{A9C4E4}Folosire: {FFFFFF}/setpp <Name/Playerid> <Premium Points>");
    PlayerInfo[id][pPremiumPoints] += premiump;
    Update(id,pPremiumPointsx);
    GetPlayerName(playerid,admname,sizeof(admname));
    GetPlayerName(id,giveplayer,sizeof(giveplayer));
    new string[128],string2[128];
    format(string, sizeof(string), "Admin %s has set your Premium Points to %d.", admname, PlayerInfo[id][pPremiumPoints]);
    SendClientMessage(id, COLOR_LIGHTBLUE, string);
    format(string2, sizeof(string2), "You set %s Premium Points to %d.", giveplayer, PlayerInfo[id][pPremiumPoints]);
    SendClientMessage(playerid, COLOR_ERROR, string2);
    new sqlupdate[1000];
    mysql_format(SQL, sqlupdate, sizeof(sqlupdate), "UPDATE `users` SET PPReff=PPReff+%d WHERE `id`='%d'",premiump/10,PlayerInfo[id][pReferral]);
    mysql_tquery(SQL, sqlupdate, "", "");
    return 1;
}

retired

  • 3 years later...
Posted
La 01.04.2017 la 22:31, DanielAdv a spus:

Poftim

CMD:giveallpp(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SCM(playerid, COLOR_ERROR, "Nu esti logat!");
    if(PlayerInfo[playerid][pAdmin] >= 7)
    {
        new moneyall,sendername[MAX_PLAYER_NAME],string[150];
        GetPlayerName(playerid, sendername, sizeof(sendername));
        if(sscanf(params, "i",moneyall)) return SCM(playerid, 0xFFFFFFFF, "Tasteaza: /giveallpp <pp>");
        if(moneyall > 1000) return SCM(playerid, 0xF0F8FFFF, "Error: Too much pp.");
        else if(moneyall <= 1000)
        {
            format(string, sizeof(string),"{ba9789}Admin %s a oferit %s Premium Points tuturor jucatorilor online.[/shop]",sendername,FormatNumber(moneyall));
            SendClientMessageToAll(0xFFE4B5FF,string);
            for(new i = 0; i < MAX_PLAYERS; i++)
            {
                PlayerInfo[pPremiumPoints] += moneyall;
            }
        }
    }
    else
    {
         SCM(playerid, COLOR_SERVER, AdminOnly);
          return 1;
    }
    return 1;
}

 

 

CMD:givepp(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_ERROR, "Nu esti logat.");
    if (PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid,COLOR_ERROR, AdminOnly);
    new id,premiump,admname[25],giveplayer[25];
    if(sscanf(params, "ud",id,premiump)) return SCM(playerid, COLOR_SERVER, "{A9C4E4}Folosire: {FFFFFF}/setpp <Name/Playerid> <Premium Points>");
    PlayerInfo[id][pPremiumPoints] += premiump;
    Update(id,pPremiumPointsx);
    GetPlayerName(playerid,admname,sizeof(admname));
    GetPlayerName(id,giveplayer,sizeof(giveplayer));
    new string[128],string2[128];
    format(string, sizeof(string), "Admin %s has set your Premium Points to %d.", admname, PlayerInfo[id][pPremiumPoints]);
    SendClientMessage(id, COLOR_LIGHTBLUE, string);
    format(string2, sizeof(string2), "You set %s Premium Points to %d.", giveplayer, PlayerInfo[id][pPremiumPoints]);
    SendClientMessage(playerid, COLOR_ERROR, string2);
    new sqlupdate[1000];
    mysql_format(SQL, sqlupdate, sizeof(sqlupdate), "UPDATE `users` SET PPReff=PPReff+%d WHERE `id`='%d'",premiump/10,PlayerInfo[id][pReferral]);
    mysql_tquery(SQL, sqlupdate, "", "");
    return 1;
}

C:\Users\olimp\Desktop\New folder (3)\gamemodes\NewServer.pwn(138) : warning 203: symbol is never used: "giveallpp"
C:\Users\olimp\Desktop\New folder (3)\gamemodes\NewServer.pwn(138) : warning 203: symbol is never used: "givepp"
Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


2 Warnings.

 

cum le rezolv?

 

🔥Daca ii dai cuiva a doua sansa, e ca si cum i-ai oferi un glont la pistol ca sa te nimereasca.🔥

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
×
×
  • 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.