HELP VEHICLES -
Ro[X]y - 13.03.2010
How can I know the ID of vehicles around me, without to be in any vehicle.
Thank you very very very much!
Re: HELP VEHICLES -
Joe Staff - 13.03.2010
pawn Код:
public OnPlayerCommandText(playerid,cmdtext[])
{
if(!cmdtext[1])return 0;
if(!strcmp(cmdtext[1],"SeeVehicles",true))
{
new tmpstring[128];
new Float:x,Float:y,Float:z;
SendClientMessage(playerid,0xFFFFFFFF,"Nearest Vehicles:");
for(new vehicleid;vehicleid<MAX_VEHICLES;vehicleid++)
{
GetVehiclePos(vehicleid,x,y,z);
if(IsPlayerInRangeOfPoint(playerid,10.0,x,y,z))
{
format(tmpstring,"VehicleID: %d -- Model Number: %d",vehicleid,GetVehicleModel(vehicleid));
SendClientMessage(playerid,0xFFFFFFFF,tmpstring);
}
}
return SendClientMessage(playerid,0xFFFFFFFF,"_____________________");
}
return 0;
}
Re: HELP VEHICLES -
Ro[X]y - 13.03.2010
Checking, I'll edit this reply.
Thanks.
It's not working.
I did this thing.
Код:
if(strcmp(cmd, "/BreakIn", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(Toolkit[playerid] == 1)
{
new Float:x,Float:y,Float:z;
for(new vehicleid;vehicleid<MAX_VEHICLES;vehicleid++)
{
GetVehiclePos(vehicleid,x,y,z);
if(IsPlayerInRangeOfPoint(playerid,10.0,x,y,z))
{
if(VehicleInfo[vehicleid][vLock] == 0)
{
Break[playerid] = 20;
BreakingInCount(playerid, vehicleid);
}
else if(VehicleInfo[vehicleid][vLock] == 1)
{
Break[playerid] = 40;
BreakingInCount(playerid, vehicleid);
}
else if(VehicleInfo[vehicleid][vLock] == 2)
{
Break[playerid] = 60;
BreakingInCount(playerid, vehicleid);
}
else if(VehicleInfo[vehicleid][vLock] >= 3)
{
Break[playerid] = 80;
BreakingInCount(playerid, vehicleid);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "There are no car around you!");
}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You don't have a Toolkit!");
return 1;
}
}
return 1;
}
It's flooding the chat with "There are no car around you!" or if it succeeded or failed it's flooding too with the /me command
How can I fix it?
Re: HELP VEHICLES -
Deat_Itself - 13.03.2010
btw
a little mistake
Код:
format(tmpstring,"VehicleID: %d -- Model Number: %d",vehicleid,GetVehicleModel(vehicleid));
should be
Код:
format(tmpstring,sizeof(tmpstring),"VehicleID: %d -- Model Number: %d",vehicleid,GetVehicleModel(vehicleid));
Re: HELP VEHICLES -
Joe Staff - 13.03.2010
Indent your work better, and don't add 'IsPlayerConnected' to command especially since a player can't type a command if he's not connected!
pawn Код:
if(strcmp(cmd, "/BreakIn", true) == 0)
{
if(Toolkit[playerid] == 1)
{
new Float:x,Float:y,Float:z;
for(new vehicleid;vehicleid<MAX_VEHICLES;vehicleid++)
{
GetVehiclePos(vehicleid,x,y,z);
if(IsPlayerInRangeOfPoint(playerid,10.0,x,y,z))
{
switch(VehicleInfo[vehicleid][vLock])
{
case 0: Break[playerid] = 20;
case 1: Break[playerid] = 40;
case 2: Break[playerid] = 60;
default: Break[playerid] = 80;
}
BreakingInCount(playerid, vehicleid);
return 1;
}
}
return SendClientMessage(playerid,0xFFFFFFFF,"You're not near a vehicle.");
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You don't have a Toolkit!");
return 1;
}
return 1;
}
Re: HELP VEHICLES -
Ro[X]y - 13.03.2010
Ok so with this message:
"There are no car around you!" He stoped but he steel flooding with the /me command
Re: HELP VEHICLES -
Joe Staff - 13.03.2010
Show me the /me command >.>
Re: HELP VEHICLES -
Ro[X]y - 13.03.2010
This is all the public I added lines like the command but it still like this.
Код:
public BreakingInCount(playerid,carid)
{
new string[256];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "~w~%d", Break[playerid]);
GameTextForPlayer(playerid, string, 1200, 3);
if(Break[playerid] != 0)
{
Break[playerid]--;
KillTimer(breakintimer[playerid]);
breakintimer[playerid] = SetTimerEx("BreakingInCount",1000,1,"d",playerid);
}
else if(Break[playerid] == 0)
{
new rands = 0 + random(1);
if(rands == 0)
{
format(string, sizeof(string), "* %s tried to break in the car, and failed.",sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else if(rands == 1)
{
format(string, sizeof(string), "* %s tried to break in the car, and success.",sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetVehicleParamsForPlayer(carid,playerid,0,0);
}
}
}
Re: HELP VEHICLES -
Joe Staff - 13.03.2010
pawn Код:
public BreakingInCount(playerid,carid)
{
new string[256];
new sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "~w~%d", Break[playerid]);
GameTextForPlayer(playerid, string, 1200, 3);
if(Break[playerid] != 0)
{
Break[playerid]--;
breakintimer[playerid] = SetTimerEx("BreakingInCount",1000,0,"d",playerid);
}
else
{
new rands = random(1);
if(!rands)
{
format(string, sizeof(string), "* %s tried to break in the car, and failed.",sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
else
{
format(string, sizeof(string), "* %s tried to break in the car, and succeeded.",sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetVehicleParamsForPlayer(carid,playerid,0,0);
}
}
}
Re: HELP VEHICLES -
Ro[X]y - 13.03.2010
If it's working I'll come to you and kiss you man!
Checking.
It's working but It's always says that I failed.
BTW I changed the /me commands it's right success but not unlock the vehicle.