Major zcmd issue
#2

Код:
cmd(pm, playerid, params[])
{
    new targetid, message[128];
    if(sscanf(params, "us", targetid, message))
        return SendClientMessage(playerid, -1, "USAGE: /pm [playerid] [message]");

   if(!IsPlayerConnected(targetid))
        return SendClientMessage(playerid, -1, "Error: Player is offline.");

    new str1[128], str[128], sender[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME]
    GetPlayerName(targetid, receiver, sizeof(receiver));
    GetPlayerName(playerid, sender, sizeof(sender));
    format(str1, sizeof(str1), "PM to %s(%d): %s", receiver, targetid, message);
    format(str2, sizeof(str2), "PM from %s(%d): %s", sender, playerid, message);
    SendClientMessage(playerid, -1, str1);
    SendClientMessage(targetid, -1, str2);
    return 1;
}
I am on my ipod, so indentation might be screwed.
and i am using sscanf in this example.
note that i am also new to scripting, miatakes may have been made.
edit; fixed some errors
Reply


Messages In This Thread
Major zcmd issue - by Kurtis96z - 03.06.2012, 05:45
Re: Major zcmd issue - by cosbraa - 03.06.2012, 06:05
Re: Major zcmd issue - by Kurtis96z - 03.06.2012, 06:06
Re: Major zcmd issue - by [ABK]Antonio - 03.06.2012, 06:19
Re: Major zcmd issue - by cosbraa - 03.06.2012, 06:23
Re: Major zcmd issue - by Kurtis96z - 03.06.2012, 06:25
Re: Major zcmd issue - by cosbraa - 03.06.2012, 06:57
Re: Major zcmd issue - by Kurtis96z - 03.06.2012, 13:54
Re: Major zcmd issue - by iggy1 - 03.06.2012, 14:01
Re: Major zcmd issue - by milanosie - 03.06.2012, 14:02

Forum Jump:


Users browsing this thread: 2 Guest(s)