Help with /fixveh
#1

PHP код:
if(strcmp(cmd"/fixveh"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if(
PlayerInfo[playerid][pAdmin] < 3)
            {
                
SendClientMessage(playeridCOLOR_GRAD1"   you are not authorized to use that command!");
                return 
1;
            }
            if(
IsPlayerInAnyVehicle(playerid))
            {
                
GetPlayerName(playeridsendernamesizeof(sendername));
                
SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
                
SendClientMessage(playeridCOLOR_GREY"   Vehicle Fixed !");
            }
        }
        return 
1;
    } 
The code works in my other gamemodes i made but the one I hosted it don't work
When I do /fixveh in game its says vehicle fixedbut it doesnt fix.
I tryed to make 1000.0 to 100.0 still don't work
Reply
#2

try this
PHP код:
if(strcmp(cmd"/fixveh"true) == 0
    { 
        if(
IsPlayerConnected(playerid)) 
        { 
            if(
PlayerInfo[playerid][pAdmin] < 3
            { 
                
SendClientMessage(playeridCOLOR_GREY " you are not authorized to use that command!"); 
                return 
1
            } 
            if(
IsPlayerInAnyVehicle(playerid)) 
            {  
                
SetVehicleHealth(GetVehicleid[playerid], 100.0); 
                
SendClientMessage(playeridCOLOR_GREY"Vehicle Fixed !"); 
            } 
        } 
        return 
1
    } 
Reply
#3

Quote:
Originally Posted by мυ∂υℓ_вacнα
Посмотреть сообщение
try this
PHP код:
if(strcmp(cmd"/fixveh"true) == 0
    { 
        if(
IsPlayerConnected(playerid)) 
        { 
            if(
PlayerInfo[playerid][pAdmin] < 3
            { 
                
SendClientMessage(playeridCOLOR_GREY " you are not authorized to use that command!"); 
                return 
1
            } 
            if(
IsPlayerInAnyVehicle(playerid)) 
            {  
                
SetVehicleHealth(GetVehicleid[playerid], 100.0); 
                
SendClientMessage(playeridCOLOR_GREY"Vehicle Fixed !"); 
            } 
        } 
        return 
1
    } 
What you did man? Removing this won't help:
pawn Код:
GetPlayerName(playerid, sendername, sizeof(sendername));
@Kevin please describe your problem more.
Reply
#4

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
What you did man? Removing this won't help:
pawn Код:
GetPlayerName(playerid, sendername, sizeof(sendername));
@Kevin please describe your problem more.
Edited the problem reread it
Reply
#5

Try add RepairVehicle(GetPlayerVehicleID(playerid))
Reply
#6

Try this one:
pawn Код:
if(strcmp(cmdtext, "/fixveh", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] < 3)
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
                return 1;
            }
            if(IsPlayerInAnyVehicle(playerid))
            {
                SetVehicleHealth(GetPlayerVehicleID(playerid), 1000.0);
                SendClientMessage(playerid, COLOR_GREY, "   Vehicle Fixed !");
            }
        }
        return 1;
    }
Reply
#7

It's simple
PHP код:
if(strcmp(cmd"/fixveh"true) == 0
{
    new 
FloatsoPos[3];
    new 
vehicleID GetPlayerVehicleID(playerid);
    if(
PlayerInfo[playerid][pAdmin] < 3)
            {
                
SendClientMessage(playeridCOLOR_GRAD1"   you are not authorized to use that command!");
                return 
1;
            } 
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED"You must be in a vehicle in order to use this command.");
    for(new 
0MAX_VEHICLESi++)
    {
       if(
IsVehicleOccupied(i))
        {
            
GetVehiclePos(vehicleIDsoPos[0], soPos[1], soPos[2]);
            
RepairVehicle(vehicleID);
            
SendClientMessage(playerid,COLOR_YELLOW,"Vehicle Repaired.");
            return 
1;
        }
    }
    return 
1;

100% Working, from my server gamemode to here.
Reply
#8

Код:
i
    if(strcmp(cmd, "/fixveh", true) == 0)
	{
	if(AdminLevel[playerid] < 3) return SendClientMessage(playerid,0xFF0000AA,"You can't use this command.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_YELLOW,"You must be inside vehicle to use this command!");
    if(GetPlayerMoney(playerid) < 100) return SendClientMessage(playerid, COLOR_YELLOW,"You do not have enough money to repair your vehicle!");
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid,0xFFFF00AA,"Server: Your Vehicle Has Been Repaired!");
    GivePlayerMoney(playerid, -0);
    return 1;
}
|

That Should Work 100+ Working and Tested
Reply
#9

Quote:
Originally Posted by _Khaled_
Посмотреть сообщение
It's simple
PHP код:
if(strcmp(cmd"/fixveh"true) == 0
{
    new 
FloatsoPos[3];
    new 
vehicleID GetPlayerVehicleID(playerid);
    if(
PlayerInfo[playerid][pAdmin] < 3)
            {
                
SendClientMessage(playeridCOLOR_GRAD1"   you are not authorized to use that command!");
                return 
1;
            } 
    if(!
IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED"You must be in a vehicle in order to use this command.");
    for(new 
0MAX_VEHICLESi++)
    {
       if(
IsVehicleOccupied(i))
        {
            
GetVehiclePos(vehicleIDsoPos[0], soPos[1], soPos[2]);
            
RepairVehicle(vehicleID);
            
SendClientMessage(playerid,COLOR_YELLOW,"Vehicle Repaired.");
            return 
1;
        }
    }
    return 
1;

100% Working, from my server gamemode to here.
Why are you getting the players pos if it is not used further?
pawn Код:
GetVehiclePos(vehicleID, soPos[0], soPos[1], soPos[2]);
Reply
#10

Код:
	if(strcmp(cmd, "/fixveh", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(PlayerInfo[playerid][pAdmin] <=4)
			{
				SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !"); return 1;
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
			return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /fixveh [PlayerID/PartOfName]");
			}
			new playa;
			playa = ReturnUser(tmp);
			if(IsPlayerInAnyVehicle(playa))
			{
				new vid = GetPlayerVehicleID(playa);
				SetVehicleHealth(vid, 1000.0);
				RepairVehicle(GetPlayerVehicleID(playa));
				GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "* Admin %s has fixed your vehicle.", sendername);
				SendClientMessage(playa, COLOR_GREY, string);
			}
			else
			{
				format(string, sizeof(string),"I know you could fix cars, but since when can you fix players? %s isn't in a car. -Alex", PlayerName(giveplayerid));
				SendClientMessage(playerid, COLOR_GREY, string);
			}
			return 1;
		}
	}
There. I just fixed mine today, that should work perfectly fine.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)