Zaključano

[Pomoc] Kako da napravim komandu /call u dialogu?

pre 11 godina
333
pregleda
8
postova
Ova tema je zaključana. Samo moderatori i administratori mogu odgovarati.
Snoopy.amx
Wheel Man
pre 11 godina
Skripta koju koristim: NGRP
Detaljan opis problema: Kako da napravim komandu /call u dialogu, da ne moram npr upisati /call BROJ nego kada upišem /call izbaci mi dialog input i tu upisem broj i onda pozove?
Dio skripte: Evo komanda /call

CMD:call(playerid, params[])
{
new string, phonenumb;

if(sscanf(params, "d", phonenumb)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /call ");

if (PlayerInfo > 0)
{
SendClientMessageEx(playerid,COLOR_GREY,"Policija ti je privremeno oduzela telefon!.");
return 1;
}
if(PlayerTied != 0 || PlayerCuffed != 0)
{
SendClientMessageEx(playerid,COLOR_GREY,"Ruke su ti zavezane, mobitel ne mozes da koristis!.");
return 1;
}
if(PlayerInfo == 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Ti nemaš telefona!.");
return 1;
}
if(PhoneOnline > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "Mobitel ti je iskljucen!.");
return 1;
}
format(string, sizeof(string), "* %s vadi mobitel iz dzepa.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(phonenumb == 911)
{
if(PlayerInfo == 4 || PlayerInfo == 1000)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Nemozes koristit ovo kada si u admin zatvoru!");
return 1;
}
SendClientMessageEx(playerid, COLOR_WHITE, "[BD:RP]: Koristi T da pricas, da prekines upisi /hangup.");
SendClientMessageEx(playerid, COLOR_ALLDEPT, "HITAN SLUCAJ: Koga zelite nazvati, police ili paramedic?");
Mobile = 911;
return 1;
}
if(phonenumb == PlayerInfo)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "  Zauzeto...");
return 1;
}
if(Mobile != INVALID_PLAYER_ID)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "  Ti vec obavljas poziv...");
return 1;
}
foreach(Player, i)
{
if(PlayerInfo == phonenumb && phonenumb != 0)
{
new giveplayerid = i;
Mobile = giveplayerid; //caller connecting
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PhoneOnline > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "Birani pretplatnik je iskljucio svoj mobitel.");
Mobile = INVALID_PLAYER_ID;
return 1;
}
if(Mobile != INVALID_PLAYER_ID)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Zauzeto...");
Mobile = INVALID_PLAYER_ID;
return 1;
}
if(Spectating!=0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Zauzeto...");
Mobile = INVALID_PLAYER_ID;
return 1;
}
if (Mobile == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "Tvoj mobitel zvoni - upisi /p da se javis. [Pozivaoc: %s]", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_YELLOW, string);
RingTone = 10;
format(string, sizeof(string), "* %s's telefon pocinje zvoniti.", GetPlayerNameEx(i));
SendClientMessageEx(playerid, COLOR_WHITE, "[BD:RP]: Koristi T da pricas, da prekines upisi /hangup.");
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new Float:rX, Float:rY, Float:rZ;
GetPlayerPos(giveplayerid, rX, rY, rZ);
  SendAudioToRange(6802, 100, 0, rX, rY, rZ, 30.0);
    SendAudioToPlayer(playerid, 6148, 100, 0);
CellTime = 1;
return SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
}
}
}
}
}
SendClientMessageEx(playerid, COLOR_GRAD2, "Tvoj poziv NE MOZE biti obavljen, provjerite broj i pokusajte ponovo...");
return 1;
}



Neke slike/video za lakse dobivanje pomoci(neobavezno): //
ermin.a
Underboss
pre 11 godina
#define DIALOG_CALL 12151 //lupam, i ne moras definisat ali da ne bi kasnije pomijesao

CMD:call(playerid, params[])
{
if(PlayerInfo != 0) ShowPlayerDialog(playerid, DIALOG_CALL, DIALOG_STYLE_INPUT, "Pozivanje..", "Unesite broj:", "Poziv", "Odustani");
else SendClientMessage(playerid, COLOR_GREY, "Ti nemaš telefona!.");
return 1;
}

