why dosnt this work?
#6

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
sscanf: use this. It will be pretty simple to use. Please note you need the plugin or the code to use :P

Example:

pawn Код:
dcmd_me(playerid,params[])
{
    new text[128],Playername[MAX_PLAYER_NAME]; // will create a text string with 128 cells (= maximum) and a Playername with maximum name input.
    if(!sscanf(params,"s",text))
    {
        new string[128]; // will create a new string with 128 cells.
        GetPlayerName(playerid,Playername,sizeof(Playername)); // will get players name and store it in Playername.
        format(string,sizeof(string),"%s %s",Playername,text); // First %s = Playername... Second %d = text
        SendClientMessageToAll(COLOR_WHITE,string); // Sends the text!
    }
    else return SendClientMessage(playerid,COLOR_RED,"Syntax Error: /me 'text'."); // if the player did not type the things correctly.
    return 1;
}
I hope you do not mind my kind of identing. I think it's the best
You don't even need sscanf for this command:

pawn Код:
dcmd_egoto(playerid,params[])
{
    new string[100], pName[25], pName2[25];
    if(!strlen(params)) return SendClientMessage(playerid,red,"USSAGE: /goto [id]");
    else if(enablegoto[id] == 0) return SendClientMessage(playerid,red,"ERROR: That player has goto disabled");
    else if(!IsPlayerConnected(strval(params))) return SendClientMessage(playerid,red,"Player not connected");
    else
    {
        GetPlayerPos(strval(params),X,Y,Z);
        SetPlayerPos(playerid,X,Y,Z);
        GetPlayerName(strval(params),pName2,25);
        GetPlayerName(playerid,25);
        format(string,100,"||Teleported to %s||",pName2);
        SendClientMessage(playerid,grey,string);
        format(string,100,"||%s has teleported to your position||",pName);
        SendClientMessage(strval(params),grey,string);
    }
    return 1;
}
Reply


Messages In This Thread
why dosnt this work? - by dark_clown - 03.11.2010, 17:14
Re: why dosnt this work? - by Jochemd - 03.11.2010, 17:23
Re: why dosnt this work? - by Bessensap - 03.11.2010, 17:26
Re: why dosnt this work? - by Jochemd - 03.11.2010, 18:00
Re: why dosnt this work? - by dark_clown - 03.11.2010, 18:31
Re: why dosnt this work? - by The_Moddler - 03.11.2010, 18:38

Forum Jump:


Users browsing this thread: 5 Guest(s)