if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
{
new tmpcar = GetVehicleModel(playerid);
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/m)egaphone [megaphone chat]");
return 1;
}
if (gTeam[playerid] != 2)
{
SendClientMessage(playerid, COLOR_GRAD2, " you are not part of a team");
return 1;
}
if(!IsACopCar(tmpcar))
{
SendClientMessage(playerid, COLOR_GRAD2, " you are not in a police vehicle");
return 1;
}
else
{
format(string, sizeof(string), "[Officer %s:o< %s]", sendername, result);
ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
printf("%s", string);
return 1;
}
}
public IsACopCar(carid)
{
if((carid >= 35) && (carid <= 60))
{
return 1;
}
return 0;
}
Taken out of PenSF I need to know why the carid is 35 - 60, while the vehicle ID's for the police cars are 596-599 & 601. The command also tells me that "I'm not in a police vehicle". While I am. It's PenSF so yeah.. It might not be 0.3 compatible. Could anyone tell me if this has any incompatibility? |
CreateVehicle(..) //Vehicle ID 1
CreateVehicle(..) //Vehicle ID 2
CreateVehicle(..) //Vehicle ID 3
//And so on...
if(strcmp(cmd, "/megaphone", true) == 0 || strcmp(cmd, "/m", true) == 0)
{
new tmpcar = GetVehicleModel(playerid);
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/m)egaphone [megaphone chat]");
return 1;
}
else if (gTeam[playerid] != 2)
{
SendClientMessage(playerid, COLOR_GRAD2, " you are not part of a team");
return 1;
}
else if(!(tmpcar == 427) || !(tmpcar == 490) || !(tmpcar == 523) || !(tmpcar == 528) || !(tmpcar == 596) || !(tmpcar == 597) || !(tmpcar == 598) || !(tmpcar == 599) || !(tmpcar == 601))
{
SendClientMessage(playerid, COLOR_GRAD2, " you are not in a police vehicle");
return 1;
}
else
{
format(string, sizeof(string), "[Officer %s:o< %s]", sendername, result);
ProxDetector(60.0, playerid, string,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW,COLOR_YELLOW);
printf("%s", string);
return 1;
}
}
Originally Posted by Conroy
Just use vehicle models.. 3 cop cars can be ruled out with 3 vehicle models, whereas if you are using vehicle ID's, they take more time because you would have more than 3 police vehicles in your server.
|
else if(tmpcar != 427) || tmpcar != 490 || tmpcar != 523 || tmpcar != 528 || tmpcar != 596 || tmpcar != 597 || tmpcar != 598) || tmpcar != 599 || tmpcar != 601)
D:\DOCUME~1\Rizky\BUREAU~1\PENSF.pwn(10543) : error 029: invalid expression, assumed zero D:\DOCUME~1\Rizky\BUREAU~1\PENSF.pwn(10543) : warning 215: expression has no effect D:\DOCUME~1\Rizky\BUREAU~1\PENSF.pwn(10543) : error 001: expected token: ";", but found ")" D:\DOCUME~1\Rizky\BUREAU~1\PENSF.pwn(10543) : error 029: invalid expression, assumed zero D:\DOCUME~1\Rizky\BUREAU~1\PENSF.pwn(10543) : fatal error 107: too many error messages on one line
else if(tmpcar != 427 || tmpcar != 490 || tmpcar != 523 || tmpcar != 528 || tmpcar != 596 || tmpcar != 597 || tmpcar != 598) || tmpcar != 599 || tmpcar != 601)