// Pod ondialogresponse
if(dialogid == DIALOG_CALL)
{
new string, phonenumb;

if(sscanf(inputtext, "d", phonenumb)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /call ");

if (PlayerInfo > 0)
{
SendClientMessageEx(playerid,COLOR_GREY,"Policija ti je privremeno oduzela telefon!.");
return 1;
}
if(PlayerTied != 0 || PlayerCuffed != 0)
{
SendClientMessageEx(playerid,COLOR_GREY,"Ruke su ti zavezane, mobitel ne mozes da koristis!.");
return 1;
}
if(PlayerInfo == 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Ti nemaš telefona!.");
return 1;
}
if(PhoneOnline > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "Mobitel ti je iskljucen!.");
return 1;
}
format(string, sizeof(string), "* %s vadi mobitel iz dzepa.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
if(phonenumb == 911)
{
if(PlayerInfo == 4 || PlayerInfo == 1000)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Nemozes koristit ovo kada si u admin zatvoru!");
return 1;
}
SendClientMessageEx(playerid, COLOR_WHITE, "[BD:RP]: Koristi T da pricas, da prekines upisi /hangup.");
SendClientMessageEx(playerid, COLOR_ALLDEPT, "HITAN SLUCAJ: Koga zelite nazvati, police ili paramedic?");
Mobile = 911;
return 1;
}
if(phonenumb == PlayerInfo)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "  Zauzeto...");
return 1;
}
if(Mobile != INVALID_PLAYER_ID)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "  Ti vec obavljas poziv...");
return 1;
}
foreach(Player, i)
{
if(PlayerInfo == phonenumb && phonenumb != 0)
{
new giveplayerid = i;
Mobile = giveplayerid; //caller connecting
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(PhoneOnline > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "Birani pretplatnik je iskljucio svoj mobitel.");
Mobile = INVALID_PLAYER_ID;
return 1;
}
if(Mobile != INVALID_PLAYER_ID)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Zauzeto...");
Mobile = INVALID_PLAYER_ID;
return 1;
}
if(Spectating!=0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Zauzeto...");
Mobile = INVALID_PLAYER_ID;
return 1;
}
if (Mobile == INVALID_PLAYER_ID)
{
format(string, sizeof(string), "Tvoj mobitel zvoni - upisi /p da se javis. [Pozivaoc: %s]", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_YELLOW, string);
RingTone = 10;
format(string, sizeof(string), "* %s's telefon pocinje zvoniti.", GetPlayerNameEx(i));
SendClientMessageEx(playerid, COLOR_WHITE, "[BD:RP]: Koristi T da pricas, da prekines upisi /hangup.");
ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new Float:rX, Float:rY, Float:rZ;
GetPlayerPos(giveplayerid, rX, rY, rZ);
  SendAudioToRange(6802, 100, 0, rX, rY, rZ, 30.0);
    SendAudioToPlayer(playerid, 6148, 100, 0);
CellTime = 1;
return SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USECELLPHONE);
}
}
}
}
}
SendClientMessageEx(playerid, COLOR_GRAD2, "Tvoj poziv NE MOZE biti obavljen, provjerite broj i pokusajte ponovo...");
return 1;
}
Snoopy.amx
Wheel Man
pre 11 godina
Hvala brate radii, mozes li mi samo napraviti jos komandu /number tj. da saznam broj od nekog igrača u dialogu tj. /number ID igrača
evo komanda

CMD:number(playerid, params[]) {
if(PlayerInfo == 1) {

new
iTarget;

if(sscanf(params, "u", iTarget)) {
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /number ");
}
else if(IsPlayerConnected(iTarget)) {
new
szNumber[16 + MAX_PLAYER_NAME];

format(szNumber, sizeof(szNumber), "* %s (%i)", GetPlayerNameEx(iTarget), PlayerInfo);
SendClientMessageEx(playerid, COLOR_GRAD1, szNumber);
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Netacan ID igrača.");
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Nemate Imenik!.");
return 1;
}


EDIT: Treba mi kada igrač upiše sms, da mu izbaci dialog da upiše broj pa kada upiše broj da mu izbaci dialog u kojem upiše text, mozes li mi i to napraviti?
evo cmd /sms

CMD:sms(playerid, params[])
{
if(gPlayerLogged{playerid} == 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "  MoraÅ¡ biti ULOGOVAN!");
return 1;
}
if(GetPVarInt(playerid, "Injured") != 0||GetPVarInt(playerid, "Hospital")!=0)
{
SendClientMessageEx (playerid, COLOR_GRAD2, "Ne mozes koristiti to sada.");
return 1;
}
if(PlayerTied != 0 || PlayerCuffed != 0)
{
SendClientMessageEx(playerid,COLOR_GREY,"Ruke su ti zavezane, ne mozes koristiti mobitel!.");
return 1;
}

new string, phonenumb, text;
if(sscanf(params, "ds", phonenumb, text)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: (/t)ext [text chat]");

if(PlayerInfo == 0)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "  Ti nemas mobitel..");
return 1;
}
if (PlayerInfo > 0)
{
SendClientMessageEx(playerid,COLOR_GREY,"  Policija ti je privremeno oduzela mobitel!");
return 1;
}
if(PhoneOnline > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "Mobitel ti je iskljucen!.");
return 1;
}

