stupid question :)...
#1

Код:
	CMD:p(playerid, params[])
	{
	    if(IsPlayerConnected(playerid))
	    {
	        new text;
	        if(sscanf(params, "s", text)) return SendClientMessage(playerid, COLOR_WHITE, "Koristenje: /pitaj [text]");
  		new sendername[MAX_PLAYER_NAME];
     		new string[126];
     		new text1;
		text1 = text;
	        GetPlayerName(playerid, sendername, sizeof(sendername));
		format(string, sizeof(string), "Pitanje od %s-a: %s", sendername, text1);
		ABroadCast(COLOR_ASKQ,string,1);
		SendClientMessage(playerid, COLOR_ASKQ, "Vase pitanje je poslato Adminima & GameHeroima.");
	    }
	    return 1;
	}
I'm new with ZCMD... I've try to learn how to script with ZCMD+sscanf but nothing. What's the problem with the command ?
Reply
#2

remove the new text1; and text1= text.
You don't need that, sscanf is different than strtok.

pawn Код:
CMD:p(playerid, params[])
{
    new text;
    if(sscanf(params, "s", text)) return SendClientMessage(playerid, COLOR_WHITE, "Koristenje: /pitaj [text]");
    new sendername[MAX_PLAYER_NAME];
    new string[126];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    format(string, sizeof(string), "Pitanje od %s-a: %s", sendername, text);
    ABroadCast(COLOR_ASKQ,string,1);
    SendClientMessage(playerid, COLOR_ASKQ, "Vase pitanje je poslato Adminima & GameHeroima.");
    return 1;
}
Reply
#3

LOL

I'm really noob. REP +1
Reply
#4

oopppsss sorry forgot something

pawn Код:
new text[128];
if(sscanf(params, "s[128]", text)) return //your error code here
If you didn't replace it with this code you will receive warnings in the console..
Reply
#5

Well don't call yourself a noob. Well we all go through that stage where we have to learn to become good in it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)