godcar - 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: godcar (
/showthread.php?tid=299900)
godcar -
manchestera - 27.11.2011
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;
}
Re: godcar -
MP2 - 28.11.2011
Just set the vehicle health to ~999999
Re: godcar -
Aira - 28.11.2011
It must be [MAX_PLAYER_NAME]; so that it will work for all
Re: godcar -
=WoR=G4M3Ov3r - 28.11.2011
use sscanf
Re: godcar - Emmet_ - 28.11.2011
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;
}
Re: godcar -
System64 - 28.11.2011
Emmet_ - Yeah you passed loop hahha fail, instead of playerid us i and chek if is a player connected
Re: godcar - Emmet_ - 28.11.2011
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
Re: godcar -
manchestera - 28.11.2011
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?
Re: godcar -
manchestera - 30.11.2011
bump
Re: godcar -
MP2 - 30.11.2011
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.