if(Spectating==0)
{
format(string, sizeof(string), "* %s vadi mobitel iz dzepa.", GetPlayerNameEx(playerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}

if(phonenumb == 555)
{
if ((strcmp("yes", text, true, strlen(text)) == 0) && (strlen(text) == strlen("yes")))
{
SendClientMessageEx(playerid, COLOR_WHITE, "Poruka poslata!.");
if (gTeam == 2 || gTeam == 1)
{
SendClientMessageEx(playerid, COLOR_YELLOW, "SMS: Ja te posmatram, posaljioc: SPIJUN (555)");
RingTone = 20;
return 1;
}
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_YELLOW, "SMS: Ja te posmatram, Posaljioc: SPIJUN (555)");
RingTone = 20;
return 1;
}
}
foreach(Player, i)
{
if(PlayerInfo == phonenumb && phonenumb != 0)
{
new giveplayerid = i;
if(Mobile != INVALID_PLAYER_ID)
{
SendClientMessageEx(playerid, COLOR_GREY, "Taj igrac vec prica sa nekim...");
return 1;
}
Mobile = giveplayerid; //caller connecting
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{

if(PhoneOnline > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "[BD:RP]Mobitel od biranog pretplatnika je trenutno iskljucen.");
return 1;
}
if(PlayerInfo == 1)
{
format(string, sizeof(string), "SMS: %s, Posaljioc: Nepoznat.", text,GetPlayerNameEx(playerid),PlayerInfo);
}
else
{
format(string, sizeof(string), "SMS: %s, Posaljioc: %s (%d)", text,GetPlayerNameEx(playerid),PlayerInfo);
}

if(i != playerid)
{
if(PlayerInfo > 0)
{
//Shuffle the last received messages...
format(PlayerInfo, 132, "%s", PlayerInfo);
format(PlayerInfo, 132, "%s", PlayerInfo);
format(PlayerInfo, 132, "%s", PlayerInfo);
format(PlayerInfo, 132, "%s", PlayerInfo);
format(PlayerInfo, 132, "%s", PlayerInfo);
format(PlayerInfo, 132, "%s", PlayerInfo);
format(PlayerInfo, 132, "%s", PlayerInfo);
format(PlayerInfo, 132, "%s", PlayerInfo);
format(PlayerInfo, 132, "%s", PlayerInfo);
format(PlayerInfo, 132, "%s", string);
}
}

//format(string, sizeof(string), "* %s's phone beeps.", sendername);
RingTone =20;
SendClientMessageEx(giveplayerid, COLOR_YELLOW, string);
SendClientMessageEx(playerid, COLOR_YELLOW, string);
SendClientMessageEx(playerid, COLOR_WHITE, "Poruka uspjesno poslata!");
format(string, sizeof(string), "~r~$-%d", txtcost);
GameTextForPlayer(playerid, string, 5000, 1);
GivePlayerCash(playerid,-txtcost);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
Mobile = INVALID_PLAYER_ID;

if(strcmp(PlayerInfo, "Nista", true) != 0)
{
format(string, sizeof(string), "SMS: %s, Posaljioc: %s [automatski odgovor] (%d)", PlayerInfo, GetPlayerNameEx(giveplayerid), PlayerInfo);
SendClientMessageEx(playerid, COLOR_YELLOW, string);
}

return 1;
}
}
}
}
SendClientMessageEx(playerid, COLOR_GRAD2, "  Ne uspjesno slanje poruke ...");
return 1;
}

ermin.a
Underboss
pre 11 godina
A mogu ja napravit nije problem, samo ne vidim svrhu pa pogledaj kako sam ti uradio /call tako i za sms uradi, sa scanfom razdijelis text koji unese u dijalog (inputtext) umjesto ycmd parametre, Ako budem raspolozen napravit cu ajde.

