zcmd and sscanf problem
#5

Well, since I need a PM command in my script anyway, let me create one real fast and you can edit it to your needs....

2 - 3 minutes later:

pawn Код:
COMMAND:pm(playerid, params[])
{
    new user, yourmessage[128], string[128];
    if(!sscanf(params, "us", user, yourmessage))
    {
        if(user != INVALID_PLAYER_ID)
        {
            format(string, sizeof(string), "[Private Message from %s]: %s", ReturnPlayerName(playerid), yourmessage);
            SendClientMessage(user, sc_Lime, string);
            format(string, sizeof(string), "[Private Message to %s]: %s", ReturnPlayerName(playerid), yourmessage);
            SendClientMessage(playerid, sc_Lime, string);
        }
        else return SendClientMessage(playerid, sc_LightRed, "ERROR: Invalid Player ID.");
    }
    else return SendClientMessage(playerid, sc_White, "COMMAND: /pm [playerid] [message]");
    return 1;
}
ReturnPlayerName:

pawn Код:
stock ReturnPlayerName(playerid)
{
    var1="Invalid_Player_ID";
    if(IsPlayerConnected(playerid))
    {
        GetPlayerName(playerid, var1, sizeof(var1));
        for(new i = 0; i < sizeof(var1); i++)
        { if(var1[i] == '_') { var1[i] = ' '; } }
    }
    return var1;
}
Reply


Messages In This Thread
zcmd and sscanf problem - by mrcoolballs - 23.08.2010, 21:24
Re: zcmd and sscanf problem - by nemesis- - 23.08.2010, 21:31
Re: zcmd and sscanf problem - by mrcoolballs - 23.08.2010, 21:32
Re: zcmd and sscanf problem - by nemesis- - 23.08.2010, 21:35
Re: zcmd and sscanf problem - by Sky4D - 23.08.2010, 21:37
Re: zcmd and sscanf problem - by FreshKilla - 23.08.2010, 21:40
Re: zcmd and sscanf problem - by [L3th4l] - 23.08.2010, 21:43
Re: zcmd and sscanf problem - by mrcoolballs - 23.08.2010, 21:45
Re: zcmd and sscanf problem - by nemesis- - 23.08.2010, 22:08
Re: zcmd and sscanf problem - by Sky4D - 23.08.2010, 22:10

Forum Jump:


Users browsing this thread: 2 Guest(s)