dcmd help
#1

why this script no errors dont show a message?? i type /sospetto id and a number but dont show any and if i type /sospetto show the alert :/


Код:
dcmd_sospetto(playerid,params[])
{
  new idsospetto;
  new numeropatt;
	if(sscanf(params, "ud", idsospetto, numeropatt)) return SendClientMessage(playerid, RED, "/sospetto [ID] [NUMERO PATTUGLIA]");
	if(!IsPlayerConnected(idsospetto)) return SendClientMessage(playerid, RED, "и offline");
	return SendClientMessageToAll(BLUE,"Radio Police-Patrol %s-Sheriff %s:A tutte le unitа stiamo inseguendo un sospetto>(%s)<presunto armato e pericoloso,Richiesta immediata di rinforzi",numeropatt,PlayerName(playerid),idsospetto);
}
Reply
#2

1. SendClientMessageToAll doesn't send formatted message.
2. sscanf sets -1 if player not found, no need of IsPlayerConnected
Reply
#3

what? lol
Reply
#4

help plzz
Reply
#5

Quote:
Originally Posted by [ZDM
jumbo ]
what? lol
Quote:
Originally Posted by ziomal432
1. SendClientMessageToAll doesn't send formatted message.
This is what ziomal means
pawn Код:
dcmd_sospetto(playerid,params[])
{
    new idsospetto;
    new numeropatt;
    new string[128];
    if(sscanf(params, "ud", idsospetto, numeropatt)) return SendClientMessage(playerid, RED, "/sospetto [ID] [NUMERO PATTUGLIA]");
    if(!IsPlayerConnected(idsospetto)) return SendClientMessage(playerid, RED, "и offline");
    format(string, sizeof(string), "Radio Police-Patrol %d-Sheriff %s:A tutte le unitа stiamo inseguendo un sospetto>(%d)<presunto armato e pericoloso,Richiesta immediata di rinforzi",numeropatt,PlayerName(playerid),idsospetto);
    SendClientMessageToAll(BLUE,string);
}
Also the format was wrong. You need %d for numbers not %s(only for strings, text)
Reply
#6

and how to put the id of the suspect the second %d to a name ?
Reply
#7

Quote:
Originally Posted by [ZDM
jumbo ]
and how to put the id of the suspect the second %d to a name ?
I am not sure exactly what you mean, but try this
pawn Код:
format(string, sizeof(string), "Radio Police-Patrol %d-Sheriff %s:A tutte le unitа stiamo inseguendo un sospetto>(%s)<presunto armato e pericoloso,Richiesta immediata di rinforzi",numeropatt,PlayerName(playerid),PlayerName(idsospetto));
Reply
#8

ty SOLVED
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)