[Pomoc] Komanda /ticket

Započeo milan_95, Februar 20, 2012, 14:15:03 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: BN
Detaljan opis problema:Kada kucam /ticket izbaci mi nisi policajac a ja lider policije :)....i isto tako kad uzmem FBI ili SWAT kad kucam /ticket pise niste policajac
Dio skripte: CMD:ticket(playerid, params[])
{
new string[128];
new idx;

new  sendername[MAX_PLAYER_NAME];
new  giveplayer[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        if(gTeam[playerid] != 2)
{
    SendClientMessage(playerid, COLOR_GREY, "   Nisi policajac!");
    return 1;
}
        if(OnDuty[playerid] != 1)
{
    SendClientMessage(playerid, COLOR_GREY, "   Nisi na duznosti!");
    return 1;
}
    temp = strtok(params, idx);
if(!strlen(temp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{168BFF}INFO: {959561} /ticket {959561}[ID/DioImena] {838361} [cijena] [razlog]");
return 1;
}
giveplayerid = ReturnUser(temp);
            temp = strtok(params, idx);
if(!strlen(temp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{168BFF}INFO: {959561} /ticket {959561}[ID/DioImena] {838361} [cijena] [razlog]");
return 1;
}
moneys = strval(temp);
if(moneys < 1 || moneys > 500) { SendClientMessage(playerid, COLOR_GREY, "   Cijena kazne ne smije biti ispod 1$ i preko 500$ !"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
    if(giveplayerid != INVALID_PLAYER_ID)
    {
        if (ProxDetectorS(8.0, playerid, giveplayerid))
{
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(params);
while ((idx < length) && (params[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = params[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "{168BFF}INFO: {959561} /ticket {959561}[ID/DioImena] {838361} [cijena] [razlog]");
return 1;
}
format(string, sizeof(string), "* Dao si %s kaznu u iznosu od $%d, razlog: %s", giveplayer, moneys, (result));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Policajac %s ti je pripisao kaznu u iznosu u $%d, razlog: %s", sendername, moneys, (result));
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Koristi /prihvati ticket da platis.");
TicketOffer[giveplayerid] = playerid;
TicketMoney[giveplayerid] = moneys;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "   Taj igrac nije blizu tebe! !");
return 1;
}
}
}
else
{
    SendClientMessage(playerid, COLOR_GREY, "   Taj igrac nije online!");
    return 1;
}
}
return 1;
}

Neke slike/video za lakse dobivanje pomoci(neobavezno):
OTISAO SAM SA FORUMA!!!

zb  -samp .com

stavi pored :
if(OnDuty[playerid] != 1)
ovo :
&& PlayerInfo[playerid][pMember] == 1)
i onda ispadne ovako taj dio :
if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
{

ili ti evoj moj /ticket
moj je strcmp ali je u principu isto:
if(strcmp(cmd, "/ticket", true) == 0 || strcmp(cmd, "/kazna", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gTeam[playerid] != 2)
{
    SendClientMessage(playerid, COLOR_GREY, "   Niste policajac!");
    return 1;
}
        if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
{
    SendClientMessage(playerid, COLOR_GREY, "   Niste na Duznosti!");
    return 1;
}
    tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /kazna [ID Igraca/Dio Imena] [cijena] [razlog]");
return 1;
}
giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /ticket [ID Igraca/Dio Imena] [cijena] [razlog]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 2001) { SendClientMessage(playerid, COLOR_GREY, "   Cijena kazne ne moze biti ispod 1 ni preko 2000 !"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
    if(giveplayerid != INVALID_PLAYER_ID)
    {
        if (ProxDetectorS(8.0, playerid, giveplayerid))
{
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koriscenje: /ticket [ID Igraca/Dio Imena] [cijena] [razlog]");
return 1;
}
if (GetPlayerMoney(giveplayerid) < moneys)
{
SendClientMessage(playerid, COLOR_WHITE, "* Taj igrac nema dovoljno novca da plati kaznu.");
return 1;
}
format(string, sizeof(string), "* Napisali ste %s-u kaznu od $%d, razlog: %s", giveplayer, moneys, (result));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Policajac %s vam je napisao kaznu od $%d, razlog: %s", sendername, moneys, (result));
SendClientMessage(giveplayerid, COLOR_WHITE, string);
SendClientMessage(giveplayerid, COLOR_WHITE, "* Kucajte /prihvati ticket, da je prihvatite.");
SendClientMessage(giveplayerid, COLOR_WHITE, "* Ako ne prihvatite kaznu, ici cete u zatvor!");
TicketOffer[giveplayerid] = playerid;
TicketMoney[giveplayerid] = moneys;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "   Taj igrac nije blizu vas !");
return 1;
}
}
}
else
{
    SendClientMessage(playerid, COLOR_GREY, "   Igrac je offline !");
    return 1;
}
}
return 1;
}

