SA-MP Forums Archive
dcmd help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: dcmd help (/showthread.php?tid=154203)



dcmd help - iJumbo - 12.06.2010

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);
}



Re: dcmd help - ziomal432 - 12.06.2010

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


Re: dcmd help - iJumbo - 12.06.2010

what? lol


Re: dcmd help - iJumbo - 12.06.2010

help plzz


Re: dcmd help - Dark_Kostas - 12.06.2010

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)


Re: dcmd help - iJumbo - 12.06.2010

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


Re: dcmd help - Dark_Kostas - 12.06.2010

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));



Re: dcmd help - iJumbo - 12.06.2010

ty SOLVED