Issue with params
#3

Try this out. This is just the first two.

pawn Код:
dcmd_pm(playerid,params[])
{
    new id,msg[128];
    if(sscanf(params,"ds",id,msg))
    {
        SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /pm (id) (message)");
        return 1;
    }
    if(!IsPlayerConnected(id))
    {
        SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: Given player ID not connected.");
        return 1;
    }
    if(playerid == id)
    {
        SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: You cannot PM yourself.");
        return 1;
    }

    new name[24],name2[24],final[128];
    GetPlayerName(id,name,sizeof(name));
    GetPlayerName(playerid,name2,sizeof(name2));
    format(Message,sizeof(Message),">> %s(%d): %s",name,id,msg);
    SendClientMessage(playerid,PM_OUTGOING_COLOR,Message);
    format(Message,sizeof(Message),"** %s(%d): %s",name2,playerid,msg);
    SendClientMessage(id,PM_INCOMING_COLOR,Message);
    PlayerPlaySound(id,1085,0.0,0.0,0.0);

    printf("PM: %s",Message);
    return 1;
}

dcmd_spam(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 3)
    {
        new color,text[128];
        if(sscanf(params,"ds",color,text))
        {
            SendClientMessage(playerid, 0xFFFF00FF, "Usage: /spam (color) (text)");
            SendClientMessage(playerid, 0xFFFF00FF, "Colours: 0=Black 1= 2=0xFFFF00FF 3=0xFFFF00FF 4=0xFFFF00FF 5=0xFFFF00FF 6=0xFFFF00FF 7=Purple 8=Brown 9=Pink");
            return 1;
        }
        if(color < 0 || color > 9)
        {
            SendClientMessage(playerid, 0xFFFF00FF, "Usage: /spam (color) (text)");
            SendClientMessage(playerid, 0xFFFF00FF, "Colours: 0=Black 1= 2=0xFFFF00FF 3=0xFFFF00FF 4=0xFFFF00FF 5=0xFFFF00FF 6=0xFFFF00FF 7=Purple 8=Brown 9=Pink");
            return 1;
        }

        switch(color)
        {
            case 0:for(new i; i < 50; i++) SendClientMessageToAll(0x40404050,string);
            case 0:for(new i; i < 50; i++) SendClientMessageToAll(0xFFFFFF50,string);
            case 0:for(new i; i < 50; i++) SendClientMessageToAll(0xFF000050,string);
            case 0:for(new i; i < 50; i++) SendClientMessageToAll(0xFF800050,string);
            case 0:for(new i; i < 50; i++) SendClientMessageToAll(0xFFFF0050,string);
            case 0:for(new i; i < 50; i++) SendClientMessageToAll(0x00FF0050,string);
            case 0:for(new i; i < 50; i++) SendClientMessageToAll(0x0040FF50,string);
            case 0:for(new i; i < 50; i++) SendClientMessageToAll(0xFF00FF50,string);
            case 0:for(new i; i < 50; i++) SendClientMessageToAll(0x994D0050,string);
            case 0:for(new i; i < 50; i++) SendClientMessageToAll(0xFF80FF50,string);
        }
        return 1;
    }
    else
    {
        SendClientMessage(playerid,0xFFFF00FF,"ERROR: You need to be level 3 to use this command");
        return 1;
    }
}
You'll need sscanf.
Reply


Messages In This Thread
Issue with params - by Warlock - 12.07.2010, 03:36
Re: Issue with params - by bigcomfycouch - 12.07.2010, 03:52
Re: Issue with params - by Backwardsman97 - 12.07.2010, 04:09
Re: Issue with params - by Warlock - 12.07.2010, 15:34
Re: Issue with params - by Warlock - 18.07.2010, 10:01
Re: Issue with params - by Warlock - 04.08.2010, 03:56

Forum Jump:


Users browsing this thread: 2 Guest(s)