Jump to content
  • 0

Problemă comandă /ad


Gawitkkk

Question

Problema intalnita (descriere): Când folosesc comanda /ad nu îmi ia cat este setat biz fee-ul. Vreau ca atunci când public un ad să îmi ia fix cât este setat biz fee-ul.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu):

CMD:ad(playerid,params[])
{
if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(IsPlayerConnected(playerid))
    {
if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid,COLOR_WHITE,"{FFB870}Error: Command are inaccessible on foot.");
new string[264],sendername[25],idx;
        if(PlayerInfo[playerid][pMuted] == 1)
        {
format(string, sizeof(string), "You can not speak, you have been silenced for %d seconds.",PlayerInfo[playerid][pMuteTime]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
   if(PlayerInfo[playerid][pLevel] < 3) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You don't have level 3.");
        if(IsPlayerInRangeOfPoint(playerid,5.0,1111.33,-1796.93,16.5938) || IsPlayerInRangeOfPoint(playerid,5.0,2079.6287,2046.1179,11.0579))
        {
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(params);
while ((idx < length) && (params[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[264];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = params[idx];
idx++;
}
result[idx - offset] = EOS;
for(new s = 0; s < num_words; s++)
{
new pos;
while((pos = strfind(result,Swears,true)) != -1) for(new i = pos, j = pos + strlen(Swears); i < j; i++)
{
result = '*';
}
}
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_WHITE, "{B8DBFF}Synthax: /ad <Text>");
return 1;
}
 
new addd = -1, playeradd = 0;
for(new i = 0; i < sizeof(AdvMSG) && addd == -1; i++)
{
   if(strlen(AdvMSG) < 20) addd = i;
   if(strcmp(AdvPlayer,sendername,true) == 0 && strlen(AdvPlayer) == strlen(sendername)) playeradd = 1;
}
if(addd == -1) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}Advertisement list is full.");
if(playeradd == 1) return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You already placed an advertisement.");
 
new payout = idx * 150;
if(GetPlayerCash(playerid) < payout)
       {
           format(string, sizeof(string), "{FFB870}* You used %d characters which cost $%s, you don't have enough.", offset, FormatNumber(payout));
           SendClientMessage(playerid, COLOR_WHITE, string);
           return 1;
       }
GivePlayerCash(playerid, - payout);
format(AdvMSG[addd], 256, "{00D900}Ad placed by %s (Phone: {FFFFFF}%d{00D900}): %s",sendername,PlayerInfo[playerid][pPnumber],result);
format(AdvPlayer[addd], 24,"%s",sendername);
format(string, sizeof(string), "~r~Paid $%d~n~~w~Message contained: %d Characters", payout, idx);
GameTextForPlayer(playerid, string, 5000, 5);
SCM(playerid,COLOR_WHITE,"You ad will be showen in 30 seconds.");
if(IsPlayerInRangeOfPoint(playerid,5.0,1111.33,-1796.93,16.5938))
{
SBizzInfo[1][sbTill] += payout;
SBizzInfo[1][sbProducts]--;
SBUpdate(1,sbTillx);
SBUpdate(1,sbProductsx);
}
else if(IsPlayerInRangeOfPoint(playerid,5.0,2079.6287,2046.1179,11.0579))
{
SBizzInfo[32][sbTill] += payout;
SBizzInfo[32][sbProducts]--;
SBUpdate(32,sbTillx);
SBUpdate(32,sbProductsx);
}
}
else return SendClientMessage(playerid, COLOR_WHITE, "{FFB870}You are not near to an advertising agency.");
}
return 1;
}

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

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Momentan iti bani dupa formula asta:

new payout = idx * 150; // idx fiind numarul de caractere.

 

Daca vrei sa modifici in functie de numarul de caractere si ce fee e la biz, 

new payout = idx * SBizzInfo[32][sbFee]; // in loc de sbFee pui ce variabila folosesti la sbizz-uri la fee.

 

 

Daca vrei sa modifici sa-ti ia doar in functie de cat e la sbFee,

new payout = SBizzInfo[32][sbFee];

 

P.S. Sper ca ai inteles :)

Link to comment
Share on other sites

  • 0

Zi care varianta vrei sa o folosesti in gamemode sa-ti spun cum sa pui pentru fiecare bizz.

 

P.S. new payout = ...; il poti pune in acel if.. else

 

ex:

if(IsPlayerInRangeOfPoint(playerid,5.0,1111.33,-1796.93,16.5938))
{
new payout = idx * SBizzInfo[1][sbFee];
SBizzInfo[1][sbTill] += payout;
SBizzInfo[1][sbProducts]--;
SBUpdate(1,sbTillx);
SBUpdate(1,sbProductsx);
}
else if(IsPlayerInRangeOfPoint(playerid,5.0,2079.6287,2046.1179,11.0579))
{
new payout = idx * SBizzInfo[32][sbFee];
SBizzInfo[32][sbTill] += payout;
SBizzInfo[32][sbProducts]--;
SBUpdate(32,sbTillx);
SBUpdate(32,sbProductsx);
}
Edited by Punct.

Nu mai deschideti in pu*a mea servere de SA:MP !

Jucati-va pe cele care sunt !   Sunt suficiente !

Reguli de bun simt:

1. Nu faceti reclama unde nu trebuie !

2. Nu injurati ca la usa cortului !

3. Daca esti analfabeti, taci din gura !

4. Nu abuza de 'scuze', 'din greseala' !

 

My work ::: http://pastebin.com/VRNRcaAs

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.