Nitrous Timer
#1

Код:
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
Reply
#2

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;
}
Reply
#3

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)