PDA

View Full Version : Commands not working !


Avi57
13/07/2012, 12:39 PM
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

Cxnnor
13/07/2012, 12:43 PM
Added SendClientMessageToAll, see if that works.
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;
}

.FuneraL.
13/07/2012, 12:46 PM
Use SendClientMessageToAll and put the ";" missing at the end of the function

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

clarencecuzz
13/07/2012, 12:47 PM
Added SendMessageToAll, see if that works.
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) ??

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

Devilxz97
13/07/2012, 12:49 PM
try this . .

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

leonardo1434
13/07/2012, 12:51 PM
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.

clarencecuzz
13/07/2012, 12:54 PM
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...