Tebi je valjda uradjeno da moras na duty da bi dao tickete samo izmenis da ne mora ;)

Citat: Blaeks poslato Februar 20, 2012, 15:58:31 POSLE PODNE
Tebi je valjda uradjeno da moras na duty da bi dao tickete samo izmenis da ne mora ;)

Uradjeno je da moram da budem na duty da dajem tickete, tako i treba da bude.....Nego i kad sam na duty i kucam /ticket pise Nisi policajac!
OTISAO SAM SA FORUMA!!!

zb  -samp .com

onda stavi tamo IsACop da proverava dali je igrac PD

Makn i te se sa GF-a ...
a problem ti je do ovoga pogledaj da li je dobar id itd...
        if(gTeam[playerid] != 2)
{
    SendClientMessage(playerid, COLOR_GREY, "   Nisi policajac!");
    return 1;
}

Quilound_Williams

probaj stavit ovaj code }
if(strcmp(cmd, "/ticket", true) == 0 || strcmp(cmd, "/kazna", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gTeam[playerid] != 2)
{
    SendClientMessage(playerid, COLOR_GREY, "   Niste policajac!");
    return 1;
}
        if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
{
    SendClientMessage(playerid, COLOR_GREY, "   Niste na Duznosti!");
    return 1;
}
    tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristi: /kazna [ID Igraca/Deo Imena] [Cena] [razlog]");
return 1;
}
giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristi: /ticket [ID Igraca/Deo Imena] [Cena] [razlog]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 2001) { SendClientMessage(playerid, COLOR_GREY, "   Cena kazne ne moze biti ispod 1 ni preko 2000 !"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
    if(giveplayerid != INVALID_PLAYER_ID)
    {
        if (ProxDetectorS(8.0, playerid, giveplayerid))
{
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristi: /ticket [ID Igraca/Deo Imena] [Cena] [razlog]");
return 1;
}
if (GetPlayerMoney(giveplayerid) < moneys)
{
SendClientMessage(playerid, COLOR_WHITE, "* Taj igrac nema dovoljno novca da plati kaznu.");
return 1;
}
format(string, sizeof(string), "* Napisali ste %s-u kaznu od $%d, razlog: %s", giveplayer, moneys, (result));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Policajac %s vam je napisao kaznu od $%d, razlog: %s", sendername, moneys, (result));
SendClientMessage(giveplayerid, COLOR_WHITE, string);
SendClientMessage(giveplayerid, COLOR_WHITE, "* Kucajte /prihvati ticket, da je prihvatite.");
SendClientMessage(giveplayerid, COLOR_WHITE, "* Ako ne prihvatite kaznu, ici cete u zatvor!");
TicketOffer[giveplayerid] = playerid;
TicketMoney[giveplayerid] = moneys;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "   Taj igrac nije blizu vas !");
return 1;
}
}
}
else{
    SendClientMessage(playerid, COLOR_GREY, "   Igrac je offline !");
    return 1;
}
}
return 1;
}

Probaj tako ;)

CMD:ticket(playerid, params[])
{
new string[128];
new idx;

new  sendername[MAX_PLAYER_NAME];
new  giveplayer[MAX_PLAYER_NAME];
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][pMember] == 1||PlayerInfo[playerid][pLeader] == 1)
{
    SendClientMessage(playerid, COLOR_GREY, "   Nisi policajac!");
    return 1;
}
        if(OnDuty[playerid] != 1)
{
    SendClientMessage(playerid, COLOR_GREY, "   Nisi na duznosti!");
    return 1;
}
    temp = strtok(params, idx);
