PM Script Issue
#1

Alright, I have taken from from larp GM mode as an edit, and I edited it for what I had found should work correctly...

pawn Код:
new cmd[128];
    new tmp[128];
    new gPlayerLogged[MAX_PLAYERS];
    new giveplayerid, moneys;
    new giveplayer[MAX_PLAYER_NAME];
    new ProxDetector[MAX_PLAYERS];

    if(strcmp(cmd, "/pm", true) == 0) // By CuervO_NegrO
    {
     if(IsPlayerConnected(playerid))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, 0xAFAFAFAA, "   You havent logged in yet!");
                return 1;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, 0xBFC0C2FF, "USAGE: /pm [playerid/PartOfName] [text]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
            if (IsPlayerConnected(giveplayerid))
            {
                if(giveplayerid != INVALID_PLAYER_ID)
                {
                    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                    new Float:x, Float:y, Float:z;
                    GetPlayerPos(playerid, x,y,z);
                    new h, mi, s;
                    new y1, m, d;
                    gettime(h,mi,s);
                    getdate(y1, m, d);
                    new length = strlen(cmdtext);
                    while ((idx < length) && (cmdtext[idx] <= ' '))
                    {
                        idx++;
                    }
                    new offset = idx;
                    new result[128];
                    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                    {
                        result[idx - offset] = cmdtext[idx];
                        idx++;
                    }
                    result[idx - offset] = EOS;
                    if(!strlen(result))
                    {
                        SendClientMessage(playerid, 0xBFC0C2FF, "USAGE: (/pm) [playerid/PartOfName] [text]");
                        return 1;
                    }
                    format(string, sizeof(string), "* PM From %s (%d): %s", sendername, playerid, (result));
                    SendClientMessage(giveplayerid, 0xE5C43EAA, string);
                    PlayerPlaySound(giveplayerid, 1055, x,y,z);
                    format(string, sizeof(string), "* PM Sent to %s (%d): %s", giveplayer, giveplayerid, (result));
                    SendClientMessage(playerid, 0xBBA033AA, string);
                    format(string, sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [PM] to %s: (%s)",d,m,y1,h,mi,s, sendername,giveplayer, result);
                    for(new i=0; i < MAX_PLAYERS; i++)
                    return 1;
                }
            }
            else
            {
                    format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
                    SendClientMessage(playerid, 0xB4B5B7FF, string);
            }
        }
        return 1;
    }
All original credits to to the creator btw.

Any help will be greatly appreciated, thank you!
Reply
#2

Well try using zcmd and sscanf since it is easier, i made a FS
https://sampforum.blast.hk/showthread.php?tid=275875
Reply
#3

Thank you, I just enabled and it works perfectly, Thank you so much!
Reply
#4

No problem buddy, i will rep you too since you repped me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)