Jump to content

Question

12 answers to this question

Recommended Posts

  • 0
Posted (edited)

Da comanda.

EDIT: Partea cu codul din care rezulta textul ala cu acelasi nume.

Edited by andy47
  • 0
Posted

    GetPlayerName(id, giveplayer, sizeof(giveplayer));

    format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de zbor.",sendername,giveplayer);
    SendFactionMessage(12,COLOR_WHITE,string);

  • 0
Posted

As presupune mai degraba o problema la sscanf din cadrul comenzi pentru ca nu preia bine id-u(asta daca nu altceva alterneaza acea variabila id pe drum)

  • 0
Posted (edited)

CMD:givelicense(playerid, params[])
{
    if(!IsAInstructor(playerid)) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu esti instructor.");
    new x_nr[30],id,sendername[30],giveplayer[30],string[128];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(id, giveplayer, sizeof(giveplayer));
    if(sscanf(params, "s[50]u",x_nr,id))
    {
           SendClientMessage(playerid, COLOR_GREY, "Sintaxa: {FFFFFF}/givelicense <License name> <playerid/name>");
           SendClientMessage(playerid, COLOR_WHITE, "License: Sailing, Fishing, Weapon, Flying.");

           return 1;
    }
    if(IsInBlacklist(id, 12)) return SCM(playerid, COLOR_LGREEN, "Eroare: Acel player este pe blacklistul factiunii tale.");
    if(IsInBlacklist(id, 19)) return SCM(playerid, COLOR_LGREEN, "Eroare: Acel player este pe blacklistul factiunii tale.");
    if(id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_LGREEN, "Eroare: Acel player nu este conectat.");
    if(strcmp(x_nr,"flying",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
        format(string, sizeof(string), "I-ai dat licenta de zbor de %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta de zbor.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de zbor.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
           SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pFlyLic] = 1;
        PlayerInfo[id][pFlyLicT] = 100;
        Update(id, pFlyLicx);
        Update(id, pFlyLicTx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
    }
    if(strcmp(x_nr,"sailing",true) == 0)    
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
        format(string, sizeof(string), "I-ai dat licenta de navigatie lui %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta de navigatie.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de navigatie.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pBoatLic] = 1;
        PlayerInfo[id][pBoatLicT] = 100;
        Update(id, pBoatLicx);
        Update(id, pBoatLicTx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
    }
    if(strcmp(x_nr,"fishing",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
        format(string, sizeof(string), "I-ai dat licenta de pescar lui %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta de pescar.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de pescar.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pFishLic] = 1;
        PlayerInfo[id][pFishLicT] = 100;
        Update(id, pFishLicx);
        Update(id, pFishLicTx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
    }
    if(strcmp(x_nr,"weapon",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
        format(string, sizeof(string), "I-ai dat licenta de arme lui %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta arme.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de arme.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pGunLic] = 1;
        PlayerInfo[id][pGunLicT] = 100;
        Update(id, pGunLicTx);
        Update(id, pGunLicx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
    }
    return 1;
}

Edited by RusKo69
  • 0
Posted
CMD:givelicense(playerid, params[])
{
    if(!IsAInstructor(playerid)) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu esti instructor.");
    new x_nr[30],id,sendername[30],giveplayer[30],string[128];
    if(sscanf(params, "s[30]u",x_nr,id))
    {
           SendClientMessage(playerid, COLOR_GREY, "Sintaxa: {FFFFFF}/givelicense <License name> <playerid/name>");
           SendClientMessage(playerid, COLOR_WHITE, "License: Sailing, Fishing, Weapon, Flying.");

           return 1;
    }
    if(IsInBlacklist(id, 12)) return SCM(playerid, COLOR_LGREEN, "Eroare: Acel player este pe blacklistul factiunii tale.");
    if(IsInBlacklist(id, 19)) return SCM(playerid, COLOR_LGREEN, "Eroare: Acel player este pe blacklistul factiunii tale.");
    if(id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_LGREEN, "Eroare: Acel player nu este conectat.");
    if(strcmp(x_nr,"flying",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
	    GetPlayerName(playerid, sendername, sizeof(sendername));
	    GetPlayerName(id, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "I-ai dat licenta de zbor de %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta de zbor.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de zbor.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pFlyLic] = 1;
        PlayerInfo[id][pFlyLicT] = 100;
        Update(id, pFlyLicx);
        Update(id, pFlyLicTx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
		return 1;
    }
    else if(strcmp(x_nr,"sailing",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
        GetPlayerName(playerid, sendername, sizeof(sendername));
		GetPlayerName(id, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "I-ai dat licenta de navigatie lui %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta de navigatie.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de navigatie.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pBoatLic] = 1;
        PlayerInfo[id][pBoatLicT] = 100;
        Update(id, pBoatLicx);
        Update(id, pBoatLicTx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
        return 1;
    }
    else if(strcmp(x_nr,"fishing",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
	    GetPlayerName(playerid, sendername, sizeof(sendername));
	    GetPlayerName(id, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "I-ai dat licenta de pescar lui %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta de pescar.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de pescar.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pFishLic] = 1;
        PlayerInfo[id][pFishLicT] = 100;
        Update(id, pFishLicx);
        Update(id, pFishLicTx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
        return 1;
    }
    else if(strcmp(x_nr,"weapon",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
	    GetPlayerName(playerid, sendername, sizeof(sendername));
	    GetPlayerName(id, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "I-ai dat licenta de arme lui %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta arme.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de arme.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pGunLic] = 1;
        PlayerInfo[id][pGunLicT] = 100;
        Update(id, pGunLicTx);
        Update(id, pGunLicx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
        return 1;
    }
    return 1;
}

 

  • 0
Posted
14 hours ago, andy47 said:

CMD:givelicense(playerid, params[])
{
    if(!IsAInstructor(playerid)) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu esti instructor.");
    new x_nr[30],id,sendername[30],giveplayer[30],string[128];
    if(sscanf(params, "s[30]u",x_nr,id))
    {
           SendClientMessage(playerid, COLOR_GREY, "Sintaxa: {FFFFFF}/givelicense <License name> <playerid/name>");
           SendClientMessage(playerid, COLOR_WHITE, "License: Sailing, Fishing, Weapon, Flying.");

           return 1;
    }
    if(IsInBlacklist(id, 12)) return SCM(playerid, COLOR_LGREEN, "Eroare: Acel player este pe blacklistul factiunii tale.");
    if(IsInBlacklist(id, 19)) return SCM(playerid, COLOR_LGREEN, "Eroare: Acel player este pe blacklistul factiunii tale.");
    if(id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_LGREEN, "Eroare: Acel player nu este conectat.");
    if(strcmp(x_nr,"flying",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
	    GetPlayerName(playerid, sendername, sizeof(sendername));
	    GetPlayerName(id, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "I-ai dat licenta de zbor de %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta de zbor.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de zbor.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pFlyLic] = 1;
        PlayerInfo[id][pFlyLicT] = 100;
        Update(id, pFlyLicx);
        Update(id, pFlyLicTx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
		return 1;
    }
    else if(strcmp(x_nr,"sailing",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
        GetPlayerName(playerid, sendername, sizeof(sendername));
		GetPlayerName(id, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "I-ai dat licenta de navigatie lui %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta de navigatie.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de navigatie.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pBoatLic] = 1;
        PlayerInfo[id][pBoatLicT] = 100;
        Update(id, pBoatLicx);
        Update(id, pBoatLicTx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
        return 1;
    }
    else if(strcmp(x_nr,"fishing",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
	    GetPlayerName(playerid, sendername, sizeof(sendername));
	    GetPlayerName(id, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "I-ai dat licenta de pescar lui %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta de pescar.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de pescar.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pFishLic] = 1;
        PlayerInfo[id][pFishLicT] = 100;
        Update(id, pFishLicx);
        Update(id, pFishLicTx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
        return 1;
    }
    else if(strcmp(x_nr,"weapon",true) == 0)
    {
        PlayerInfo[playerid][pCommands] ++;
        Update(playerid, pCommandsx);
	    GetPlayerName(playerid, sendername, sizeof(sendername));
	    GetPlayerName(id, giveplayer, sizeof(giveplayer));
        format(string, sizeof(string), "I-ai dat licenta de arme lui %s.",giveplayer);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "Instructor %s ti-a dat licenta arme.",sendername);
        SendClientMessage(id, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "{008080}(School Instructors Dispatch){FFFFFF} %s i-a acordat lui %s licenta de arme.",sendername,giveplayer);
        SendFactionMessage(12,COLOR_WHITE,string);
        SendFactionMessage(19, COLOR_WHITE, string);
        PlayerInfo[id][pGunLic] = 1;
        PlayerInfo[id][pGunLicT] = 100;
        Update(id, pGunLicTx);
        Update(id, pGunLicx);
        format(string, sizeof(string), "{008080}(Raport Status){FFFFFF} +1 raport point, total raport points: %d.", PlayerInfo[playerid][pCommands]);
        SCM(playerid, COLOR_WHITE, string);
        return 1;
    }
    return 1;
}

 

Rezolvat, mersi!

  • 0
Posted

Pentru a nu te repeta de fiecare data cu functia de preluare a numele GetPlayerName, ai putea crea o functie pentru asta. 

stock GetName (playerid)

new a [MAX_PLAYER_NAME];

GetPlayerName (playerid, a, sizeof (a));

return a;

}

Si o folosesti gen:

new str [ 128 ];

format (str, sizeof str, "Numele meu este: %s", GetName (playerid));

Sau 

if (sscanf (params,"u",id)) return Bla Bla

format (str,sizeof str, " numele meu este %s, numele lui este %s", GetName (playerid), GetName (id));

Scriu de pe telefon, sper ca ai inteles ideea.

  • 0
Posted
19 minutes ago, andy47 said:

Pentru a nu te repeta de fiecare data cu functia de preluare a numele GetPlayerName, ai putea crea o functie pentru asta. 

stock GetName (playerid)

new a [MAX_PLAYER_NAME];

GetPlayerName (playerid, a, sizeof (a));

return a;

}

Si o folosesti gen:

new str [ 128 ];

format (str, sizeof str, "Numele meu este: %s", GetName (playerid));

Sau 

if (sscanf (params,"u",id)) return Bla Bla

format (str,sizeof str, " numele meu este %s, numele lui este %s", GetName (playerid), GetName (id));

Scriu de pe telefon, sper ca ai inteles ideea.

Da am inteles, am dar mna, asa am luat GM si acum incep sa l editez

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.