SA-MP Forums Archive
Help Please :D - 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: Help Please :D (/showthread.php?tid=369546)



Help Please :D - Adam_Hardy - 17.08.2012

Guyz Help Please if its possible !

(9895) : error 029: invalid expression, assumed zero
(9895) : error 001: expected token: ";", but found "if"
(9897) : error 029: invalid expression, assumed zero
(9897) : error 001: expected token: ";", but found "if"



Код:
CMD:r(playerid, params[])
{
	new string[128];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!IsACop(playerid) && !IsAGov(playerid) && !IsAArmy(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer/Government Official.");
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/r)adio [text]");
	if(AntiAdv(playerid, params)) return 1;
	if(PlayerInfo[playerid][pFacDiv]){format(string, sizeof(string), "** [%s] %s %s: %s", RPFDN(playerid), RPFRN(playerid), RPN(playerid), params);}
	else if (!IsACop(playerid)) {format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);}
	SendPlayerFactionMessage(playerid, 0, COLOR_RADIO, string);
	else if (!IsAGov(playerid)) {format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);}
	SendPlayerFactionMessage(playerid, 0, COLOR_GREEN, string);
	else if (!IsAArmy(playerid)) {format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);}
	SendPlayerFactionMessage(playerid, 0, COLOR_ARMY, string);
	if(IsACop(playerid)) Log("logs/SAPD.log", string);
	else if(IsAGov(playerid)) Log ("logs/GOV.log", string);
    else if(IsAArmy(playerid)) Log ("logs/ARMY.log", string);
	return 1;
}


this
Код:
#pragma tabsize 0
just deleted my warnings but it didn't work ingame


Re: Help Please :D - Admigo - 17.08.2012

Try:
Код:
CMD:r(playerid, params[])
{
	new string[128];
   	if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
	if(!IsACop(playerid) && !IsAGov(playerid) && !IsAArmy(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer/Government Official.");
	if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/r)adio [text]");
	if(AntiAdv(playerid, params)) return 1;
	if(PlayerInfo[playerid][pFacDiv]){format(string, sizeof(string), "** [%s] %s %s: %s", RPFDN(playerid), RPFRN(playerid), RPN(playerid), params);}
	else if (!IsACop(playerid)) {format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);{
	SendPlayerFactionMessage(playerid, 0, COLOR_RADIO, string);
}
	else if (!IsAGov(playerid)) {format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);{
	SendPlayerFactionMessage(playerid, 0, COLOR_GREEN, string);
}
	else if (!IsAArmy(playerid)) {format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);{
	SendPlayerFactionMessage(playerid, 0, COLOR_ARMY, string);
}
	if(IsACop(playerid)) Log("logs/SAPD.log", string);
	else if(IsAGov(playerid)) Log ("logs/GOV.log", string);
    else if(IsAArmy(playerid)) Log ("logs/ARMY.log", string);
	return 1;
}
You close the brackets but didnt open it like:
Код:
if(....
{

}



Re : Help Please :D - Adam_Hardy - 17.08.2012

didn't work, yo ! alot of errors pop's up


Re: Help Please :D - [DOG]irinel1996 - 17.08.2012

To be honest, I think everything looks OK, give a try:
pawn Код:
CMD:r(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsAGov(playerid) && !IsAArmy(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer/Government Official.");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/r)adio [text]");
    if(AntiAdv(playerid, params)) return 1;
    if(PlayerInfo[playerid][pFacDiv]) {
        format(string, sizeof(string), "** [%s] %s %s: %s", RPFDN(playerid), RPFRN(playerid), RPN(playerid), params);
    }
    else if (!IsACop(playerid)) {
        format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);
    }
    else if (!IsAGov(playerid)) {
        format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);
    }
    else if (!IsAArmy(playerid)) {
        format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);
    }
    SendPlayerFactionMessage(playerid, 0, COLOR_ARMY, string);
    if(IsACop(playerid)) Log("logs/SAPD.log", string);
    else if(IsAGov(playerid)) Log ("logs/GOV.log", string);
    else if(IsAArmy(playerid)) Log ("logs/ARMY.log", string);
    return 1;
}
Ahh, by the way, if you change sizeof(string) to 128, would be better, better optimisation.


Re : Re: Help Please :D - Adam_Hardy - 17.08.2012

Quote:
Originally Posted by irinel1996
Посмотреть сообщение
To be honest, I think everything looks OK, give a try:
pawn Код:
CMD:r(playerid, params[])
{
    new string[128];
    if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
    if(!IsACop(playerid) && !IsAGov(playerid) && !IsAArmy(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer/Government Official.");
    if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: (/r)adio [text]");
    if(AntiAdv(playerid, params)) return 1;
    if(PlayerInfo[playerid][pFacDiv]) {
        format(string, sizeof(string), "** [%s] %s %s: %s", RPFDN(playerid), RPFRN(playerid), RPN(playerid), params);
    }
    else if (!IsACop(playerid)) {
        format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);
    }
    else if (!IsAGov(playerid)) {
        format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);
    }
    else if (!IsAArmy(playerid)) {
        format(string, sizeof(string), "** %s %s: %s", RPFRN(playerid), RPN(playerid), params);
    }
    SendPlayerFactionMessage(playerid, 0, COLOR_ARMY, string);
    if(IsACop(playerid)) Log("logs/SAPD.log", string);
    else if(IsAGov(playerid)) Log ("logs/GOV.log", string);
    else if(IsAArmy(playerid)) Log ("logs/ARMY.log", string);
    return 1;
}
Ahh, by the way, if you change sizeof(string) to 128, would be better, better optimisation.

dude i want each faction radio with its color like NGRP


Re: Help Please :D - [DOG]irinel1996 - 17.08.2012

OK, remove SendPlayerFactionMessage and add it under the formated text with your color. But don't add them between if and else if.


Re : Re: Help Please :D - Adam_Hardy - 17.08.2012

Quote:
Originally Posted by irinel1996
Посмотреть сообщение
OK, remove SendPlayerFactionMessage and add it under the formated text with your color. But don't add them between if and else if.
damn some colors work ! and some dont, all defined

can we go on teamviewer or msn ?


Re: Help Please :D - [DOG]irinel1996 - 17.08.2012

Team Viewer by PM.


Re : Help Please :D - Adam_Hardy - 17.08.2012

dude ! thats the help ?