SA-MP Forums Archive
Help ! (+REP) - 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)
+--- Thread: Help ! (+REP) (/showthread.php?tid=602599)



Help ! (+REP) - Shaheen - 09.03.2016

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


Re: Help ! (+REP) - Deny1 - 09.03.2016

IfIsPlayerInVehicle you must use


Re: Help ! (+REP) - CodeStyle175 - 09.03.2016

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;




Re: Help ! (+REP) - Shaheen - 09.03.2016

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


Re: Help ! (+REP) - CodeStyle175 - 09.03.2016

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


Re: Help ! (+REP) - saffierr - 09.03.2016

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



Re: Help ! (+REP) - Shaheen - 10.03.2016

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


Re: Help ! (+REP) - itsCody - 10.03.2016

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;




Re: Help ! (+REP) - Shaheen - 12.03.2016

douublepost !


Re: Help ! (+REP) - Shaheen - 12.03.2016

doesnot know what to do with this code