/911 problem
#1

Hello. Have a /911 [id] [crime] command. But don't work.Doesn't write the crime. Why?
Sorry bad english.
The code:
Код:
	if(strcmp(cmd, "/911", true) == 0) {
	  new tmp[256];
	  new crime;
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /911 [ID] [CRIME]");
			return 1;
		}
		giveplayerid = strval(tmp);

		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) {
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /911 [ID] [CRIME]");
			return 1;
		}
 		crime= strval(tmp);

		if (IsPlayerConnected(giveplayerid)) {
			GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			GetPlayerName(playerid, sendername, sizeof(sendername));
			format(string, sizeof(string), "[RADIO] %s reported %s %s", sendername,giveplayer, crime);
			SendClientMessageToAll(COLOR_YELLOW, string);
		}else {
			format(string, sizeof(string), "%d : Wrong ID!", giveplayerid);
			SendClientMessage(playerid, COLOR_YELLOW, string);
		}
		return 1;
	}
Reply
#2

No Error! The command work, but not correctly.
Doesn't write the crime.
Reply
#3

Quote:
Originally Posted by gnorby88
No Error! The command work, but not correctly.
Doesn't write the crime.
So, the command works, with no errors in PAWNO, but when you send in the Crime info, that won't show up? That sounds like a Team problem.
Reply
#4

When i am use the command. etc. (id 2: nobody)
/911 2 some text
gnorby reported nobody
the crime not show! No Team!!!
Reply
#5

It will not work to send the integer 'crime' by using %s..
Reply
#6

I use %s. Or? What do you think? I don't understand. Help pls...
Reply
#7

So. I probably this command in dcmd,but don't work.:
/911 2 text ---> wrong id!
/911 2 t
If only write one carachter (t), then work the command. But if write long text no work.
Nobody help. pls..

Код:
dcmd_911(playerid, params[])
{
	new giveplayerid,string;
	if (!sscanf(params, "ds", giveplayerid, string)){
		SendClientMessage(playerid, 0xFF0000FF, "[INFO] USAGE: /911 [plyerid] [Crime]");
	}else{
		if (IsPlayerConnected(giveplayerid))
		{
			new rname[256];
			new cname[256];
			GetPlayerName(playerid, rname, sizeof(rname));
			GetPlayerName(giveplayerid, cname, sizeof(rname));
			new temp[256];
			format(temp, sizeof(temp), "[RADIO] %s reported %s %s",rname,cname, string);
			SendClientMessageToAll(COLOR_YELLOW,temp);
		}else{
            SendClientMessage(playerid, 0xFF0000FF, "[INFO] Wrong ID");
		}
	}
	return 1;
}
Reply
#8

https://sampwiki.blast.hk/wiki/Fast_Commands
Scroll down till you see a table about data types you see if you ust use %s or %d. etc..
Reply
#9

pawn Код:
if(strcmp(cmd, "/911", true) == 0)
  {
    new tmp[128];
    new tmp2[128];
    new crime;
    tmp = strtok(cmdtext, idx);
    tmp2 = strtok(cmdtext, idx);

    if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /911 [ID] [CRIME]");
    if(!strlen(tmp2)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /911 [ID] [CRIME]");
   
    giveplayerid = strval(tmp);
    crime= strval(tmp2);

    if(IsPlayerConnected(giveplayerid))
    {
      GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
      GetPlayerName(playerid, sendername, sizeof(sendername));
      format(string, sizeof(string), "[RADIO] %s reported %s %s", sendername,giveplayer, crime);
      SendClientMessageToAll(COLOR_YELLOW, string);
    }else {
      format(string, sizeof(string), "%d : Wrong ID!", giveplayerid);
      SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    return 1;
  }
Reply
#10

Thx.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)