This won't work? -
jNkk - 23.12.2012
Код:
if(IsPlayerInVehicle(playerid, 427 || 470 || 490 || 497 || 523 || 528 || 597 || 599 || 601))
if(gTeam[playerid] == TEAM_CIVILIANS || gTeam[playerid] == TEAM_GYPSIES)
{
new string[128];
new wantedlevel; wantedlevel = GetPlayerWantedLevel(playerid);
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+1);
format(string, sizeof(string),"[WANTED] Your wanted is now %d.", wantedlevel);
SendClientMessage(playerid, COLOR_ACHIEVEMENT, string);
}
return 1;
I put this under OnPlayerVehicleEnter but when I enter any of these vehicles and I am civilian or gypsy it won't give me any wanted level ...
Re: This won't work? -
park4bmx - 23.12.2012
Your missing opening and closing brackets! "{}" or you could have an
else statement and then
return 0;
Also I don't think the check for the vehicle will work that way.
This method will work for sure
pawn Код:
if(IsPlayerInVehicle(playerid, 427)|| IsPlayerInVehicle(playerid,470))
{
}
But just keep on adding them
Re: This won't work? -
jNkk - 23.12.2012
Nope... still wont work, this is the final script:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(IsPlayerInVehicle(playerid, 427) || IsPlayerInVehicle(playerid, 420) || IsPlayerInVehicle(playerid, 490)
|| IsPlayerInVehicle(playerid, 497) || IsPlayerInVehicle(playerid, 523) || IsPlayerInVehicle(playerid, 528)
|| IsPlayerInVehicle(playerid, 597) || IsPlayerInVehicle(playerid, 599) || IsPlayerInVehicle(playerid, 601))
{
if(gTeam[playerid] == TEAM_CIVILIANS || gTeam[playerid] == TEAM_GYPSIES)
{
new string[128];
new wantedlevel; wantedlevel = GetPlayerWantedLevel(playerid);
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+1);
format(string, sizeof(string),"[WANTED] Your wanted is now %d.", wantedlevel);
SendClientMessage(playerid, COLOR_ACHIEVEMENT, string);
}
}
return 1;
}
Re: This won't work? -
park4bmx - 23.12.2012
Yes becouse u need "vehiclemodel" not "vehicleid"
IsPlayerInVehicle is for vehicleid's
Use
GetVehicleModel instead
Re: This won't work? -
jNkk - 23.12.2012
Problem is if I press F to enter and don't even enter it it will still give me the wanted level. I want it so ONLY if its in the vehicle not if he tries to enter but he doesn't*(edit)... IsPlayerInVehicle would be better but it won't work? o.o
Re: This won't work? -
[HiC]TheKiller - 23.12.2012
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER && (gTeam[playerid] == TEAM_CIVILIANS || gTeam[playerid] == TEAM_GYPSIES)) // Player entered a vehicle as a driver
{
switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
case 427, 470, 490, 497, 523, 528, 597, 599, 601:
{
new string[75];
new wantedlevel; wantedlevel = GetPlayerWantedLevel(playerid);
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+1);
format(string, sizeof(string),"[WANTED] Your wanted is now %d.", wantedlevel);
SendClientMessage(playerid, COLOR_ACHIEVEMENT, string);
}
}
}
return 1;
}
Re: This won't work? -
Threshold - 24.12.2012
That wouldn't work unfortunately, that if statement is basically saying if they were onfoot, and entered as a driver as a civilian, set their wanted level up. OR if they are a Gypsy, set their wanted level up no matter what.
The correct code would be:
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) //They entered as driver
{
if(gTeam[playerid] == TEAM_CIVILIANS || gTeam[playerid] == TEAM_GYPSIES) //If they are Civ or Gyp
{
switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
{
case 427, 470, 490, 497, 523, 528, 597, 599, 601:
{
new string[35];
SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid)+1);
new wantedlevel; wantedlevel = GetPlayerWantedLevel(playerid); //This line should be placed AFTER you set the wanted level, otherwise it will just read the original wanted level.
format(string, sizeof(string),"[WANTED] Your wanted is now %d.", wantedlevel);
SendClientMessage(playerid, COLOR_ACHIEVEMENT, string);
}
}
}
}
return 1;
}
EDIT: Nevermind, just realised the bracket.