Jump to content
  • 0

A Problem!


Roach

Question

Info

 

  Am niste comenzi pe server, facute cu variabile, dar cand folosesc de exemplu /godcar, ii functioneaza numai la prim-ul player care a intrat pe server.

  Daca al 2-lea sau altcineva foloseste ocmanda ii zice ca godcar-ul a fost Activat dar nui functioneaza, nu se repara masina.

142sj0l.png

Underground-GFX

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

Commands:

CMD:godcar(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, red, "[ERROR]: {FFFFFF}You are not in a vehicle.");
    if(P_INFO[playerid][pGodCar] == 0) return SendClientMessage(playerid, info, "[INFO]: {FFFFFF}Godcar has been Enabled"), GodCarC[playerid] = 1, GodCarCTimer[playerid] = SetTimer("Repair", 1, 1);
	P_INFO[playerid][pGodCar] = 0;
	SendClientMessage(playerid, info, "[INFO]: {FFFFFF}Godcar has been Disabled");
	return KillTimer(GodCarCTimer[playerid]);
}
Timer:
public Repair(playerid)
{
    if (IsPlayerInAnyVehicle(playerid))
    {
    	new vehicleid = GetPlayerVehicleID(playerid), Float:health;	GetVehicleHealth(vehicleid, health);
    	if (health <= 999) RepairVehicle(vehicleid);
    }
}

That's all!

142sj0l.png

Underground-GFX

Link to comment
Share on other sites

CMD:godcar(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, red, "[ERROR]: {FFFFFF}You are not in a vehicle.");
    if(P_INFO[playerid][pGodCar] == 0) return SendClientMessage(playerid, info, "[INFO]: {FFFFFF}Godcar has been Enabled"), GodCarC[playerid] = 1, GodCarCTimer[playerid] = SetTimer("Repair", 1, 1);
	P_INFO[playerid][pGodCar] = 0;
	SendClientMessage(playerid, info, "[INFO]: {FFFFFF}Godcar has been Disabled");
	return KillTimer(GodCarCTimer[playerid]);
}
inlocuieste cu
CMD:godcar(playerid, params[])
{
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, red, "[ERROR]: {FFFFFF}You are not in a vehicle.");
    if(P_INFO[playerid][pGodCar] == 0) return SendClientMessage(playerid, info, "[INFO]: {FFFFFF}Godcar has been Enabled"), GodCarC[playerid] = 1, GodCarCTimer[playerid] = SetTimerEx("Repair", 1, 1, "i", playerid);
	P_INFO[playerid][pGodCar] = 0;
	SendClientMessage(playerid, info, "[INFO]: {FFFFFF}Godcar has been Disabled");
	return KillTimer(GodCarCTimer[playerid]);
}

Era o problema la SetTimer, trebuia SetTimerEx pentru ca Repair avea si parametrul playerid ...

EDIT: Al 2000-lea meu post :X

Link to comment
Share on other sites

Guest PlayON

BAAAAAAAAAAAAAAAAAAAAA EJNEBOON??? >>>> SetTimer("Repair", 1, 1);

1 - de 1.000 ori pe secunda?:o EJNEBOON?

Ejneboon - Esti NEBUN? < Am vorbit ca un coleg, sa vad daca-mi iese.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.