godcar
#1

Ok i got a godcar cmd what works but onlyfor id 0 as i found out when i got my beta testers to test some stuff but im not sure why could you guys have a look, would be great thanks.

Код:
new GodMode[MAX_PLAYERS];
Код:
CMD:godcar(playerid)
{
	if(DeathMatch[playerid] != 0) return SendClientMessage(playerid, COLOR_RED, "You can not TP from DM. Use /exitdm to leave.");
	GodMode[playerid] = 1;
	SendClientMessage(playerid, COLOR_CADETBLUE, "You Have Turned God Car On!!!!");
	return 1;
}
CMD:godcaroff(playerid)
{
	if(DeathMatch[playerid] != 0) return SendClientMessage(playerid, COLOR_RED, "You can not TP from DM. Use /exitdm to leave.");
	GodMode[playerid] = 0;
	SendClientMessage(playerid, COLOR_CADETBLUE, "You Have Turned God Car Off Be Carefully!!!!");
	return 1;
}
Код:
forward AutoR(playerid);
public AutoR(playerid)
	{
	if(IsPlayerInAnyVehicle(playerid) && GodMode[playerid] == 1)
		{
		new vid = GetPlayerVehicleID(playerid);
		RepairVehicle(vid);
	}
	return 1;
}
Reply
#2

Just set the vehicle health to ~999999
Reply
#3

It must be [MAX_PLAYER_NAME]; so that it will work for all
Reply
#4

use sscanf
Reply
#5

lol, all the answers are wrong...

You didn't use SetTimerEx, therefore you didn't pass the playerid, so it's always going to work for ID 0, but try this instead:

Edit: Thanks for System64 for pointing out an error.

pawn Код:
forward AutoR();
public AutoR()
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerInAnyVehicle(i) && GodMode[i])
        {
            RepairVehicle(GetPlayerVehicleID(i));
            SetVehicleHealth(GetPlayerVehicleID(i), 1000.0);
        }
    }
    return 1;
}
Reply
#6

Emmet_ - Yeah you passed loop hahha fail, instead of playerid us i and chek if is a player connected
Reply
#7

Quote:
Originally Posted by System64
Посмотреть сообщение
Emmet_ - Yeah you passed loop hahha fail, instead of playerid us i and chek if is a player connected
lol xD

fixed! Rep++ to you for pointing that out :P
Reply
#8

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
lol, all the answers are wrong...

You didn't use SetTimerEx, therefore you didn't pass the playerid, so it's always going to work for ID 0, but try this instead:

Edit: Thanks for System64 for pointing out an error.

pawn Код:
forward AutoR();
public AutoR()
{
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerInAnyVehicle(i) && GodMode[i])
        {
            RepairVehicle(GetPlayerVehicleID(i));
            SetVehicleHealth(GetPlayerVehicleID(i), 1000.0);
        }
    }
    return 1;
}
So how do i use settimerex as im usless another with just settimer lol or do i just need to add the code you have posted?
Reply
#9

bump
Reply
#10

As I said previously (though everyone seemed to completely ignore my post) - set the vehicle's health to 999999 and they'll never* be destroyed.

* Except for planes blowing up due to collision.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)