Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×

Question

Posted

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;
}

HELP VA ROG, AM INCERCAT TOT CE ESTE POSIBIL

2 answers to this question

Recommended Posts

  • 0
Posted

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.