Why wont this work for me?
#1

Im Having A issue, i tried to fix it but it Just wont Work
Here's The code
i Need this Very Much...

Код:
	if(PlayerInfo[playerid][IsCivil] == 1)
	if(vehicleid == 596 || vehicleid == 597 || vehicleid == 598)
	{
		new string[128];
		SetPlayerWantedLevel(playerid, 4);
		format(string,sizeof(string),"WARNING: Your wanted level has been increased to %d",GetPlayerWantedLevel(playerid));
		SendClientMessage(playerid,red,string);
	}
Please, i need this verymuch.
Reply
#2

What doesn't work?
Reply
#3

It's should give a effect but it doesnt do anything, i Just enter the vehicle id, and It does nothing.
if u ask if im a civil, yes i am civil while i tried.
Reply
#4

Код:
new id; id = GetPlayerVehicleID(playerid);
Before the if...
Reply
#5

Thanks. Finally.
Reply
#6

I think i fucked up again.

Код:
CR.pwn(11633) : warning 219: local variable "vehicleid" shadows a variable at a preceding level
Do i have to return 1;
?
Reply
#7

Add the callback you are using in the first post to clear misunderstanding and remove the entire line given by blackwave as it does not fix anything.

Fix your indentation a slight bit, even though it is valid to do something like
pawn Код:
if(condition)
  statement;
I still believe its better to do:
pawn Код:
if(condition)
{
    if(secondcondition)
In fact, your code would be much better this way:
pawn Код:
if(condition1 && condition2)
{
Reply
#8

ehm, right.

This would end up wrong anyways, so i'll correct it.

You probably want to check if they're in a police car right? Cause vehicleid doesnt correspond to the model of the car, vehicleid is the id that's assigned to the car.

If you want to check if they step in a police car, it would be like this:

Код:
	if(PlayerInfo[playerid][IsCivil] == 1)
	if(GetVehicleModel(vehicleid) == 596 || GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 598)
	{
		new string[128];
		SetPlayerWantedLevel(playerid, 4);
		format(string,sizeof(string),"WARNING: Your wanted level has been increased to %d",GetPlayerWantedLevel(playerid));
		SendClientMessage(playerid,red,string);
	}
Reply
#9

Quote:
Originally Posted by Geso
Посмотреть сообщение
ehm, right.

This would end up wrong anyways, so i'll correct it.

You probably want to check if they're in a police car right? Cause vehicleid doesnt correspond to the model of the car, vehicleid is the id that's assigned to the car.

If you want to check if they step in a police car, it would be like this:

Код:
	if(PlayerInfo[playerid][IsCivil] == 1)
	if(GetVehicleModel(vehicleid) == 596 || GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 598)
	{
		new string[128];
		SetPlayerWantedLevel(playerid, 4);
		format(string,sizeof(string),"WARNING: Your wanted level has been increased to %d",GetPlayerWantedLevel(playerid));
		SendClientMessage(playerid,red,string);
	}
Worked Prefect, No warings, no erros. Thank You Sir. or Cat... Lol.
Reply
#10

Quote:
Originally Posted by Porsche911
Посмотреть сообщение
Worked Prefect, No warings, no erros. Thank You Sir. or Cat... Lol.
No problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)