Job cars... - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Job cars... (
/showthread.php?tid=254131)
Job cars... -
Vvolk - 09.05.2011
I have a problem: I want to do job cars whose id id: GD1,GD2,GD3,GD4,GD5,GD6,GD7. But i make the code under
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
But if player who not in this work enter this car, sendmessage for him:"You don't work this job",if player in this job, but he doesn't wear an uniform, send message for him:"You should work in this work to drive this car". But i maked this code and then player enter any car to them send message:"You don't wowk this job" and he can drive this car and him don' t remove form this car. There is my code:
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == GD1,GD2,GD3,GD4,GD5,GD6,GD7){
if(isPlayerInJob(playerid,1)){
SetPlayerScore(playerid,200);
}
else
{
SendClientMessage(playerid,0x999900AA,"You don't work this job!");
RemovePlayerFromVehicle(playerid);
}
}
if(vehicleid == GD1,GD2,GD3,GD4,GD5,GD6,GD7){
if(GetPlayerSkin(playerid)!=28){
SetPlayerScore(playerid,200);
}
else
{
SendClientMessage(playerid,0x999900AA,"You should wear an uniform!");
RemovePlayerFromVehicle(playerid);
}
}
return 1;
}
Please correct my code or write your own, I will be very grateful.
Re: Job cars... -
Seven_of_Nine - 09.05.2011
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new Float:pos1,Float:pos2,Float:pos3;
GetPlayerPos(playerid,pos1,pos2,pos3);
if(vehicleid == GD1 || vehicleid == GD2 || vehicleid == GD3 || vehicleid == GD4 || vehicleid == GD5 || vehicleid == GD6 || vehicleid == GD7) {
if(isPlayerInJob(playerid,1)) { //If this doesn't work, then something's wrong with isPlayerInJob.
SetPlayerScore(playerid,200);
} else {
SendClientMessage(playerid,0x999900AA,"You don't work this job.");
SetPlayerPos(playerid,pos1,pos2,pos3+1);
}
if(GetPlayerSkin(playerid) != 28) { //I don't know whats the uniform ID, I just follow your template.
SetPlayerScore(playerid,200);
} else {
SendClientMessage(playerid,0x999900AA,"You have to wear an uniform.");
SetPlayerPos(playerid,pos1,pos2,pos3+1);
}
}
return 1;
}
Re: Job cars... -
Vvolk - 09.05.2011
Thank you very much, but there is one problem: Then player enter this car as a passenger with key "G" him remove from car. How I can make , what player remove only if he want to drive this car?
Re: Job cars... -
Biesmen - 09.05.2011
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new Float:pos1,Float:pos2,Float:pos3;
GetPlayerPos(playerid,pos1,pos2,pos3);
if(vehicleid == GD1 || vehicleid == GD2 || vehicleid == GD3 || vehicleid == GD4 || vehicleid == GD5 || vehicleid == GD6 || vehicleid == GD7)
{
if(!ispassenger)
{
if(isPlayerInJob(playerid,1))
{
SetPlayerScore(playerid,200);
}
else
{
SendClientMessage(playerid,0x999900AA,"You don't work this job.");
SetPlayerPos(playerid,pos1,pos2,pos3+1);
}
if(GetPlayerSkin(playerid) != 28)
{
SetPlayerScore(playerid,200);
}
else
{
SendClientMessage(playerid,0x999900AA,"You have to wear an uniform.");
SetPlayerPos(playerid,pos1,pos2,pos3+1);
}
}
return 1;
}
Re: Job cars... -
Seven_of_Nine - 09.05.2011
Very well, thanks for expanding mine