Jump to content
  • 0

Problema /sms



Salut, am o problema la comanda sms.

Deci, eu pot sa trimit de pe un alt cont sms la un alt jucator, dar de pe contul care am primit smsu nu pot sa dau sms back (de ex primesc sms de la nr 2323, eu pot sa il vad si e totu ok, dar nu pot sa dau /sms 2323 sa ii raspuns, efectiv nu imi zice nimic), sper ca am fost inteles

YCMD:sms(playerid, params[], help)
    if(PlayerInfo[playerid][pPhone] == 0) return SCM(playerid, COLOR_GREY, "Nu ai un telefon.");

    if(PlayerInfo[playerid][pPhoneCredit] == 0) return SCM(playerid, COLOR_GREY, "You don't have enough credit.");

    new id, text[90], nrtel;
    if(sscanf(params, "is[90]", nrtel, text)) return SendSyntax(playerid, "/sms <number> <message>");

    if(!IsPlayerLogged(id)) return SCM(playerid, COLOR_GREY, "Player not connected.");

    if(!IsPlayerLogged(id) && id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Invalid number!");

//    if(id == playerid) return SCM(playerid, -1, "Nu poti sa folosesti aceasta comanda asupra ta.");

    if(PlayerInfo[id][pPhoneOn] == 0) return SCM(playerid, COLOR_GREY, "This player have his phone turned off.");

    if(PlayerInfo[playerid][pPhoneOn] == 0) return SCM(playerid, COLOR_GREY, "You have the phone turned off.");

    foreach(new i : Player)
        if(PlayerInfo[id][pPhoneNumber] == nrtel && nrtel != 0)
            SCMF(playerid, 0xC8E0DFFF, "SMS sended to %s (%d): %s", GetName(id), PlayerInfo[id][pPhoneNumber], text);
            SCMF(id, COLOR_YELLOW, "SMS from %s (%d): %s", GetName(playerid), PlayerInfo[playerid][pPhoneNumber], text);
            PlayerPlaySound(playerid, 1138, 0.0, 0.0, 0.0);
            PlayerInfo[playerid][pPhoneCredit] --;
            mysqlQuery("UPDATE `server_accounts` SET `PhoneCredits` = '%d' WHERE `ID` = '%d'", PlayerInfo[playerid][pPhoneCredit], PlayerInfo[playerid][pSQLID]);
        return true;

    SendClientMessage(playerid, COLOR_GREY, "Invalid number!");    
    return true;


Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Cateva observatii, poate intelegi ce e gresit.

1. Ai definit id dar nu ii aloci nici o valoare nicaieri desi incerci sa verifici daca acel id (care e 0) e logat pe server, daca are telefon etc

2. Ai acel foreach, presupun pentru a cauta nr introdus, problema e ca nu te folosesti de foreach deloc in schimb folosesti acelasi id care are valoarea 0

Dar presupun ca nu o sa gasesti o solutie asa ca poti da copy-paste de aici unde ti-am pus comanda reparata  si presupun functionala https://pastebin.com/gTJ2fMnu

  • Upvote 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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