SA-MP Forums Archive
Commands not working ! - 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)
+--- Thread: Commands not working ! (/showthread.php?tid=359230)



Commands not working ! - Avi57 - 13.07.2012

Hello,
Here are some commands which are not working ! when i try like /announce, it just say : USAGE : /announce <message>

Hope you fix them all !
Код:
dcmd_fare(playerid,params[])
{
	new price2,pmodelid = GetVehicleModel(GetPlayerVehicleID(playerid));
	if(gTeam[playerid] != TEAM_DRIVER) return SendClientMessage(playerid,red,"ERROR: "lgrey"You aren't a "lyellow2"taxi driver"lgrey"!");
	if(PInfo[playerid][onduty] == 1) return SendClientMessage(playerid, red,"ERROR: "lyellow2"You're already on duty, please leave your car!");
	if(sscanf(params,"i",price2)) return SendClientMessage(playerid,red,"USAGE: "lgrey"/fare "lyellow2"[cost]") && SendClientMessage(playerid,red,""lblue"FUNCTION: "lgrey"This will set a price for each 10 seconds a player is in your taxi!");
	if(!IsTaxi(playerid,pmodelid)) return SendClientMessage(playerid,red,"ERROR:"lgrey"You must be in a "lyellow2"taxi"lgrey"!");
	if(price2 > 500) return SendClientMessage(playerid,red,""lwhite"*"lred"That's to much for 10 seconds!"lwhite"*");
	PInfo[playerid][fare2] = price2;
	PInfo[playerid][onduty] = 1;
	SendFMessageToAll(green,""lgreen"» Driver "lyellow2"%s(ID:%i) "lgreen"is now on duty! Fare: "lorange"%i "lgreen"per "lorange"10 seconds"lgreen"!",GetPName(playerid),playerid,price2);
	return 1;
}

dcmd_announce(playerid,params[])
{
    new text[128],string[128];
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,red,error);
    if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,green2,"USAGE: "lyellow2"/announce <message>");
    format(string,sizeof(string),"~w~%s",text);
    GameTextForAll(string,4000,3);
    return 1;
}
Thanks


Re: Commands not working ! - Cxnnor - 13.07.2012

Added SendClientMessageToAll, see if that works.
pawn Код:
dcmd_announce(playerid,params[])
{
    new text[128],string[128];
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,red,error);
    if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,green2,"USAGE: "lyellow2"/announce <message>");
    format(string,sizeof(string),"%s announced: %s",text);
    SendClientMessageToAll(playerid, string);
    GameTextForAll(string,4000,3);
    return 1;
}



Re: Commands not working ! - .FuneraL. - 13.07.2012

Use SendClientMessageToAll and put the ";" missing at the end of the function

pawn Код:
dcmd_announce(playerid,params[])
{
    new text[128],string[128];
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,red,error);
    if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,green2,"USAGE: "lyellow2"/announce <message>");
    format(string,sizeof(string),"%s announced: %s",text);
    SendClientMessageToAll(-1, string);
    GameTextForAll(string,4000,3);
    return 1;
}



Re: Commands not working ! - clarencecuzz - 13.07.2012

Quote:
Originally Posted by Cxnnor
Посмотреть сообщение
Added SendMessageToAll, see if that works.
pawn Код:
dcmd_announce(playerid,params[])
{
    new text[128],string[128];
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,red,error);
    if(sscanf(params,"s[128]",text)) return SendClientMessage(playerid,green2,"USAGE: "lyellow2"/announce <message>");
    format(string,sizeof(string),"%s announced: %s",text);
    SendMessageToAll(playerid)
    GameTextForAll(string,4000,3);
    return 1;
}
SendMessageToAll(playerid) ??

pawn Код:
dcmd_announce(playerid,params[])
{
    new text[128],string[128];
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,red,error);
    if(sscanf(params,"s",text)) return SendClientMessage(playerid,green2,"USAGE: "lyellow2"/announce <message>");
    format(string,sizeof(string),"~w~%s",text);
    GameTextForAll(string,4000,3);
    return 1;
}



Re: Commands not working ! - Devilxz97 - 13.07.2012

try this . .

pawn Код:
dcmd_announce(playerid,params[])
{
    new string[128];
    if(PInfo[playerid][Level] < 3) return SendClientMessage(playerid,red,"ERROR!");
    if(sscanf(params, "s", string)) return SendClientMessage(playerid, COLOR_WHITE, "[USAGE]:/announce [text]");
    format(string, sizeof(string), "~w~%s", string);
    GameTextForAll(string, 4000, 3);
    return 1;
}



Re: Commands not working ! - leonardo1434 - 13.07.2012

i see no problem at command announce, the only thing would cause the message its your level in game. Try check which rank you're in game and compare to this one. if you're under level 3 it will display the message.


Re: Commands not working ! - clarencecuzz - 13.07.2012

Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
i see no problem at command announce, the only thing would cause the message its your level in game. Try check which rank you're in game and compare to this one. if you're under level 3 it will display the message.
He clearly said that it was returning the Syntax for the command, thus giving evidence that the error is/was in the sscanf line...