SA-MP Forums Archive
Nitrous Timer - 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: Nitrous Timer (/showthread.php?tid=387926)



Nitrous Timer - Patrick - 26.10.2012

Код:
dcmd_rnos(playerid, params[])
{
    #pragma unused params
    if(IsRegularPlayer[playerid] != 1337) return SendClientMessage(playerid,COLOR_ORANGE,"[AeroBot]: You Are Not A Regular Player");
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED, "[ERROR]You must be in a car to use this command.");
    switch(GetVehicleModel( GetPlayerVehicleID(playerid) ))
	{
		case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
		return SendClientMessage(playerid,COLOR_RED,"[ERROR]You cannot add nitro into this car!");
	}
	AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
	SendClientMessage(playerid, COLOR_GREY, "You have succesfully added nitrous into your car.");
	return 1;
}
Can Anyone help me? add 5 minutes time before they can use the command again + Rep


Re: Nitrous Timer - Babul - 26.10.2012

simple:
Код:
dcmd_rnos(playerid, params[])
{
	#pragma unused params
	if(IsRegularPlayer[playerid] != 1337) return SendClientMessage(playerid,COLOR_ORANGE,"[AeroBot]: You Are Not A Regular Player");
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED, "[ERROR]You must be in a car to use this command.");
	switch(GetVehicleModel( GetPlayerVehicleID(playerid) ))
	{
		case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
		return SendClientMessage(playerid,COLOR_RED,"[ERROR]You cannot add nitro into this car!");
	}
	if(GetTickCount()-GetPVarInt(playerid,"NosUsedMS")>300000)
	{
		SetPVarInt(playerid,"NosUsedMS",GetTickCount());
		AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
		SendClientMessage(playerid, COLOR_GREY, "You have succesfully added nitrous into your car.");
	}
	return 1;
}



Re: Nitrous Timer - Patrick - 26.10.2012

Babul is it possible can u also put error message that they need to wait for 5 minutes pls


Re: Nitrous Timer - Babul - 27.10.2012

oh, sure, a player should know how long to wait:
Код:
dcmd_rnos(playerid, params[])
{
	#pragma unused params
	if(IsRegularPlayer[playerid] != 1337) return SendClientMessage(playerid,COLOR_ORANGE,"[AeroBot]: You Are Not A Regular Player");
	if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED, "[ERROR]You must be in a car to use this command.");
	switch(GetVehicleModel( GetPlayerVehicleID(playerid) ))
	{
		case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
		return SendClientMessage(playerid,COLOR_RED,"[ERROR]You cannot add nitro into this car!");
	}
	new RemainingMS=GetTickCount()-GetPVarInt(playerid,"NosUsedMS");
	if(RemainingMS>300000)
	{
		SetPVarInt(playerid,"NosUsedMS",GetTickCount());
		AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
		SendClientMessage(playerid, COLOR_GREY, "You have succesfully added nitrous into your car.");
	}
	else
	{
		new string[128];
		format(string),sizeof(string),"Please wait %d Minutes until using nІo again!",RemainingMS/1000/60);// /1000 = 1 second /60 = minutes = 1:37 shows as 1 minute
		SendClientMessage(playerid, COLOR_GREY, string);
	}
	return 1;
}
not tested