Evo ti

#define DIALOG_GETNUMBER ....

CMD:getnumber(playerid, params[], help)
{
#pragma unused help
#pragma unused params
if(PlayerInfo == 1) ShowPlayerDialog(playerid, DIALOG_GETNUMBER, DIALOG_STYLE_INPUT, "Imenik", "Unesite Ime ili ID igraca:", "Unos", "Odustani");
else SendClientMessageEx(playerid, COLOR_GRAD1, "Nemate Imenik!.");
return 1;
}

case DIALOG_GETNUMBER:
{
if(response) {
new
iTarget;

if(sscanf(inputtext, "u", iTarget)) {
ShowPlayerDialog(playerid, DIALOG_GETNUMBER, DIALOG_STYLE_INPUT, "Imenik", "Unesite Ime ili ID igraca:", "Unos", "Odustani");
}
else if(IsPlayerConnected(iTarget)) {
new
szNumber[16 + MAX_PLAYER_NAME];

format(szNumber, sizeof(szNumber), "* %s (%i)", GetPlayerNameEx(iTarget), PlayerInfo);
SendClientMessageEx(playerid, COLOR_GRAD1, szNumber);
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Netacan ID igrača.");
}

return 1;
}
Snoopy.amx
Wheel Man
pre 11 godina
Hvala puno, skontao sam to za call i imenik ali ovo ne znam  kako za /sms jer hocu prvo da upisem broj, pa da ponovo dialog izbaci da upisem text.
Mozes li mi jos samo to molim te?w
ermin.a
Underboss
pre 11 godina
probaj, nisam siguran da sam sve dobro napisao ali trebalo bi da radi samo zamjeni varijablu pBroj sa svojom


// negdje vani
new SMSBroj = -1;
new SMSIgrac = -1;

#define DIALOG_SMS_BROJ 1
#define DIALOG_SMS_TEXT 2

YCMD:sms(playerid, param[], help)
{
    return PlayerInfo ? ShowPlayerDialog(playerid, DIALOG_SMS_BROJ, "Unos broja", "Unesite broj za sms poruku:", "Unos", "Odustani") : SendClientMessage(playerid, -1, "nemas telefon");
}

OnDialogResponse//
{
    if(dialogid == DIALOG_SMS_BROJ) {
    if(response) {
    if(strval(inputtext) > -1) {
    for(new p = 0; p != MAX_PLAYERS; p++) {
    if(!IsPlayerConnected(p)) continue;
    if(PlayerInfo == strval(inputtext)) {
    break;
    SMSBroj = PlayerInfo;
    SMSIgrac = p;
    }
    }
    }
    return ShowPlayerDialog(playerid, DIALOG_SMS_TEXT, DIALOG_STYLE_INPUT, "Unos texta" "Unesite zeljeni tekst za sms poruku:", "Unos", "Odustani");
    }
    }

    if(dialogid == DIALOG_SMS_TEXT) {
    if(!response) return SMSBroj=-1, SMSIgrac=-1;
    else if(strlen(inputtext) < 1) return ShowPlayerDialog(playerid, DIALOG_SMS_TEXT, DIALOG_STYLE_INPUT, "Unos texta" "Unesite zeljeni tekst za sms poruku:", "Unos", "Odustani");
    else {
    if(PlayerInfo[SMSIgrac] == SMSBroj) {
    new string;
    format(string, sizeof(string), "SMS od broja %d: %s", PlayerInfo, inputtext);
SendClientMessage(SMSIgrac, -1, string);
format(string, sizeof(string), "SMS na broj %d: %s", PlayerInfo[SMSIgrac], inputtext);
SendClientMessage(playerid, -1, string);
return SMSBroj=-1,SMSBroj=-1,1);
}
}
}
}
   
Snoopy.amx
Wheel Man
pre 11 godina
Error: (78201) : error 001: expected token: ";", but found ")"

Linija:
return SMSBroj=-1,SMSBroj=-1,1);
arnel avdic
Underboss
pre 11 godina
Samo ti kaze ocekuje ovo ; ali je naišlo na ovo )
probaj ovako dole
Linija:
return SMSBroj=-1,SMSBroj=-1,1;

Morate biti prijavljeni da biste odgovorili na ovu temu.

Prijava