if(!strlen(temp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{168BFF}INFO: {959561} /ticket {959561}[ID/DioImena] {838361} [cijena] [razlog]");
return 1;
}
giveplayerid = ReturnUser(temp);
            temp = strtok(params, idx);
if(!strlen(temp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{168BFF}INFO: {959561} /ticket {959561}[ID/DioImena] {838361} [cijena] [razlog]");
return 1;
}
moneys = strval(temp);
if(moneys < 1 || moneys > 500) { SendClientMessage(playerid, COLOR_GREY, "   Cijena kazne ne smije biti ispod 1$ i preko 500$ !"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
    if(giveplayerid != INVALID_PLAYER_ID)
    {
        if (ProxDetectorS(8.0, playerid, giveplayerid))
{
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(params);
while ((idx < length) && (params[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = params[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "{168BFF}INFO: {959561} /ticket {959561}[ID/DioImena] {838361} [cijena] [razlog]");
return 1;
}
format(string, sizeof(string), "* Dao si %s kaznu u iznosu od $%d, razlog: %s", giveplayer, moneys, (result));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* Policajac %s ti je pripisao kaznu u iznosu u $%d, razlog: %s", sendername, moneys, (result));
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Koristi /prihvati ticket da platis.");
TicketOffer[giveplayerid] = playerid;
TicketMoney[giveplayerid] = moneys;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "   Taj igrac nije blizu tebe! !");
return 1;
}
}
}
else
{
    SendClientMessage(playerid, COLOR_GREY, "   Taj igrac nije online!");
    return 1;
}
}
return 1;
}

Citat: Quilound_Williams poslato Februar 20, 2012, 19:16:12 POSLE PODNE
probaj stavit ovaj code }
if(strcmp(cmd, "/ticket", true) == 0 || strcmp(cmd, "/kazna", true) == 0)
{
    if(IsPlayerConnected(playerid))
    {
        if(gTeam[playerid] != 2)
{
    SendClientMessage(playerid, COLOR_GREY, "   Niste policajac!");
    return 1;
}
        if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
{
    SendClientMessage(playerid, COLOR_GREY, "   Niste na Duznosti!");
    return 1;
}
    tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristi: /kazna [ID Igraca/Deo Imena] [Cena] [razlog]");
return 1;
}
giveplayerid = ReturnUser(tmp);
            tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristi: /ticket [ID Igraca/Deo Imena] [Cena] [razlog]");
return 1;
}
moneys = strval(tmp);
if(moneys < 1 || moneys > 2001) { SendClientMessage(playerid, COLOR_GREY, "   Cena kazne ne moze biti ispod 1 ni preko 2000 !"); return 1; }
if(IsPlayerConnected(giveplayerid))
{
    if(giveplayerid != INVALID_PLAYER_ID)
    {
        if (ProxDetectorS(8.0, playerid, giveplayerid))
{
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Koristi: /ticket [ID Igraca/Deo Imena] [Cena] [razlog]");
return 1;
}
if (GetPlayerMoney(giveplayerid) < moneys)
{
SendClientMessage(playerid, COLOR_WHITE, "* Taj igrac nema dovoljno novca da plati kaznu.");
return 1;
}
format(string, sizeof(string), "* Napisali ste %s-u kaznu od $%d, razlog: %s", giveplayer, moneys, (result));
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "* Policajac %s vam je napisao kaznu od $%d, razlog: %s", sendername, moneys, (result));
SendClientMessage(giveplayerid, COLOR_WHITE, string);
SendClientMessage(giveplayerid, COLOR_WHITE, "* Kucajte /prihvati ticket, da je prihvatite.");
SendClientMessage(giveplayerid, COLOR_WHITE, "* Ako ne prihvatite kaznu, ici cete u zatvor!");
TicketOffer[giveplayerid] = playerid;
TicketMoney[giveplayerid] = moneys;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, "   Taj igrac nije blizu vas !");
return 1;
}
}
}
else{
    SendClientMessage(playerid, COLOR_GREY, "   Igrac je offline !");
    return 1;
}
}
return 1;
}

nmg to probati jer je to strcmp.....na ovom GM se koristi CMD :)
Frank probacu, u svakom slucaju hvala svima ;)
OTISAO SAM SA FORUMA!!!

zb  -samp .com

uradi ovako:


if(gTeam[playerid] != 2 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2)
{
    SendClientMessage(playerid, COLOR_GREY, "   Nisi policajac!");
    return 1;
}


Ili umesto toga mozes koristiti


if(PlayerInfo[playerid][pMember == 1 || PlayerInfo[playerid][pMember] == 2)
{
    SendClientMessage(playerid, COLOR_GREY, "   Nisi policajac!");
    return 1;
}

Napravio sam, hvala svima :)....Sto se mene tice moze LOCK!! :)
OTISAO SAM SA FORUMA!!!

zb  -samp .com