Help ! (+REP)
#1

I am looking to make a Repairing system for vehicles
so
Here is an example
CMD:repair[player,params]]
{
Isplayerinrangeofpoint(x,y,z)
{
else
isplaerinrange.....

is that correct cuz i want to make this command usable in only fuel stations
Thnx
Reply
#2

IfIsPlayerInVehicle you must use
Reply
#3

PHP код:
new Float:fuelstat[10][3]={{0.0,0.0,0.0},{0.0,0.0,0.0},{0.0,0.0,0.0etc};
CMD:repair(pid){
    if(!
IsPlayerInAnyVehicle(pid))return scm(pid,-1,"You're not in any vehicle!");
    for(new 
ii2=sizeof(fuelstat); i2i2++){
        if(!
IsPlayerInRangeOfPoint(pid,10.0,fuelstat[i2][0],fuelstat[i2][1],fuelstat[i2][2]))continue;
        
RepairVehicle(GetPlayerVehicleID(pid));
        return 
scm(pid,-1,"Vehicle successfully repaired.");
    }
    
scm(pid,-1,"You're not in any fuel station!");
    return 
1;

Reply
#4

isplayerinanyvehicle means he can do /repair when he is in a vehicle
i mean it should be usable when he is near a pickup or checkpoint or any cord
Reply
#5

I just made working system try it, you have to enter fuel station cordinates. ez
Reply
#6

for the vehicle check:
PHP код:
if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1"You must be inside a vehicle."); 
Reply
#7

Quote:
Originally Posted by CodeStyle175
Посмотреть сообщение
PHP код:
new Float:fuelstat[10][3]={{0.0,0.0,0.0},{0.0,0.0,0.0},{0.0,0.0,0.0etc};
CMD:repair(pid){
    if(!
IsPlayerInAnyVehicle(pid))return scm(pid,-1,"You're not in any vehicle!");
    for(new 
ii2=sizeof(fuelstat); i2i2++){
        if(!
IsPlayerInRangeOfPoint(pid,10.0,fuelstat[i2][0],fuelstat[i2][1],fuelstat[i2][2]))continue;
        
RepairVehicle(GetPlayerVehicleID(pid));
        return 
scm(pid,-1,"Vehicle successfully repaired.");
    }
    
scm(pid,-1,"You're not in any fuel station!");
    return 
1;

didnt get can u give example with real cords ?? plz
Reply
#8

This should get you started.
Try searching for these the next time.

PHP код:
#define MAX_GAS_PUMPS 5
enum gaspumpData {
    
Float:xPos,
    
Float:yPos,
    
Float:zPos
}
new 
GasPumpLoc[MAX_GAS_PUMPS][gaspumpData] = {
    
/*
        Edit below with the coords of your gas pumps
    */
    
{XYZ},
    {
XYZ},
    {
XYZ},
    {
XYZ},
    {
XYZ}
};
CMD:repair(playeridparams[])
{
    if(!
IsPlayerNearAGasPump(playerid))
        return 
SendClientMessage(playerid, -1"No where near a place you can repair your vehicle.");
    if(!
IsPlayerInAnyVehicle(playerid))
        return 
SendClientMessage(playerid, -1"You must be inside a vehicle to use this command.");
        
    
// Repair, or whatever you have to do..
    
return 1;
}
IsPlayerNearAGasPump(playerid)
{
    for(new 
0sizeof(GasPumpLoc); i++)
    {
        if(
IsPlayerInRangeOfPoint(playerid4.0GasPumpLoc[i][xPos], GasPumpLoc[i][yPos], GasPumpLoc[i][zPos])) return 1;
    }
    return 
0;

Reply
#9

douublepost !
Reply
#10

doesnot know what to do with this code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)